Exemple #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 object CreateControlCore()
        {
            PrintControl = new PrintControl {
                Dock = DockStyle.Fill
            };
            PrintControl.ParentChanged += OnControlParentChanged;
            Type reportDataType = ReportsModule.FindReportsModule(_application.Modules).ReportDataType;
            var  reportData     = (IReportData)View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("ReportName=?", Model.ReportName));

            if (reportData == null)
            {
                throw new NullReferenceException(string.Format("Report {0} not found", Model.ReportName));
            }
            _report = (XafReport)reportData.LoadReport(View.ObjectSpace);
            View.ControlsCreated       += ViewOnControlsCreated;
            PrintControl.PrintingSystem = Report.PrintingSystem;
            return(PrintControl);
        }