public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) { base.OnPageHandlerExecuting(context); if (User.Identity.IsAuthenticated) { Data.Initialize(User, TempData); if (IsOrgRequired(context) && !CurrentUser.OrganizationId.HasValue) { context.Result = new RedirectResult("/Setup/Organization?mustCreate=true"); return; } using (var cn = Data.GetConnection()) { SwitchOrgs = new MySwitchOrgs() { CurrentOrgId = OrgId, UserId = UserId }.Execute(cn); AssignToUsers = new UserSelect() { OrgId = OrgId, IsEnabled = true }.ExecuteItems(cn); var teams = new Teams() { OrgId = OrgId }.Execute(cn); TeamUseApps = JsonConvert.SerializeObject(teams.ToDictionary(row => row.Id, row => row.UseApplications)); var options = new MyOptions() { UserId = UserId }.Execute(cn); Options = options.ToDictionary(row => row.OptionName); HasNotifications = cn.RowExists("[dbo].[Notification] WHERE [SendTo]=@userName AND [Method]=3 AND [DateDelivered] IS NULL", new { userName = User.Identity.Name }); } } }
public override void OnPageHandlerExecuting(PageHandlerExecutingContext context) { base.OnPageHandlerExecuting(context); if (User.Identity.IsAuthenticated) { Data.Initialize(User, TempData); if (IsOrgRequired(context) && !CurrentUser.OrganizationId.HasValue) { context.Result = new RedirectResult("/Setup/Organization?mustCreate=true"); return; } using (var cn = Data.GetConnection()) { SwitchOrgs = new MySwitchOrgs() { CurrentOrgId = OrgId, UserId = UserId }.Execute(cn); } } }