コード例 #1
0
ファイル: roleadd.aspx.cs プロジェクト: radtek/Portfolio
        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"));
                }
            }
        }
コード例 #2
0
ファイル: roleadd.aspx.cs プロジェクト: jojozhuang/Projects
        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"));
            }

        }