Пример #1
0
 protected void uiLinkButtonSave_Click(object sender, EventArgs e)
 {
     ProductCategories cat = new ProductCategories();
     if (AddNew != 0)
         cat.AddNew();
     else
         cat.LoadByPrimaryKey(CatID);
     cat.NameEn = uiTextBoxName.Text;
     cat.DescriptionEn = uiTextBoxDesc.Text;
     if (!IsParent && ParentCatID !=0)
     {
         cat.CategoryParentID = ParentCatID;
     }
     if (uiFileUploadImg.HasFile)
     {
         string filepath = "/admin/UploadedFiles/cats/" + DateTime.Now.ToString("ddMMyyyyhhmmss") + "_" + uiFileUploadImg.FileName;
         uiFileUploadImg.SaveAs(Server.MapPath("~" + filepath));
         cat.ImagePath= filepath;
     }
     cat.Save();
     FillCategories();
     uiPanelEdit.Visible = false;
     clearFields();
 }
Пример #2
0
 protected void uiLinkButtonDelete_Click(object sender, EventArgs e)
 {
     ProductCategories cat = new ProductCategories();
     cat.LoadByPrimaryKey(CatID);
     cat.MarkAsDeleted();
     cat.Save();
     FillCategories();
     uiPanelEdit.Visible = false;
 }