void LoadReport(DashboardReportViewItem dashboardReportViewItem)
        {
            var reportsModuleV2 = ReportsModuleV2.FindReportsModule(Application.Modules);
            var reportDataType  = reportsModuleV2.ReportDataType;
            var reportData      = (IReportDataV2)View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("DisplayName=?", dashboardReportViewItem.Model.ReportName));

            if (reportData == null)
            {
                throw new NullReferenceException($"Report {dashboardReportViewItem.Model.ReportName} not found");
            }
            var report = ReportDataProvider.ReportsStorage.LoadReport(reportData);

            reportsModuleV2.ReportsDataSourceHelper.SetupBeforePrint(report, null, CriteriaOperator.Parse(report.FilterString), true, new SortProperty[0], true);
            dashboardReportViewItem.Report     = report;
            dashboardReportViewItem.ReportData = reportData;
        }
예제 #2
0
        protected override void OnBeforeCreateDocument(DashboardInteractionController interactionController, DashboardReportViewItem dashboardReportViewItem, ListViewFilteringArgs listViewFilteringArgs)
        {
            base.OnBeforeCreateDocument(interactionController, dashboardReportViewItem, listViewFilteringArgs);
            var objectTypeInfo       = Application.TypesInfo.FindTypeInfo(((IReportDataV2)dashboardReportViewItem.ReportData).DataType);
            var reportDataTypeMember = GetReportDataTypeMember(((IModelDashboardViewItemEx)dashboardReportViewItem.Model), objectTypeInfo);
            var report   = dashboardReportViewItem.Report;
            var criteria = new InOperator(reportDataTypeMember, interactionController.Getkeys(listViewFilteringArgs.DataSourceListView));

            report.FilterString = new LocalizedCriteriaWrapper(objectTypeInfo.Type, criteria).CriteriaOperator.ToString();
            report.CreateDocument(false);
        }