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