Example #1
0
        void LoadReport(DashboardReportViewItem dashboardReportViewItem)
        {
            var model          = dashboardReportViewItem.Model;
            var reportDataType = ReportsModule.FindReportsModule(dashboardReportViewItem.Application.Modules).ReportDataType;
            var reportData     = (IReportData)dashboardReportViewItem.View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("ReportName=?", model.ReportName));

            if (reportData == null)
            {
                throw new NullReferenceException($"Report {model.ReportName} not found");
            }
            dashboardReportViewItem.Report     = reportData.LoadReport(dashboardReportViewItem.View.ObjectSpace);
            dashboardReportViewItem.ReportData = reportData;
        }
        protected override void OnBeforeCreateDocument(DashboardInteractionController interactionController, DashboardReportViewItem dashboardReportViewItem, ListViewFilteringArgs listViewFilteringArgs)
        {
            base.OnBeforeCreateDocument(interactionController, dashboardReportViewItem, listViewFilteringArgs);
            var reportDataTypeMember = ((IModelDashboardViewFilterReport)((IModelDashboardViewItemEx)dashboardReportViewItem.Model).Filter).ReportDataTypeMember;
            var report       = (XafReport)dashboardReportViewItem.Report;
            var propertyName = PropertyName(report, reportDataTypeMember);
            var criteria     = new InOperator(propertyName, interactionController.Getkeys(listViewFilteringArgs.DataSourceListView));

            report.SetFilteringObject(new LocalizedCriteriaWrapper(report.DataType, criteria));
        }