// Indexer declaration. // If index is out of range, the array will throw the exception. public object this[Enum filterID] { get { object filterData = HttpContext.Current.Session[prefix + filterID.ToString()]; try { if (filterData == null || filterData == empty) { switch (_Enums.ParseEnum<list>(filterID)) { case list.Dashboard: filterData = new DashboardService().emptyView; break; case list.ActivityLog: filterData = new ActivityLogService(ActivityLogService.Activity.Login).emptyView; break; case list.User: filterData = new UserService().emptyView; break; } } return filterData; } catch { return null; } } set { HttpContext.Current.Session[prefix + filterID.ToString()] = value; } }
public ActionResult Excel() { //HttpContext context = ControllerContext.HttpContext.CurrentHandler; //Essense of : http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx this.Response.Clear(); this.Response.AddHeader("content-disposition", "attachment;filename=" + "Dashboard_" + _SessionUsr.ID + ".xls"); this.Response.Charset = ""; this.Response.Cache.SetCacheability(HttpCacheability.NoCache); this.Response.ContentType = "application/vnd.ms-excel"; //DON'T do the following //this.Response.Write(content); //this.Response.End(); populateData(false); var result = new DashboardService().Search(sortExpr, 1, gridPageSize, (vw_Claim_Dashboard)searchOpts, true, _Session.IsOnlyCustomer); searchOpts = new vw_Claim_Dashboard(); populateData(false); return View("Excel", result); }
public ActionResult ExcelPDF() { populateData(false); List<vw_Claim_Dashboard> printView = new DashboardService().Search(sortExpr, 1, gridPageSize, (vw_Claim_Dashboard)searchOpts, true, _Session.IsOnlyCustomer); string GUID = _SessionUsr.ID.ToString(); return new ReportManagement.StandardPdfRenderer().BinaryPdfData(this, "Dashboard" + GUID, "Excel", printView); }
public ActionResult ClaimWithDetails() { /*if (_Session.IsInternal && _SessionUsr.RoleID == (int)SecurityService.Roles.Admin) { ViewData["Message"] = "You do not have access to Claim with details report."; return RedirectToAction("NoAccess", "Common"); }*/ //HttpContext context = ControllerContext.HttpContext.CurrentHandler; //Essense of : http://stephenwalther.com/blog/archive/2008/06/16/asp-net-mvc-tip-2-create-a-custom-action-result-that-returns-microsoft-excel-documents.aspx this.Response.Clear(); this.Response.AddHeader("content-disposition", "attachment;filename=" + "ClaimWithDetails.xls"); this.Response.Charset = ""; this.Response.Cache.SetCacheability(HttpCacheability.NoCache); this.Response.ContentType = "application/vnd.ms-excel"; //DON'T do the following //this.Response.Write(content); //this.Response.End(); var result = new DashboardService().ClaimWithDetails(); return View("ClaimWithDetails", result); }