private void SavePageState(ReportSurveyResultsPageState pagestate) { Session["ReportSurveyResultsPageState"] = pagestate; }
private ReportSurveyResultsPageState GetReportSurveyResultsPageState() { try { ReportSurveyResultsPageState pagestate = new ReportSurveyResultsPageState(); // Initialize the session values if they don't exist - need to do this the first time controller is hit if (Session["ReportSurveyResultsPageState"] == null) { int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); pagestate.AccountID = accountid; pagestate.SurveyID = 0; pagestate.StartDate = DateTime.Today.AddDays(-30).ToShortDateString(); pagestate.EndDate = DateTime.Today.ToShortDateString(); Session["ReportSurveyResultsPageState"] = pagestate; } else { pagestate = (ReportSurveyResultsPageState)Session["ReportSurveyResultsPageState"]; } return pagestate; } catch { return new ReportSurveyResultsPageState(); } }