protected override void OnInitializeControls(EventArgs e) { SessionStateData = Session[FLOW_PAGE_SESSION_STATE_KEY] as SessionStateDataStorage; if (SessionStateData == null) { SessionStateData = new SessionStateDataStorage(); Session[FLOW_PAGE_SESSION_STATE_KEY] = SessionStateData; SessionStateData.HiddenFlows = UserSettingsManager.LoadAdminFlowPageHiddenFlowIds(GetCurrentUsername()); if (SessionStateData.HiddenFlows == null) { SessionStateData.HiddenFlows = new CaseInsensitiveList(); } } base.OnInitializeControls(e); addExchangeBtn.Visible = UserIsAdmin(); if (!IsPostBack) { introParagraphs.DataSource = IntroParagraphs; introParagraphs.DataBind(); BindFlows(); } }
public static bool SetScheduleExpanded(string flowId, bool isExpanded, string currentUsername, HttpSessionState sessionState, IUserSettingsManager userSettingsManager) { SessionStateDataStorage sessionStateData = ValidateSessionStateData(currentUsername, sessionState, userSettingsManager); if (!isExpanded) { if (!sessionStateData.HiddenSchedules.Contains(flowId)) { sessionStateData.HiddenSchedules.Add(flowId); } } else { sessionStateData.HiddenSchedules.Remove(flowId); } userSettingsManager.SaveAdminSchedulePageHiddenScheduleIds(currentUsername, sessionStateData.HiddenSchedules); return(isExpanded); }
protected static SessionStateDataStorage ValidateSessionStateData(string currentUsername, HttpSessionState sessionState, IUserSettingsManager userSettingsManager) { ExceptionUtils.ThrowIfEmptyString(currentUsername); ExceptionUtils.ThrowIfNull(sessionState); ExceptionUtils.ThrowIfNull(userSettingsManager); SessionStateDataStorage sessionStateData = sessionState[SCHEDULE_PAGE_SESSION_STATE_KEY] as SessionStateDataStorage; if (sessionStateData == null) { sessionStateData = new SessionStateDataStorage(); sessionState[SCHEDULE_PAGE_SESSION_STATE_KEY] = sessionStateData; sessionStateData.HiddenSchedules = userSettingsManager.LoadAdminSchedulePageHiddenScheduleIds(currentUsername); if (sessionStateData.HiddenSchedules == null) { sessionStateData.HiddenSchedules = new CaseInsensitiveList(); } } return(sessionStateData); }