protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtPermissionCategoryName, "E01201", "E01202", false))
                return;
            
            Johnny.CMS.BLL.Access.PermissionCategory bll = new Johnny.CMS.BLL.Access.PermissionCategory();
            Johnny.CMS.OM.Access.PermissionCategory model = new Johnny.CMS.OM.Access.PermissionCategory();  
            
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.PermissionCategoryId = Convert.ToInt32(Request.QueryString["id"]);
                model.PermissionCategoryName = txtPermissionCategoryName.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
                
            }
            else
            {
                //insert
                model.PermissionCategoryName = txtPermissionCategoryName.Text;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtPermissionCategoryName.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                string  strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;
                TextBox uptPermissionCategoryName = (TextBox)row.FindControl("txtUptPermissionCategoryName");

                //check title
                if (!CheckInputEmptyAndLength(uptPermissionCategoryName, "E01201", "E01202", false))
                {
                    return;
                }

                //update
                Johnny.CMS.OM.Access.PermissionCategory model = new Johnny.CMS.OM.Access.PermissionCategory();
                model.PermissionCategoryId   = DataConvert.GetInt32(strId);
                model.PermissionCategoryName = uptPermissionCategoryName.Text;

                Johnny.CMS.BLL.Access.PermissionCategory bll = new Johnny.CMS.BLL.Access.PermissionCategory();
                bll.Update(model);
            }

            SetMessage(GetMessage("C00003"));

            //update grid
            getData();
        }
Beispiel #3
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //check category name
            if (!CheckInputEmptyAndLength(txtPermissionCategoryName, "E01201", "E01202", false))
            {
                return;
            }

            Johnny.CMS.BLL.Access.PermissionCategory bll   = new Johnny.CMS.BLL.Access.PermissionCategory();
            Johnny.CMS.OM.Access.PermissionCategory  model = new Johnny.CMS.OM.Access.PermissionCategory();

            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.PermissionCategoryId   = Convert.ToInt32(Request.QueryString["id"]);
                model.PermissionCategoryName = txtPermissionCategoryName.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.PermissionCategoryName = txtPermissionCategoryName.Text;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtPermissionCategoryName.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }