Example #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();
        }
Example #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();
        }
Example #3
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text = GetLabelText("Role_Title");
                litRoleName.Text = GetLabelText("Role_RoleName");
                txtRoleName.ToolTip = GetLabelText("Role_RoleName");
                litDescription.Text = GetLabelText("Role_Description");
                txtDescription.ToolTip = GetLabelText("Role_Description");

                if (Request.QueryString["action"] == "modify")
                {
                    //get RoleId
                    int RoleId = Convert.ToInt32(Request.QueryString["id"]);

                    //Role entity
                    Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();

                    //bind data
                    Johnny.CMS.OM.Access.Role model = new Johnny.CMS.OM.Access.Role();
                    model = bll.GetModel(RoleId);

                    txtRoleName.Text = model.RoleName;
                    txtDescription.Text = model.Description;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
//                    btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }

                //RFVldtRoleName.ErrorMessage = GetMessage("E01501", txtRoleName.MaxLength.ToString());
            }
        }
Example #4
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);

            if (!this.IsPostBack)
            {
                litPageTitle.Text      = GetLabelText("Role_Title");
                litRoleName.Text       = GetLabelText("Role_RoleName");
                txtRoleName.ToolTip    = GetLabelText("Role_RoleName");
                litDescription.Text    = GetLabelText("Role_Description");
                txtDescription.ToolTip = GetLabelText("Role_Description");

                if (Request.QueryString["action"] == "modify")
                {
                    //get RoleId
                    int RoleId = Convert.ToInt32(Request.QueryString["id"]);

                    //Role entity
                    Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();

                    //bind data
                    Johnny.CMS.OM.Access.Role model = new Johnny.CMS.OM.Access.Role();
                    model = bll.GetModel(RoleId);

                    txtRoleName.Text    = model.RoleName;
                    txtDescription.Text = model.Description;

                    btnAdd.ButtonType = Johnny.Controls.Web.Button.Button.EnumButtonType.Save;
//                    btnAdd.Text = CONST_BUTTONTEXT_SAVE;
                }

                //RFVldtRoleName.ErrorMessage = GetMessage("E01501", txtRoleName.MaxLength.ToString());
            }
        }
Example #5
0
 private void CreateddlRole()
 {
     Johnny.CMS.BLL.Access.Role role = new Johnny.CMS.BLL.Access.Role();
     ddlRoles.DataSource = role.GetList();
     ddlRoles.DataTextField = "RoleName";
     ddlRoles.DataValueField = "RoleId";
     ddlRoles.DataBind();
 }
Example #6
0
 private void CreateddlRole()
 {
     Johnny.CMS.BLL.Access.Role role = new Johnny.CMS.BLL.Access.Role();
     ddlRoles.DataSource     = role.GetList();
     ddlRoles.DataTextField  = "RoleName";
     ddlRoles.DataValueField = "RoleId";
     ddlRoles.DataBind();
 }
Example #7
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"));
                }
            }
        }
Example #8
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();
                    bll.Delete(DataConvert.GetInt32(strId));
                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
Example #9
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in myManageGridView.Rows)
            {
                TableCell cell = row.Cells[0];
                Johnny.Controls.Web.CheckBox.CheckBox chkSelect = (Johnny.Controls.Web.CheckBox.CheckBox)cell.FindControl("chkSelect");
                if (chkSelect.Checked)
                {
                    string strId = ((Label)row.FindControl(STR_LABEL_ID)).Text;

                    //delete
                    Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();
                    bll.Delete(DataConvert.GetInt32(strId));

                }
            }

            SetMessage(GetMessage("C00005"));

            //update grid
            getData();
        }
Example #10
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"));
            }

        }        
Example #11
0
 public override void getData()
 {
     Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();
     myManageGridView.DataSource = bll.GetList();
     myManageGridView.DataBind();
 }
Example #12
0
 public override void getData()
 {
     Johnny.CMS.BLL.Access.Role bll = new Johnny.CMS.BLL.Access.Role();
     myManageGridView.DataSource = bll.GetList();
     myManageGridView.DataBind();
 }