public static void AssignRoleToUser(ENTUserAccountEO user, ENTRoleEO role) { role.RoleUserAccounts.Add(new ENTRoleUserAccountEO { ENTUserAccountId = user.ID, ENTRoleId = role.ID }); //user.Roles.Add(role); }
/// <summary> /// Bind Roles list without assigned user roles /// </summary> /// <param name="userID"></param> private void BindRolesList(ENTUserAccountEO user) { var unassignedUserRoles = DBMethods.RolesList; var userRoles = user.Roles; unassignedUserRoles.RemoveAll(role => userRoles.Exists(userRole => userRole.RoleName == role.RoleName)); lstRoles.DataSource = unassignedUserRoles; lstRoles.Update(); }
void lbtnDelete_Command(object sender, CommandEventArgs e) { var validationErrors = new ENTValidationErrors(); var user = new ENTUserAccountEO(Convert.ToInt32(e.CommandArgument)); user.DBAction = ENTBaseEO.DBActionEnum.Delete; //user.ID = Convert.ToInt32(e.CommandArgument); user.Delete(ref validationErrors, CurrentUser.ID); Master.ValidationErrors = validationErrors; cgvUsers.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { ENTUserAccountEO currentUser = ((BasePage)Page).CurrentUser; //Set the top menu properties MenuTabs1.MenuItems = Globals.GetMenuItems(this.Cache); MenuTabs1.RootPath = BasePage.RootPath(Context); MenuTabs1.CurrentMenuItemName = ((BasePage)Page).MenuItemName(); MenuTabs1.Roles = Globals.GetRoles(this.Cache); MenuTabs1.UserAccount = currentUser; //Set the side menu properties MenuTree1.MenuItems = Globals.GetMenuItems(this.Cache); MenuTree1.RootPath = BasePage.RootPath(Context); MenuTree1.CurrentMenuItemName = ((BasePage)Page).MenuItemName(); MenuTree1.Roles = Globals.GetRoles(this.Cache); MenuTree1.UserAccount = currentUser; lblCurrentUser.Text = Page.User.Identity.Name; lblCurrentDateTime.Text = DateTime.Now.ToString(CultureInfo.InvariantCulture); //Set the version lblVersion.Text = ConfigurationManager.AppSettings["version"]; }
private void BindUserRolesList(ENTUserAccountEO user) { lstUserRoles.DataSource = user.Roles;//DBMethods.GetUserRolesList(userId); lstUserRoles.Update(); }
public static void UnassignUserFromRole(ENTUserAccountEO user, ENTRoleEO role) { role.RoleUserAccounts.Remove(new ENTRoleUserAccountEO { ENTUserAccountId = user.ID, ENTRoleId = role.ID }); }