当前位置: 首页>>代码示例>>C#>>正文


C# CategoryInfo类代码示例

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


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

示例1: CateModel

 public CateModel()
 {
     Category = new CategoryInfo();
     CateSelectItem = new List<SelectListItem>();
     CateType = new List<SelectListItem>();
     CateList = new List<CategoryInfo>();
 }
开发者ID:robotbird,项目名称:jqpress,代码行数:7,代码来源:CateModel.cs

示例2: UpdateCategory

        public int UpdateCategory(CategoryInfo category)
        {
            CheckSlug(category);

            string cmdText = @"update [loachs_terms] set
                                [Type][email protected],
                                [Name][email protected],
                                [Slug][email protected],
                                [Description][email protected],
                                [Displayorder][email protected],
                                [Count][email protected],
                                [CreateDate][email protected]
                                where [email protected]";
            OleDbParameter[] prams = {
                                OleDbHelper.MakeInParam("@Type",OleDbType.Integer,1,(int)TermType.Category),
                                OleDbHelper.MakeInParam("@Name",OleDbType.VarWChar,255,category.Name),
                                OleDbHelper.MakeInParam("@Slug",OleDbType.VarWChar,255,category.Slug),
                                OleDbHelper.MakeInParam("@Description",OleDbType.VarWChar,255,category.Description),
                                OleDbHelper.MakeInParam("@Displayorder",OleDbType.Integer,4,category.Displayorder),
                                OleDbHelper.MakeInParam("@Count",OleDbType.Integer,4,category.Count),
                                OleDbHelper.MakeInParam("@CreateDate",OleDbType.Date,8,category.CreateDate),
                                OleDbHelper.MakeInParam("@termid",OleDbType.Integer,1,category.CategoryId),
                            };
            return Convert.ToInt32(OleDbHelper.ExecuteScalar(CommandType.Text, cmdText, prams));
        }
开发者ID:azraelrabbit,项目名称:LoachsMono,代码行数:25,代码来源:Category.cs

示例3: Update

 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public static int Update(CategoryInfo model)
 {
     string strSQL = "UPDATE Categories SET Name = @Name,Sort = @Sort,ImageUrl = @ImageUrl,LinkUrl = @LinkUrl,Introduction = @Introduction,Alias = @Alias,TemplateType = @TemplateType,IsShowFirstChildNode = @IsShowFirstChildNode,BannerAdImageUrl = @BannerAdImageUrl,IsEnabled = @IsEnabled,IsDeleted = @IsDeleted WHERE ID = @ID";
     SqlParameter[] parms = { 
                             new SqlParameter("ParentId",SqlDbType.Int),
                             new SqlParameter("ParentIdList",SqlDbType.NVarChar),
                             new SqlParameter("Sort",SqlDbType.Int),
                             new SqlParameter("Name",SqlDbType.NVarChar),
                             new SqlParameter("ImageUrl",SqlDbType.NVarChar),
                             new SqlParameter("LinkUrl",SqlDbType.NVarChar),
                             new SqlParameter("Introduction",SqlDbType.NVarChar),
                             new SqlParameter("Alias",SqlDbType.NVarChar),
                             new SqlParameter("TemplateType",SqlDbType.Int),
                             new SqlParameter("IsShowFirstChildNode",SqlDbType.Int),
                             new SqlParameter("BannerAdImageUrl",SqlDbType.NVarChar),
                             new SqlParameter("IsEnabled",SqlDbType.Int),
                             new SqlParameter("IsDeleted",SqlDbType.Int),
                             new SqlParameter("Id",SqlDbType.Int),
                            };
     parms[0].Value = model.ParentId;
     parms[1].Value = model.ParentIdList;
     parms[2].Value = model.Sort;
     parms[3].Value = model.Name == null ? string.Empty : model.Name;
     parms[4].Value = model.ImageUrl == null ? string.Empty : model.ImageUrl;
     parms[5].Value = model.LinkUrl == null ? string.Empty : model.LinkUrl;
     parms[6].Value = model.Introduction == null ? string.Empty : model.Introduction;
     parms[7].Value = model.Alias == null ? string.Empty : model.Alias;
     parms[8].Value = model.TemplateType;
     parms[9].Value = model.IsShowFirstChildNode;
     parms[10].Value = model.BannerAdImageUrl == null ? string.Empty : model.BannerAdImageUrl;
     parms[11].Value = model.IsEnabled;
     parms[12].Value = model.IsDeleted;
     parms[13].Value = model.Id;
     return Goodspeed.Library.Data.SQLPlus.ExecuteNonQuery(CommandType.Text,strSQL,parms);
 }
开发者ID:xbf321,项目名称:Elco,代码行数:40,代码来源:CategoryManage.cs

示例4: UpdateCategory

        public int UpdateCategory(CategoryInfo category)
        {
            CheckSlug(category);

            string cmdText = string.Format(@"update [{0}category] set
                                [Type][email protected],
                                [ParentId][email protected],
                                [CateName][email protected],
                                [Slug][email protected],
                                [Description][email protected],
                                [SortNum][email protected],
                                [PostCount][email protected],
                                [CreateTime][email protected]
                                where [email protected]", ConfigHelper.Tableprefix);
            OleDbParameter[] prams = {
                                OleDbHelper.MakeInParam("@Type",OleDbType.Integer,1,(int)CategoryType.Category),
                                OleDbHelper.MakeInParam("@ParentId",OleDbType.Integer,4,category.ParentId),
                                OleDbHelper.MakeInParam("@CateName",OleDbType.VarWChar,255,category.CateName),
                                OleDbHelper.MakeInParam("@Slug",OleDbType.VarWChar,255,category.Slug),
                                OleDbHelper.MakeInParam("@Description",OleDbType.VarWChar,255,category.Description),
                                OleDbHelper.MakeInParam("@SortNum",OleDbType.Integer,4,category.SortNum),
                                OleDbHelper.MakeInParam("@PostCount",OleDbType.Integer,4,category.PostCount),
                                OleDbHelper.MakeInParam("@CreateTime",OleDbType.Date,8,category.CreateTime),
                                OleDbHelper.MakeInParam("@categoryid",OleDbType.Integer,1,category.CategoryId),
                            };
            return Convert.ToInt32(OleDbHelper.ExecuteScalar(CommandType.Text, cmdText, prams));
        }
开发者ID:robotbird,项目名称:jqpress-aspx,代码行数:27,代码来源:CategoryData.cs

示例5: Save

        public JsonResult Save(CategoryInfo cat)
        {
            if (string.IsNullOrEmpty(cat.PageName))
            {
                cat.PageName = cat.CateName;
            }

            cat.PageName = HttpHelper.HtmlEncode(StringHelper.FilterPageName(cat.PageName, "cate"));

            if (cat.CategoryId > 0)
            {
                var  oldcat = _categoryService.GetCategory(cat.CategoryId);
                cat.CreateTime = oldcat.CreateTime;
                cat.PostCount = oldcat.PostCount;
                _categoryService.UpdateCategory(cat);
            }
            else
            {
                cat.CreateTime = DateTime.Now;
                cat.PostCount = 0;
                cat.CategoryId = _categoryService.InsertCategory(cat);
            }
            cat.TreeChar = _categoryService.GetCategoryTreeList().Find(c => c.CategoryId == cat.CategoryId).TreeChar;

            return Json(cat, JsonRequestBehavior.AllowGet);
        }
开发者ID:robotbird,项目名称:jqpress,代码行数:26,代码来源:CategoryController.cs

示例6: Compare

 public int Compare(CategoryInfo info)
 {
     if (this.Equals(info)) {
         return 0;
     }
     try {
         Text[] texts = info.GetComponentsInChildren<Text>();
         for (int i = 0; i < texts.Length; i++) {
             if (texts[i].name.Equals("Rate")) {
                 float otherNumber = float.Parse(texts[i].text);
                 float myNumber = float.Parse(this.rate.text);
                 //There's no equal or approximate relations. Being thorough here.
                 if (myNumber < otherNumber) {
                     //Other number is larger, so we are smaller in comparison.
                     return -1;
                 }
                 else if (myNumber > otherNumber) {
                     //Other number is smaller, so we are larger in comparison.
                     return 1;
                 }
                 break;
             }
         }
     }
     catch (System.Exception e) {
         Debug.LogError("Error parsing data from Category Info: " + e.ToString());
     }
     return -1;
 }
开发者ID:tommai78101,项目名称:Multiplier,代码行数:29,代码来源:CategoryInfo.cs

示例7: InsertCategory

        /// <summary>
        /// 添加分类
        /// </summary>
        /// <param name="category"></param>
        /// <returns></returns>
        public int InsertCategory(CategoryInfo category)
        {
            CheckSlug(category);

            string cmdText = @"insert into [loachs_terms]
                            (
                            [Type],[Name],[Slug],[Description],[Displayorder],[Count],[CreateDate]
                            )
                            values
                            (
                            @Type,@Name,@Slug,@Description,@Displayorder,@Count,@CreateDate
                            )";
            OleDbParameter[] prams = {
                                OleDbHelper.MakeInParam("@Type",OleDbType.Integer,1,(int)TermType.Category),
                                OleDbHelper.MakeInParam("@Name",OleDbType.VarWChar,255,category.Name),
                                OleDbHelper.MakeInParam("@Slug",OleDbType.VarWChar,255,category.Slug),
                                OleDbHelper.MakeInParam("@Description",OleDbType.VarWChar,255,category.Description),
                                OleDbHelper.MakeInParam("@Displayorder",OleDbType.Integer,4,category.Displayorder),
                                OleDbHelper.MakeInParam("@Count",OleDbType.Integer,4,category.Count),
                                OleDbHelper.MakeInParam("@CreateDate",OleDbType.Date,8,category.CreateDate)
                            };
            OleDbHelper.ExecuteScalar(CommandType.Text, cmdText, prams);

            int newId = Convert.ToInt32(OleDbHelper.ExecuteScalar("select top 1 [termid] from [loachs_terms] order by [termid] desc"));

            return newId;
        }
开发者ID:azraelrabbit,项目名称:LoachsMono,代码行数:32,代码来源:Category.cs

示例8: Update

        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="mod">CategoryInfo</param>
        /// <returns>受影响行数</returns>
        public int Update(CategoryInfo mod)
        {
           using (DbConnection conn = db.CreateConnection())
			{
				conn.Open();
				using (DbTransaction tran = conn.BeginTransaction())
				{ 
					try
					{ 
						using (DbCommand cmd = db.GetStoredProcCommand("SP_Category_Update"))
						{
							db.AddInParameter(cmd, "@CategoryID", DbType.Int32, mod.CategoryID); 
							db.AddInParameter(cmd, "@CategoryName", DbType.String, mod.CategoryName); 
							db.AddInParameter(cmd, "@State", DbType.Int32, mod.State); 
							db.AddInParameter(cmd, "@IsDeleted", DbType.Int32, mod.IsDeleted); 
							db.AddInParameter(cmd, "@Sort", DbType.Int32, mod.Sort); 
							tran.Commit();
							return db.ExecuteNonQuery(cmd);
						} 
					}
					catch (Exception e)
					{
						tran.Rollback();
						throw e;
					}
					finally
					{
						conn.Close();
					}
				}
			}
        }  
开发者ID:aNd1coder,项目名称:Wojoz,代码行数:37,代码来源:CategoryDAL.cs

示例9: Delete

 /// <summary>
 /// 删除分类
 /// </summary>
 /// <param name="category"></param>
 /// <returns></returns>
 public int Delete(CategoryInfo category)
 {
     string cmdText = string.Format("delete from [{0}category] where [categoryid] = @categoryid", ConfigHelper.Tableprefix);
     using (var conn = new DapperHelper().OpenConnection())
     {
         return conn.Execute(cmdText, new { categoryid = category.CategoryId });
     }
 }
开发者ID:robotbird,项目名称:jqpress,代码行数:13,代码来源:CategoryRepository.cs

示例10: SerializeInternal

 private void SerializeInternal(CategoryInfo model, IDictionary<string, object> result)
 { 
     result.Add("categoryid", model.CategoryID);
     result.Add("categoryname", model.CategoryName);
     result.Add("state", model.State);
     result.Add("isdeleted", model.IsDeleted);
     result.Add("sort", model.Sort);
 }
开发者ID:aNd1coder,项目名称:Wojoz,代码行数:8,代码来源:CategoryJavascriptConverter.cs

示例11: CheckReadPermission

 private void CheckReadPermission(CategoryInfo category)
 {
     if ((category != null) && (category.CategoryUserID != currentUser.UserID))
     {
         // Check read permission for Categories module
         if (!currentUser.IsAuthorizedPerResource("CMS.Categories", "Read"))
         {
             RedirectToAccessDenied("CMS.Categories", "Read");
         }
     }
 }
开发者ID:kbuck21991,项目名称:kentico-blank-project,代码行数:11,代码来源:CategoryEdit.aspx.cs

示例12: InsertCategory

 public int InsertCategory(CategoryInfo category)
 {
     SqlConnection conn;
     int count = 0;
     using (conn = SqlHelper.CreateConntion())
     {
         conn.Open();
         count = categoryDal.InsertCategory(category, conn);
         conn.Close();
     }
     return count;
 }
开发者ID:uwitec,项目名称:my-shop-manage,代码行数:12,代码来源:CategoryService.cs

示例13: RenderLeftCategoryMenu

        public ActionResult RenderLeftCategoryMenu(CategoryInfo currentCategoryInfo, CategoryInfo rootCategoryInfo,string linkFormat)
        {          

            int rootId = rootCategoryInfo.Id;
            StringBuilder sbHtml = new StringBuilder();
            var allCatList = CategoryService.ListAllSubCatById(rootId).Where(p => p.IsDeleted == false && p.IsEnabled == true);

            Action<IEnumerable<CategoryInfo>, int, int, StringBuilder> fb = null;
            fb = (catList, parentId, level, sb) =>
            {
                var tempList = catList.Where(p => p.ParentId == parentId).OrderBy(p => p.Sort);

                string className = parentId == rootId ? "category-menu" : "none";
                sb.AppendFormat("<ul class=\"{0}\" {1}>", className, parentId == rootId ? "id=\"category_menu\"" : string.Empty);

                if (tempList.Count() == 0)
                {
                    //如果没有分类,则显示父分类名称
                    sbHtml.AppendFormat("<li class=\"on\"><a href=\"{1}\">{0}</a></li>", rootCategoryInfo.Name, Request.Url.AbsolutePath);
                }
                else
                {

                    foreach (var item in tempList)
                    {
                        //判断是否子分类
                        var ishasChild = catList.Where(p => p.ParentId == item.Id).Count() > 0;

                        if (currentCategoryInfo != null && currentCategoryInfo.Id == item.Id)
                        {
                            sb.Append("<li class=\"on\">");
                        }
                        else
                        {
                            sb.Append("<li>");
                        }
                        sb.AppendFormat("<a href=\"{3}\" id=\"d_menu_{1}\" title=\"{0}\" class=\"{2}\">{0}</a>", item.Name, item.Id, ishasChild ? "sub-icon" : string.Empty,string.IsNullOrEmpty(linkFormat) ? item.Url : string.Format(linkFormat,item.Id));


                        if (ishasChild)
                        {
                            fb(catList, item.Id, level + 1, sb);
                        }
                        sb.Append("</li>");
                    }
                }
                sb.Append("</ul>");
            };
            fb(allCatList, rootId, 0, sbHtml);

            return Content(sbHtml.ToString());
        }
开发者ID:xbf321,项目名称:Elco,代码行数:52,代码来源:HomeController.cs

示例14: Create

 /// <summary>
 /// 添加或更新分类信息
 /// </summary>
 /// <param name="model"></param>
 /// <returns>主键ID</returns>
 public static int Create(CategoryInfo model)
 {
     if (model.Id == 0)
     {
         //Insert
         int i = CategoryManage.Insert(model);
         model.Id = i;
     }
     else
     {
         //Update
         CategoryManage.Update(model);
     }
     return model.Id;
 }
开发者ID:xbf321,项目名称:Elco,代码行数:20,代码来源:CategoryService.cs

示例15: btnEdit_Click

        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnEdit_Click(object sender, EventArgs e)
        {
            CategoryInfo term = new CategoryInfo();
            if (Operate == OperateType.Update)
            {
                term = CategoryManager.GetCategory(categoryId);
            }
            else
            {
                term.CreateDate = DateTime.Now;
                term.Count = 0;
            }
            term.Name = StringHelper.HtmlEncode(txtName.Text);
            term.Slug = txtSlug.Text.Trim();
            if (string.IsNullOrEmpty(term.Slug))
            {
                term.Slug = term.Name;
            }

            term.Slug = StringHelper.HtmlEncode(PageUtils.FilterSlug(term.Slug, "cate"));

            term.Description = StringHelper.HtmlEncode(txtDescription.Text);
            term.Displayorder = StringHelper.StrToInt(txtDisplayOrder.Text, 1000);

            if (term.Name == "")
            {
                ShowError("请输入名称!");
                return;
            }

            if (Operate == OperateType.Update)
            {
                CategoryManager.UpdateCategory(term);
                Response.Redirect("categorylist.aspx?result=2");
            }
            else
            {
                CategoryManager.InsertCategory(term);
                Response.Redirect("categorylist.aspx?result=1");
            }
        }
开发者ID:azraelrabbit,项目名称:LoachsMono,代码行数:46,代码来源:categorylist.aspx.cs


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