示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     BLL.Categories categ = new BLL.Categories();
     if (!IsPostBack)
     {
         this.dlClass.DataSource = categ.GetAllList().Tables[0];
         this.dlClass.DataBind();
         //gcObj.DLClassBind(this.dlClass);
         //gcObj.DLNewGoods(this.dlNewGoods);
     }
 }
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            if (CurrentCategory != null)
            {
                UpdateRecord();
            }
            else
            {
                AddNewRecord();
            }

            uiPanelEdit.Visible = false;
            uiPanelViewCategories.Visible = true;
            BindData();
            Clearfields();
            CurrentCategory = null;
        }
 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();
     }
 }