コード例 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            int status = Groups.getRoleNameStatus(txtRole.Text.Trim(), Conversion.ParseInt(ddlRole.SelectedItem.Value));
            if (status == 0)
            {
                lblRoleNameError.Text = string.Empty;

                Groups.AddGroupRole(Convert.ToInt32(ddlRole.SelectedValue), txtRole.Text.Trim());
                lblInfo.Text = "Role is Successfully Added";
                txtRole.Text = string.Empty;
                int groupId = Conversion.ParseInt(ddlRole.SelectedItem.Value);

                loadRolesbyGroupId("1", groupId);
            }
            else
            {
                lblInfo.Text          = string.Empty;
                lblRoleNameError.Text = "Role Name Already Exist";
            }
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "AddRole.aspx. btnSave_Click", ex);
        }
        ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
    }