private List <Feature> GetMenuBag() { var roleSession = this.HttpContext.Session[Constants.CON_ROLE]; if (roleSession == null) { var role = this.GetCurrentRole(); if (role != null) { roleSession = role.RoleId; } } if (roleSession != null) { var roleId = Guid.Parse(roleSession.ToString()); List <Feature> features = this.HttpContext.Session[roleId.ToString()] as List <Feature>; if (features == null) { AuthorizationDataUtils authData = this.DatabaseFactory.AuthUtils; var appUser = this.DatabaseFactory.UserProfileUtils.AppUser; if (appUser != null) { features = authData.GetMenu(appUser.UserId, roleId).OrderBy(e => e.ORDERING).ToList(); this.Session[roleId.ToString()] = features; } } return(features); } return(null); }
/// <summary> /// Gets the feature bag. /// </summary> /// <returns></returns> public List <Feature> GetFeatureBag() { List <Feature> features = this.HttpContext.Application["Features"] as List <Feature>; if (features == null) { AuthorizationDataUtils authData = this.DatabaseFactory.AuthUtils; string userName = ExpenseTracker.Utilities.Web.GetUserName(this.HttpContext); features = authData.GetAllRootFeatures(userName).OrderBy(e => e.ORDERING).ToList(); this.SetToApplication(features); } return(features); }