public ActionResult ExportReport() { var report = StiMvcViewer.GetReportObject(); var parameters = StiMvcViewer.GetRequestParams(); if (parameters.ExportFormat == StiExportFormat.Pdf) { // Some actions with report when exporting to PDF } return(StiMvcViewer.ExportReportResult(report)); }
public ActionResult InitViewer() { var requestParams = StiMvcViewer.GetRequestParams(); var options = new StiAngularViewerOptions(); options.Actions.GetReport = "GetReport"; options.Actions.ViewerEvent = "ViewerEvent"; options.Appearance.ScrollbarsMode = true; options.Toolbar.ShowDesignButton = true; return(StiAngularViewer.ViewerDataResult(requestParams, options)); }
public async Task <ActionResult> GetReport() { try { var rp = StiMvcViewer.GetRequestParams(); var Rep = rp.HttpContext.Request.Params["Rep"]; var Base = rp.HttpContext.Request.Params["Base"]; var id = rp.Routes["Id"]; var url = $"/_report/{Base}/{Rep}/{id}"; //TODO: profile var token = Profiler.BeginReport("create"); ReportInfo ri = await GetReportInfo(url, id); //TODO: image settings var rm = rm.ImageInfo; if (ri == null) { throw new InvalidProgramException("invalid data"); } var path = ri.ReportPath; var r = StiReportExtensions.CreateReport(path, ri.Name); if (ri.DataModel != null) { var dynModel = ri.DataModel.GetDynamic(); foreach (var x in dynModel) { r.RegBusinessObject(x.Key, x.Value); } } var vars = ri.Variables; if (vars != null) { r.AddVariables(vars); } return(StiMvcViewer.GetReportResult(r)); } catch (Exception ex) { String msg = ex.Message; Int32 x = msg.IndexOf(": error"); if (x != -1) { msg = msg.Substring(x + 7).Trim(); } return(new HttpStatusCodeResult(500, msg)); } }
public async Task <ActionResult> GetReport() { try { var rp = StiMvcViewer.GetRequestParams(); var Rep = rp.HttpContext.Request.Params["Rep"]; var Base = rp.HttpContext.Request.Params["Base"]; var id = rp.Routes["Id"]; var url = $"/_report/{Base.RemoveHeadSlash()}/{Rep}/{id}"; //TODO: profile var token = Profiler.BeginReport("create"); var prms = new ExpandoObject(); prms.Append(_baseController.CheckPeriod(rp.HttpContext.Request.QueryString), toPascalCase: true); prms.RemoveKeys("Rep,rep,Base,base,Format,format"); ReportInfo ri = await GetReportInfo(url, id, prms); //TODO: image settings var rm = rm.ImageInfo; if (ri == null) { throw new InvalidProgramException("invalid data"); } var path = ri.ReportPath; using (var stream = _baseController.Host.ApplicationReader.FileStreamFullPathRO(path)) { var r = StiReportExtensions.CreateReport(stream, ri.Name); r.AddDataModel(ri.DataModel); var vars = ri.Variables; if (vars != null) { r.AddVariables(vars); } return(StiMvcViewer.GetReportResult(r)); } } catch (Exception ex) { String msg = ex.Message; Int32 x = msg.IndexOf(": error"); if (x != -1) { msg = msg.Substring(x + 7).Trim(); } return(new HttpStatusCodeResult(500, msg)); } }
public IStimulsoftRequestParams GetViewerRequestParams() { var rp = StiMvcViewer.GetRequestParams(); return(new StimulsoftRequestParams(rp)); }