private ReportActivityLogPageState GetReportActivityLogPageState() { try { ReportActivityLogPageState pagestate = new ReportActivityLogPageState(); // Initialize the session values if they don't exist - need to do this the first time controller is hit if (Session["ReportActivityLogPageState"] == null) { int accountid = 0; if (Session["UserAccountID"] != null) accountid = Convert.ToInt32(Session["UserAccountID"]); pagestate.AccountID = accountid; pagestate.Username = String.Empty; pagestate.EntityType = String.Empty; pagestate.EntityAction = String.Empty; pagestate.StartDate = DateTime.Today.AddDays(-30).ToShortDateString(); pagestate.EndDate = DateTime.Today.ToShortDateString(); pagestate.SortBy = "ActivityDateTime"; pagestate.AscDesc = "Desc"; pagestate.PageNumber = 1; Session["ReportActivityLogPageState"] = pagestate; } else { pagestate = (ReportActivityLogPageState)Session["ReportActivityLogPageState"]; } return pagestate; } catch { return new ReportActivityLogPageState(); } }
private void SavePageState(ReportActivityLogPageState pagestate) { Session["ReportActivityLogPageState"] = pagestate; }