protected void BindData() { try { //Initialize the values for the IN ROLE list box if (RoleDropDownList.Text == Resources.SecurityData.NoneRoleItem || string.IsNullOrEmpty(RoleDropDownList.Text)) { InRoleListBox.DataSource = theUsersAndRolesBLL.UsersInNoneRole(); } else { if (Roles.GetUsersInRole(RoleDropDownList.Text) == null) { InRoleListBox.DataSource = ""; } else { InRoleListBox.DataSource = Roles.GetUsersInRole(RoleDropDownList.Text); } } InRoleListBox.DataBind(); //Initialize the values for the NOT IN ROLE list box if (RoleDropDownList.Text == Resources.SecurityData.NoneRoleItem || string.IsNullOrEmpty(RoleDropDownList.Text)) { OutRoleListBox.DataSource = theUsersAndRolesBLL.UsersNotInRoleNone(); AddOutImageButton.Enabled = false; DeleteRolImageButton.Visible = false; } else { if (theUsersAndRolesBLL.GetUsersNotInRol(RoleDropDownList.Text) == null) { OutRoleListBox.DataSource = ""; } else { OutRoleListBox.DataSource = theUsersAndRolesBLL.GetUsersNotInRol(RoleDropDownList.Text); } AddOutImageButton.Enabled = true; DeleteRolImageButton.Visible = false; } OutRoleListBox.DataBind(); } catch (Exception q) { log.Error("Error en BindData de la pagina AssignRoles.aspx.", q); SystemMessages.DisplaySystemErrorMessage(Resources.SecurityData.MessageErrorGetUsersByRole + RoleDropDownList.Text); } EmployeeRolePanel.Visible = false; }
protected void OutRoleListBox_SelectedIndexChanged(object sender, EventArgs e) { try { InRoleListBox.ClearSelection(); if (VerifyIfIsOnlyOneUserSelected(OutRoleListBox)) { MembershipUser theUser; EmployeeRolePanel.Visible = true; gRolesForUser = Roles.GetRolesForUser(OutRoleListBox.SelectedValue); FillCheckBoxesForRoles(gRolesForUser); theUser = Membership.GetUser(OutRoleListBox.SelectedValue.ToString()); UserLabel.Text = theUser.UserName.ToString(); UserEmailLabel.Text = theUser.Email.ToString(); if (theUser.UserName.Equals(HttpContext.Current.User.Identity.Name)) { foreach (ListItem item in UserRoleCheckBoxList.Items) { item.Enabled = false; } SaveRolesButton.Visible = false; ResetRolesButton.Visible = false; AddInImageButton.Enabled = false; AddOutImageButton.Enabled = false; } else { SaveRolesButton.Visible = true; ResetRolesButton.Visible = (!LoginSecurity.IsUserAuthorizedPermission("RESET_USER_ACCOUNT")); AddInImageButton.Enabled = true; AddOutImageButton.Enabled = true; } } else { EmployeeRolePanel.Visible = false; } } catch (Exception q) { log.Error("Function OutRoleListBox_SelectedIndexChanged from AssigRole page", q); SystemMessages.DisplaySystemMessage(Resources.SecurityData.MessageErrorGetRoles); } }