Exemplo n.º 1
0
        protected void btnCreateRole_Click(object sender, EventArgs e)
        {
            hidTAB.Value = "#tab2";
            if (string.IsNullOrEmpty(this.txtRole.Text))
            {
                return;
            }

            if (mp.getRole(this.txtRole.Text) == true)
            {
                this.lblRolMsg.Text = MessageFormatter.GetFormattedErrorMessage("Role already exist!");

                return;
            }

            try
            {
                if (mp.CreateRole(this.txtRole.Text) == true)
                {
                    this.lblRolMsg.Text = MessageFormatter.GetFormattedSuccessMessage("Role Created Succesfully!");
                    txtRole.Text        = "";
                    GridView2.DataBind();
                }
                else
                {
                    this.lblRolMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error Creating Role!");
                }
            }
            catch (Exception ex)
            {
                this.lblRolMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message);
            }
            //Rols.Attributes.Add("class", "active");
        }
Exemplo n.º 2
0
        protected void btnCreateRole_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtRole.Text))
            {
                return;
            }

            if (mp.getRole(this.txtRole.Text) == true)
            {
                this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Role already exist!");

                return;
            }

            try
            {
                if (mp.CreateRole(this.txtRole.Text) == true)
                {
                    this.lblMsg.Text = MessageFormatter.GetFormattedSuccessMessage("Role Created Succesfully!");
                    txtRole.Text     = "";
                }
                else
                {
                    this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error Creating Role!");
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message);
            }
        }