Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;
                TextBox updRoleName = (TextBox)row.FindControl("txtUptRoleName");
                TextBox uptDescription = (TextBox)row.FindControl("txtUptDescription");

                //check title
                if (!CheckInputEmptyAndLength(updRoleName, "E01501", "E01502", false))
                    return;

                if (!CheckInputLength(uptDescription, "E01502", false))
                    return;

                //update
                Johnny.CMS.OM.Access.Role model = new Johnny.CMS.OM.Access.Role();
                model.RoleId = DataConvert.GetInt32(strId);
                model.RoleName = updRoleName.Text;
                model.Description = uptDescription.Text;

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

            SetMessage(GetMessage("C00003"));

            //update grid
            getData();
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                string  strId          = ((Label)row.FindControl(STR_LABEL_ID)).Text;
                TextBox updRoleName    = (TextBox)row.FindControl("txtUptRoleName");
                TextBox uptDescription = (TextBox)row.FindControl("txtUptDescription");

                //check title
                if (!CheckInputEmptyAndLength(updRoleName, "E01501", "E01502", false))
                {
                    return;
                }

                if (!CheckInputLength(uptDescription, "E01502", false))
                {
                    return;
                }

                //update
                Johnny.CMS.OM.Access.Role model = new Johnny.CMS.OM.Access.Role();
                model.RoleId      = DataConvert.GetInt32(strId);
                model.RoleName    = updRoleName.Text;
                model.Description = uptDescription.Text;

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

            SetMessage(GetMessage("C00003"));

            //update grid
            getData();
        }
Esempio n. 3
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtRoleName, "E01501", "E01502", false))
            {
                return;
            }

            if (!CheckInputLength(txtDescription, "E01502", false))
            {
                return;
            }

            Johnny.CMS.BLL.Access.Role bll   = new Johnny.CMS.BLL.Access.Role();
            Johnny.CMS.OM.Access.Role  model = new Johnny.CMS.OM.Access.Role();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.RoleId      = Convert.ToInt32(Request.QueryString["id"]);
                model.RoleName    = txtRoleName.Text;
                model.Description = txtDescription.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert
                model.RoleName    = txtRoleName.Text;
                model.Description = txtDescription.Text;

                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtRoleName.Text    = "";
                    txtDescription.Text = "";
                }
                else
                {
                    SetMessage(GetMessage("C00002"));
                }
            }
        }
Esempio n. 4
0
        protected void btnAdd_Click(object sender, System.EventArgs e)
        {
            //validation
            if (!CheckInputEmptyAndLength(txtRoleName, "E01501", "E01502", false))
                return;

            if (!CheckInputLength(txtDescription, "E01502", false))
                return;

            Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();
            Johnny.CMS.OM.Access.Role model = new Johnny.CMS.OM.Access.Role();
            if (Request.QueryString["action"] == "modify")
            {
                //update
                model.RoleId = Convert.ToInt32(Request.QueryString["id"]);
                model.RoleName = txtRoleName.Text;
                model.Description = txtDescription.Text;

                bll.Update(model);
                SetMessage(GetMessage("C00003"));
            }
            else
            {
                //insert 
                model.RoleName = txtRoleName.Text;
                model.Description = txtDescription.Text;
                
                if (bll.Add(model) > 0)
                {
                    SetMessage(GetMessage("C00001"));
                    txtRoleName.Text = "";
                    txtDescription.Text = "";
                }
                else
                    SetMessage(GetMessage("C00002"));
            }

        }