public ReportsTabController(IReportQueryService reportQueryService, ISummaryQueryService summaryQueryService ) { _reportQueryService = reportQueryService; _summaryQueryService = summaryQueryService; }
public ReportService( IReportQueryService reportQueryService, ISummaryQueryService summaryQueryService, ITemplateQueryService templateQueryService, IIncidentSummaryBuilder incidentSummaryBuilder, IArrestSummaryReportBuilder arrestSummaryReportBuilder, IFieldInterViewSummaryBuilder fieldInterViewSummaryBuilder, ICallForServiceSummaryReportBuilder callforserviceSummaryBuilder, IOtherEventSummaryBuilder otherEventSummaryBuilder, IIncidentBuilder incidentReportBuilder, IArrestReportBuilder arrestReportBuilder, IFieldInterviewBuilder fieldInterviewReportBuilder, ICallForServiceReportBuilder callforserviceReportBuilder, IOtherEventBuilder otherEventBuilder, IReportsData reportDetails, ICitationReportBuilder citationReportBuilder, ICitationSummaryReportBuilder citationSummaryReportBuilder ) { _reportQueryService = reportQueryService; _summaryQueryService = summaryQueryService; _templateQueryService = templateQueryService; _incidentSummaryBuilder = incidentSummaryBuilder; _arrestSummaryReportBuilder = arrestSummaryReportBuilder; _fieldInterViewSummaryBuilder = fieldInterViewSummaryBuilder; _callforserviceSummaryBuilder = callforserviceSummaryBuilder; _otherEventSummaryBuilder = otherEventSummaryBuilder; _incidentReportBuilder = incidentReportBuilder; _arrestReportBuilder = arrestReportBuilder; _fieldInterviewReportBuilder = fieldInterviewReportBuilder; _callforserviceReportBuilder = callforserviceReportBuilder; _otherEventBuilder = otherEventBuilder; _citationReportBuilder = citationReportBuilder; _citationSummaryReportBuilder = citationSummaryReportBuilder; _reportDetails = reportDetails; }
private void RenderReportViewer(Guid id, RelatedToType relatedType, ModuleType moduleType) { _log.Debug("Rendering [{0}] [{1}] Viewer...", relatedType.GetDescription(), moduleType.GetDescription()); try { var isDraft = false; var reportNumber = string.Empty; var templateQueryService = DependencyContainer.Resolve <ITemplateQueryService>(); Guid agencyId, templateId; if (relatedType != RelatedToType.Summary) { using (var iocService = DependencyContainer.Resolve <IReportQueryService>()) { //get workflow status detail _reportQueryService = iocService.Instance; var reportsInfo = _reportQueryService.GetReportInfo(id); isDraft = reportsInfo.State != ReportState.Complete; agencyId = reportsInfo.Agency.AgencyId; templateId = reportsInfo.TemplateId; if (!reportsInfo.WorkflowRights.CanView && !UserHasAccessRights(reportsInfo.Agency.AgencyId, moduleType)) { ReportViewer1.Visible = false; AccessDisabled.Visible = true; Response.Redirect("~/#/error"); return; } reportNumber = reportsInfo.Number; } } else { //get reportnumber for selected summary record using (var iocSummaryService = DependencyContainer.Resolve <ISummaryQueryService>()) { //get workflow status detail _summaryQueryService = iocSummaryService.Instance; var summaryInfo = _summaryQueryService.GetSummaryInfo(id); agencyId = summaryInfo.Agency.AgencyId; templateId = templateQueryService.Instance.GetDefaultTemplate(summaryInfo.Agency.AgencyId, moduleType).Id; if (!UserHasAccessRights(summaryInfo.Agency.AgencyId, moduleType)) { ReportViewer1.Visible = false; AccessDisabled.Visible = true; Response.Redirect("~/#/error"); return; } reportNumber = summaryInfo.Number; } } AccessDisabled.Visible = false; var reportServerUri = String.Format("http://{0}/ReportServer", ConfigurationManager.AppSettings["ReportServer"]); var reportPath = String.Format("/{0}", ConfigurationManager.AppSettings["ReportRootPath"]); ReportViewer1.ServerReport.ReportPath = reportPath; ReportViewer1.ServerReport.ReportServerUrl = new Uri(reportServerUri); ReportViewer1.ShowParameterPrompts = false; ReportViewer1.ShowFindControls = false; ReportViewer1.ShowExportControls = true; ReportViewer1.ShowToolBar = true; int validity; var result = Int32.TryParse(ConfigurationManager.AppSettings["SSRSTokenTimeout"], out validity); if (!result) { validity = 5; } var headerText = templateQueryService.Instance.GetTemplateHeaderText(moduleType, reportNumber, agencyId, templateId); var svcQuery = String.Format("{0}", ConfigurationManager.AppSettings["SSRSServiceHost"]) + "api/ssrsreports/getreportsdata/" + id.ToString() + "/" + moduleType.ToString() + "/" + relatedType.ToString() + "?wsSignInKey=" + new JwtTokenGenerator(TokenManagerFactory.GetTokenManager()).GenerateJwtToken(System.Web.HttpContext.Current.User.Identity as ClaimsIdentity, validity); var reportParameters = new List <ReportParameter> { new ReportParameter("svcQuery", svcQuery), new ReportParameter("isDraft", isDraft.ToString()), new ReportParameter("imageDataSource", ConfigurationManager.ConnectionStrings["InformRMSMediaSSRS"].ConnectionString), new ReportParameter("headerText", headerText) }; _log.Debug("SSRS URI: {0}", reportServerUri); reportParameters.ForEach(p => { foreach (var value in p.Values) { _log.Debug("SSRS Parameter {0} = {1}", p.Name, value); } }); ReportViewer1.ServerReport.SetParameters(reportParameters); ReportViewer1.ServerReport.Refresh(); } catch (Exception ex) { _log.Error("Failure to render SSRS Report {0}", ex); } }