Пример #1
0
 public static void insert(CategoryEntity category)
 {
     DbHelper.ExecuteNonQuery("p_Category_insert",
       category.Name,
       category.ParentId,
       category.Treelevel,
       category.Sort,
       category.Shortname,
       category.IsShow
        );
 }
Пример #2
0
 public static CategoryEntity getById(int categoryId)
 {
     DataRow dr = DbHelper.ExecuteDataRow("p_category_getById", categoryId);
     CategoryEntity category = new CategoryEntity();
     if (dr != null)
     {
         category.CategoryId = Convert.ToInt32(dr["categoryId"]);
         category.Name = dr["name"].ToString();
         category.ParentId = Convert.ToInt32(dr["parentId"]);
         category.Treelevel = Convert.ToInt32(dr["treelevel"]);
         category.Sort = Convert.ToInt32(dr["sort"]);
         category.Shortname = dr["shortname"].ToString();
         category.IsShow = Convert.ToBoolean(dr["isShow"]);
     }
     return category;
 }
Пример #3
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            if (logic.category.isExistShortname(id ,txt_Ab.Text.Trim()))
            {
                Library.Script.ClientMsg("已经存在类别缩写,请更换!");
                return;
            }

            CategoryEntity cat = new CategoryEntity();

            cat.Name = txt_Name.Text;
            cat.Shortname = txt_Ab.Text;

            cat.Sort = txt_Sort.Text != "" ? Convert.ToInt32(txt_Sort.Text) : 1;

            cat.Treelevel = txt_Treelevel.Text != "" ? Convert.ToInt32(txt_Treelevel.Text) : 0;
            cat.ParentId = Convert.ToInt32(drp_ParentCategory.SelectedItem.Value);
            cat.IsShow = chx_isShow.Checked;
            if (id != 0)
            {
                cat.CategoryId = id;
                logic.category.update(cat);
                Library.Script.ClientMsgUrl("保存成功!", "categoryList.aspx");
            }
            else
            {
                logic.category.insert(cat);
                if (cat.ParentId!=0 && cat.IsShow==true)
                {
                    Library.Script.ClientMsgUrl("添加成功,请初始化系统加价体系!", "systemPriceModulus.aspx");
                }
                else
                {
                    Library.Script.ClientMsgUrl("保存成功!", "categoryList.aspx");
                }
            }
        }
Пример #4
0
 public static void update(CategoryEntity cate)
 {
     Category.update(cate);
 }
Пример #5
0
 public static void insert(CategoryEntity cate)
 {
     Category.insert(cate);
 }