示例#1
0
        protected void btnAssignPermission_Click(object sender, EventArgs e)
        {
            hidTAB.Value = "#tab4";
            if (string.IsNullOrEmpty(this.ddlRoleforPerm.Text))
            {
                this.lblAssgnPermsnMsg.Text = MessageFormatter.GetFormattedErrorMessage("Role required!");
                return;
            }

            if (string.IsNullOrEmpty(this.ddlPermforPerm.Text))
            {
                this.lblAssgnPermsnMsg.Text = MessageFormatter.GetFormattedErrorMessage("Permission required!");
                return;
            }

            try
            {
                bool newRPX = mp.MapRolestoPermission(Convert.ToInt32(this.ddlRoleforPerm.Text), Convert.ToInt32(this.ddlPermforPerm.Text));

                if (newRPX == true)
                {
                    this.lblAssgnPermsnMsg.Text = MessageFormatter.GetFormattedSuccessMessage("Permission assigned Succesfully!");
                    clearForm();
                    GridView4.DataBind();
                }
                else
                {
                    this.lblAssgnPermsnMsg.Text = MessageFormatter.GetFormattedErrorMessage("Permission already asigned!");
                }
            }
            catch (Exception ex)
            {
                this.lblAssgnPermsnMsg.Text = MessageFormatter.GetFormattedErrorMessage("Error:" + ex.Message);
            }
            //AssignPermssns.Attributes.Add("class", "active");
        }