public static void setLoginSession(HttpSessionStateBase Session, UserAccountsModel model, bool?ConnectToLiveDatabase) { if (model != null) { Session[SESSION_UserAccount] = model; Session[SESSION_ActiveBranches_Id] = model.Branches_Id; Session[SESSION_Branches_Models] = BranchesController.get(1, model.Branches); Session[SESSION_UserAccountAccess] = UserAccountRolesController.getAccesses(model); if (ConnectToLiveDatabase != null) { Session[SESSION_ConnectToLiveDatabase] = ConnectToLiveDatabase; } Session[SESSION_ShowOnlyUserData] = true; string ShowOnlyOwnUserData = SettingsController.get().ShowOnlyOwnUserData; string Roles = model.Roles; foreach (string role in Roles.Split(',')) { if (!ShowOnlyOwnUserData.Contains(role)) { Session[SESSION_ShowOnlyUserData] = false; break; } } } }
private void setViewBag(SettingsModel model) { ViewBag.ResetPassword = model.ResetPassword; ViewBag.PettyCashRecordsCategories = new SelectList(db.PettyCashRecordsCategories.OrderBy(x => x.Name).ToList(), PettyCashRecordsCategoriesModel.COL_Id.Name, UserAccountRolesModel.COL_Name.Name); UserAccountRolesController.setDropDownListViewBag(this); LessonPackagesController.setDropDownListViewBag(this); }
/* FILTER *********************************************************************************************************************************************/ public void setViewBag(string FILTER_Keyword, int?FILTER_Active, Guid?FILTER_Languages_Id) { ViewBag.FILTER_Keyword = FILTER_Keyword; ViewBag.FILTER_Active = FILTER_Active; ViewBag.FILTER_Languages_Id = FILTER_Languages_Id; UserAccountRolesController.setDropDownListViewBag(this, getUserAccess(Session).UserAccounts_EditRoles); BranchesController.setDropDownListViewBag(this); LanguagesController.setDropDownListViewBag(this); PromotionEventsController.setDropDownListViewBag(this); }
/* BIRTHDAYS ******************************************************************************************************************************************/ public PartialViewResult BirthdaysPartial(int?rss) { ViewBag.RemoveDatatablesStateSave = rss; List <UserAccountsModel> models = getBirthdays(Helper.getActiveBranchId(Session), null, Helper.getCurrentDateTime().Month); ViewBag.BirthdayCount = models.Count; UserAccountRolesController.setDropDownListViewBag(this); return(PartialView("BirthdaysPartial")); }