protected void uiGridViewCategories_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "EditCategory")
     {
         Categories objData = new Categories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         uiTextBoxEnName.Text = objData.EnName;
         uiTextBoxArName.Text = objData.ArName;
         uiTextBoxEnDesc.Text = objData.EnDescription;
         uiTextBoxArDesc.Text = objData.ArDescription;
         uiPanelViewCategories.Visible = false;
         uiPanelEdit.Visible = true;
         CurrentCategory = objData;
     }
     else if (e.CommandName == "DeleteCategory")
     {
         Categories objData = new Categories();
         objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));
         objData.MarkAsDeleted();
         objData.Save();
         CurrentCategory = null;
         BindData();
     }
 }
 private void AddNewRecord()
 {
     Categories objData = new Categories();
     objData.AddNew();
     objData.EnName = uiTextBoxEnName.Text;
     objData.ArName = uiTextBoxArName.Text;
     objData.EnDescription = uiTextBoxEnDesc.Text;
     objData.ArDescription = uiTextBoxArDesc.Text;
     string filepath = "";
     if (uiFileUploadLogoPath.HasFile)
     {
         uiFileUploadLogoPath.SaveAs(Server.MapPath("~/FileUploads/Categories" + "/" + uiFileUploadLogoPath.FileName));
         filepath = "/Fileuploads/Categories" + "/" + uiFileUploadLogoPath.FileName;
     }
     if (!string.IsNullOrEmpty(filepath))
     {
         objData.IconPath = filepath;
     }
     objData.Save();
 }