예제 #1
0
 public void Add()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.ProductAttribute attr = new M.ProductAttribute()
                 {
                     Name       = Request["Name"],
                     CategoryId = int.Parse(Request["CategoryId"]),
                     SortNum    = int.Parse(Request["SortNum"])
                 };
                 SetResult(attr.Insert(DataSource), () =>
                 {
                     WritePostLog("ADD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
예제 #2
0
 public void Mod()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.ProductAttribute attr = new M.ProductAttribute()
                 {
                     Id      = int.Parse(Request["Id"]),
                     Name    = Request["Name"],
                     SortNum = int.Parse(Request["SortNum"])
                 };
                 SetResult(attr.Update(DataSource), () =>
                 {
                     WritePostLog("MOD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
예제 #3
0
 protected override bool HasReferences(DataSource ds)
 {
     if (ExecuteCount <StoreCategory>(ds, P("ParentId", Id)) > 0)
     {
         return(true);
     }
     if (ProductBrand.GetCountByCategoryId(ds, Id) > 0)
     {
         return(true);
     }
     if (Product.GetCountByCategoryId(ds, Id) > 0)
     {
         return(true);
     }
     if (ProductAttribute.GetCountByCategoryId(ds, Id) > 0)
     {
         return(true);
     }
     if (OneProduct.GetCountByCategoryId(ds, Id) > 0)
     {
         return(true);
     }
     return(false);
 }
예제 #4
0
 public void Del()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.ProductAttribute attr = new M.ProductAttribute()
                 {
                     Id = int.Parse(Request["Id"])
                 };
                 SetResult(attr.Delete(DataSource), () =>
                 {
                     WritePostLog("DEL");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }