Пример #1
0
 public virtual void Info(int productId, long productNum)
 {
     M.OneProduct product = M.OneProduct.GetById(DataSource, productId);
     if (product != null)
     {
         M.OneProductNumber number = M.OneProductNumber.GetAllById(DataSource, productNum);
         if (number != null)
         {
             this["Product"] = product;
             this["Number"]  = number;
             OnInfo(product, number);
             Render("one.html");
             return;
         }
     }
     NotFound();
 }
Пример #2
0
 public void Update()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.OneProduct value = DbTable.Load <M.OneProduct>(Request.Form);
                 SetResult(value.UpdateApproved(DataSource), () =>
                 {
                     WritePostLog("MOD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
Пример #3
0
 public void Mod()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.OneProduct value = DbTable.Load <M.OneProduct>(Request.Form);
                 value.Image   = HttpUtility.UrlDecode(value.Image);
                 value.Content = HttpUtility.UrlDecode(value.Content);
                 SetResult(value.Update(DataSource, ColumnMode.Exclude, "Approved"), () =>
                 {
                     WritePostLog("MOD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
Пример #4
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);
 }
Пример #5
0
 public void Add()
 {
     if (CheckAjax())
     {
         if (CheckRight())
         {
             if (IsPost)
             {
                 M.OneProduct value = DbTable.Load <M.OneProduct>(Request.Form);
                 value.Image    = HttpUtility.UrlDecode(value.Image);
                 value.Content  = HttpUtility.UrlDecode(value.Content);
                 value.Approved = false;
                 SetResult(value.Insert(DataSource), () =>
                 {
                     WritePostLog("ADD");
                 });
             }
             else
             {
                 NotFound();
             }
         }
     }
 }
Пример #6
0
 protected virtual void OnInfo(M.OneProduct product, M.OneProductNumber number)
 {
 }