• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Categories类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Categories的典型用法代码示例。如果您正苦于以下问题:C# Categories类的具体用法?C# Categories怎么用?C# Categories使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Categories类属于命名空间,在下文中一共展示了Categories类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Add

        public ActionResult Add(string catTitle = "", int parentID = 0, string image = "", int isLifestyle = 0, string shortDesc = "", string longDesc = "", bool vehicleSpecific = false)
        {
            // Save the category
            List<string> error_messages = new List<string>();
            Categories cat = new Categories();
            try {
                cat = ProductCat.SaveCategory(0, catTitle, parentID, image, isLifestyle, shortDesc, longDesc, vehicleSpecific);
            } catch (Exception e) {
                error_messages.Add(e.Message);
            }

            // Make sure we didn't catch any errors
            if (error_messages.Count == 0 && cat.catID > 0) {
                return RedirectToAction("Index");
            } else {
                ViewBag.catTitle = catTitle;
                ViewBag.parentID = parentID;
                ViewBag.image = image;
                ViewBag.isLifestyle = isLifestyle;
                ViewBag.shortDesc = shortDesc;
                ViewBag.longDesc = longDesc;
                ViewBag.vehicleSpecific = vehicleSpecific;
                ViewBag.error_messages = error_messages;
            }

            // Get the categories so this category can make the new one a subcategory if they choose
            List<DetailedCategories> cats = ProductCat.GetCategories();
            ViewBag.cats = cats;

            return View();
        }
开发者ID:janiukjf,项目名称:CurtAdmin,代码行数:31,代码来源:CategoriesController.cs


示例2: ContainsCategory

 public static int ContainsCategory(Categories category, Categories find)
 {
     if ((category & find) == find)
         return 1;
     else
         return 0;
 }
开发者ID:RyuaNerin,项目名称:ExHentaiAPI,代码行数:7,代码来源:Helper.cs


示例3: AddCategory

    /// <summary>
    /// AddCategory checks if the category name is not in use, if not in use it adds a new category
    /// </summary>
    /// <param name="category"></param>
    /// <returns></returns>
    public static string AddCategory(Categories category)
    {
        string query = string.Format("SELECT COUNT(*) FROM categories WHERE name = '{0}'", category.Name);
        command.CommandText = query;

        try
        {
            conn.Open();
            int amountOfCategorys = (int)command.ExecuteScalar();

            if (amountOfCategorys < 1)      // Check if category does NOT exist
            {
                // Category does NOT exists, create a new category
                query = string.Format(@"INSERT INTO categories VALUES ('{0}')", category.Name);
                command.CommandText = query;
                command.ExecuteNonQuery();
                return "Categorie toegevoegd!";
            }
            else        // Category exists, return error message
            {
                return "Deze categorie bestaat al, categorie niet toegevoegd.";
            }
        }
        finally
        {
            conn.Close();
            command.Parameters.Clear();
        }
    }
开发者ID:Roer1200,项目名称:MilanovP3P,代码行数:34,代码来源:ConnectionClass.cs


示例4: TimeMethod

		public void TimeMethod(decimal elapsedMiliSeconds, Categories category, Layers layer)
		{
			if (IsEnabled())
			{
				WriteEvent(EventIds.TimeMethod, elapsedMiliSeconds, category, layer);
			}
		}
开发者ID:smartpcr,项目名称:Instrumentation,代码行数:7,代码来源:EtwTraceEventSource.cs


示例5: Track

        public void Track(Categories category, string action, string label = null, int value = 0)
        {
            if (!_disabled)
                _tracker.TrackEventAsync(category.ToString(), action, label, value);

                System.Diagnostics.Debug.WriteLine("Analytics: {0}/{1}/{2}/{3}", category.ToString(), action, label, value);
        }
开发者ID:amoikevin,项目名称:Windows-Phone-Power-Tools,代码行数:7,代码来源:Analytics.cs


示例6: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        dbOps = DBOperations.Instance;
        links = Links.Instance;
        general = General.Instance;
        gui = GUIVariables.Instance;
        categories = Categories.Instance;
        engine = ProcessingEngine.Instance;
        imageEngine = ImageEngine.Instance;
        tagger = Tagger.Instance;
        log = Logger.Instance;

        seperator = gui.Seperator;

        //  QueryString Param Names.
        //  ratingID
        //  value

        string iid = string.Empty;
        string value = string.Empty;

        #region CookieAlreadyExists
        //  START: If a getputsCookie with the Username already exists, do not show the Login Page.

        if (Request.Cookies["getputsCookie"] != null)
        {
            HttpCookie getputsCookie = Request.Cookies["getputsCookie"];
            UID = dbOps.Decrypt(getputsCookie["UID"].ToString().Trim());
        }
        if (string.IsNullOrEmpty(UID))
        {

        }
        else
        {

        }
        //  END: If a getputsCookie with the Username already exists, do not show the Login Page.
        #endregion CookieAlreadyExists

        if (Request.QueryString != null && Request.QueryString.Count > 0)
        {
            //  ratingID is the Item IID.
            if (!string.IsNullOrEmpty(Request.QueryString["ratingID"]))
            {
                iid = Request.QueryString["ratingID"];
            }
            //  Value is the Rating given by the user. Value: [0, 1, 2, 3, 4]. So add +1 so as to convert Value: [1, 2, 3, 4, 5]
            if (!string.IsNullOrEmpty(Request.QueryString["value"]))
            {
                int intValue = -1;
                value = int.TryParse(Request.QueryString["value"], out intValue) ? (intValue + 1).ToString() : "-1";
            }
        }

        if (!string.IsNullOrEmpty(UID) && !string.IsNullOrEmpty(iid) && !string.IsNullOrEmpty(value))
        {
            UpdateRatings(UID, iid, value);
        }
    }
开发者ID:vatsal,项目名称:getputs,代码行数:60,代码来源:SubmitRating.aspx.cs


示例7: AllDemoMVCBLL

 public AllDemoMVCBLL()
 {
     Categories = new Categories();
     Logins = new Logins();
     SubCategories = new SubCategories();
     Receipies = new Receipies();
 }
开发者ID:hiteshcemba,项目名称:MVCDemo,代码行数:7,代码来源:AllDemoMVCBLL.cs


示例8: GetWordShouldWorkPropperlyWhenValidInput

        public void GetWordShouldWorkPropperlyWhenValidInput(Categories category)
        {
            var word = this.wordFactory.GetWord(category);

            Assert.IsNotNull(word);
            Assert.IsNotNull(word.Content);
        }
开发者ID:HQC-Team-Hangman-4,项目名称:Hangman-4,代码行数:7,代码来源:WordFactoryTests.cs


示例9: GetCategories

    /// <summary> 
    /// This function is used to get all the available
    /// categories of possible events
    /// </summary>
    /// <param name="key">Key required to make the API call</param>
    /// <returns>JSON in String Format containing all categories</returns> 
    public string GetCategories(string key)
    {
        String outputString = "";
        int count = 0;
        Category category = null;
        Categories categories = new Categories();
        using (WebClient wc = new WebClient())
        {

            string xml = wc.DownloadString("http://api.evdb.com/rest/categories/list?app_key=" + key);
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(xml);
            XmlNodeList root = doc.GetElementsByTagName("category");
            count = root.Count;
            string json = JsonConvert.SerializeXmlNode(doc);
            JObject obj = JObject.Parse(json);
            int temp = 0;
            while (temp < count)
            {
                category = new Category();
                category.categoryID = (string)obj["categories"]["category"][temp]["id"];
                category.categoryName = (string)obj["categories"]["category"][temp]["name"];
                categories.categories.Add(category);
                temp++;
            }
            outputString = JsonConvert.SerializeObject(categories);
        }
        return outputString;
    }
开发者ID:ksm5629,项目名称:WebServices,代码行数:35,代码来源:Service.cs


示例10: Search

        public ViewResult Search(string name, Categories? categoty)
        {
            var lista = _business.GetActiveProducts();

            var model = new ProductList();

            if(lista != null)
            {
                if (!String.IsNullOrEmpty(name) && categoty != null)
                    model.Products =
                        lista.Where(
                            x =>
                            ((!String.IsNullOrEmpty(name) && x.Name.ToLower().Contains(name.ToLower())) && (x.Category.Equals(categoty)))).
                            Select(x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
                else if (!String.IsNullOrEmpty(name))
                    model.Products =
                        lista.Where(x => !String.IsNullOrEmpty(name) && x.Name.ToLower().Contains(name.ToLower())).Select(
                            x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
                else if (categoty != null)
                    model.Products =
                        lista.Where(x => x.Category.Equals(categoty)).Select(x => new Models.Product.Product().InjectFrom(x)).Cast
                            <Models.Product.Product>().ToList();
                else
                    model.Products = lista.Select(x => new Models.Product.Product().InjectFrom(x)).Cast<Models.Product.Product>().ToList();
            }
            else
            {
                model.Products = new List<Models.Product.Product>();
            }

            return View("Index",model);
        }
开发者ID:BernardoMorais,项目名称:LivrariaTDD,代码行数:32,代码来源:HomeController.Search.cs


示例11: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        links = Links.Instance;
        gui = GUIVariables.Instance;
        dbOps = DBOperations.Instance;
        categories = Categories.Instance;
        log = Logger.Instance;
        engine = ProcessingEngine.Instance;
        general = General.Instance;
        imageEngine = ImageEngine.Instance;

        seperator = gui.Seperator;

        if (string.IsNullOrEmpty(Request.QueryString["UID"]))
        {

        }
        else
        {
            queryStringUID = Request.QueryString["UID"].Trim().ToLower();
        }

        if (string.IsNullOrEmpty(queryStringUID))
        {

        }
        else
        {
            LoadComments(queryStringUID);
        }
    }
开发者ID:vatsal,项目名称:getputs,代码行数:31,代码来源:Commented.aspx.cs


示例12: Exit

 public void Exit(Categories category, Layers layer, string className, string methodName, string message, string outArgs, long? elapsedMiliSeconds)
 {
     if (IsEnabled())
     {
         WriteEvent(EventIds.MethodEnd, category, layer, className, methodName, message, outArgs, elapsedMiliSeconds);
     }
 }
开发者ID:smartpcr,项目名称:Instrumentation,代码行数:7,代码来源:EtwTraceEventSource.cs


示例13: Enter

 public void Enter(Categories category, Layers layer, string className, string methodName, string message, string inArgs)
 {
     if (IsEnabled())
     {
         WriteEvent(EventIds.MethodStart, category, layer, className, methodName, message, inArgs);
     }
 }
开发者ID:smartpcr,项目名称:Instrumentation,代码行数:7,代码来源:EtwTraceEventSource.cs


示例14: TraceCallGraphAspect

 public TraceCallGraphAspect(Categories category, Layers layer, CallFlowType flowType=CallFlowType.Layer, bool logCallStack=false)
 {
     this.Category = category;
     this.Layer = layer;
     this.FlowType = flowType;
     this.LogCallStack = logCallStack;
 }
开发者ID:smartpcr,项目名称:Instrumentation,代码行数:7,代码来源:TraceCallGraphAspect.cs


示例15: Demographic

 public Demographic(int turn, Categories category, float value, float average, int rank)
 {
     Turn = turn;
     Category = category;
     Value = value;
     Average = average;
     Rank = rank;
 }
开发者ID:bayvakoof,项目名称:civstats-app,代码行数:8,代码来源:DemographicsTracker.cs


示例16: AddCategory

        public void AddCategory(Categories category)
        {
            healthTrackerDB.categories.InsertOnSubmit(category);
            healthTrackerDB.SubmitChanges();

            //update UI
            LoadCategories();
        }
开发者ID:nagyist,项目名称:chenliang0571-Health-Tracker,代码行数:8,代码来源:MainViewModel.cs


示例17: Project

 public Project()
 {
     _UUID = System.Guid.NewGuid();
     timeline = new List<Play>();
     Categories = new Categories();
     LocalTeamTemplate = new TeamTemplate();
     VisitorTeamTemplate = new TeamTemplate();
 }
开发者ID:dineshkummarc,项目名称:longomatch,代码行数:8,代码来源:Project.cs


示例18: TrackAsync

        public async Task TrackAsync(Categories category, string action, string label = null, int value = 0) 
        {
            System.Diagnostics.Debug.WriteLine("Analytics: Async: {0}/{1}/{2}/{3}", category.ToString(), action, label, value);
            
            if (!_disabled)
                await _tracker.TrackEventAsync(category.ToString(), action, label, value);

        }
开发者ID:amoikevin,项目名称:Windows-Phone-Power-Tools,代码行数:8,代码来源:Analytics.cs


示例19: Excluded

 private bool Excluded(ITestMethodInfo testMethod) {
    if(_excludedCategories.IsEmpty) {
       return false;
    }
    var local = new Categories();
    local.Add(testMethod.Categories);
    local.Add(testMethod.InheritedCategories);
    return local.Intersect(_excludedCategories).Count > 0;
 }
开发者ID:ManfredLange,项目名称:csUnit,代码行数:9,代码来源:CategorySelector.cs


示例20: Main

        public static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

            Registry.CurrentUser.CreateSubKey(@"Software\WallpaperChanger");
            RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Software\WallpaperChanger", true);

            object objCategories = key.GetValue(@"Categories");

            if (objCategories == null)
                categories = Categories.General | Categories.Anime | Categories.HDR;
            else
            {
                try
                {
                    categories = (Categories)Convert.ToByte(objCategories.ToString());
                }
                catch (FormatException)
                {
                    categories = Categories.General | Categories.Anime | Categories.HDR;
                }
            }

            object objPurity = key.GetValue(@"Purity");

            if (objPurity == null)
                purity = Purity.Clean;
            else
            {
                try
                {
                    purity = (Purity)Convert.ToByte(objPurity.ToString());
                }
                catch (FormatException)
                {
                    purity = Purity.Clean;
                }
            }

            try
            {
                SetWallpaper();
            }
            catch (Exception e)
            {
                string errorMessage = String.Format("Fatal error: {0}", e.ToString());

                // Пишем в лог...
                if (!EventLog.SourceExists(logSource))
                    EventLog.CreateEventSource(logSource, "Application");

                EventLog.WriteEntry(logSource, errorMessage, EventLogEntryType.Warning);

                // ...и в консоль
                Console.WriteLine(errorMessage);
            }
        }
开发者ID:rhssiiy,项目名称:WallpaperChanger,代码行数:57,代码来源:Main.cs



注:本文中的Categories类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Category类代码示例发布时间:2022-05-24
下一篇:
C# CatchPos类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap