예제 #1
0
        private Report GetReportFromFileOrMemory(ReportInfo reportInfo)
        {
            RDLParser rdlp;
            Report    r;
            string    source;

            if (reportInfo.Source == null)
            {
                source = System.IO.File.ReadAllText(reportInfo.GetPath());
            }
            else
            {
                source = reportInfo.Source;
            }

            rdlp = new RDLParser(source)
            {
                Folder = System.IO.Path.GetDirectoryName(reportInfo.GetPath()),
                OverwriteConnectionString = reportInfo.ConnectionString,
                OverwriteInSubreport      = true
            };

            r = rdlp.Parse();

            return(r);
        }
예제 #2
0
        public void PrepareReport()
        {
            RDLParser rdlp;
            var       reportPath = ReportInfo.GetPath();
            string    source     = ReportInfo.Source ?? System.IO.File.ReadAllText(reportPath);

            rdlp = new RDLParser(source);
            if (reportPath != null)
            {
                rdlp.Folder = System.IO.Path.GetDirectoryName(reportPath);
            }
            rdlp.OverwriteConnectionString = ReportInfo.ConnectionString;
            rdlp.OverwriteInSubreport      = true;

            Report = rdlp.Parse();

            Report.RunGetData(ReportInfo.Parameters);
            Pages = Report.BuildPages();
        }
예제 #3
0
        public void Print(ReportInfo reportInfo)
        {
            var reportPath = reportInfo.GetPath();
            var source     = reportInfo.Source ?? File.ReadAllText(reportPath);

            var rdlParser = new RDLParser(source)
            {
                Folder = Path.GetDirectoryName(reportPath),
                OverwriteConnectionString = reportInfo.ConnectionString,
                OverwriteInSubreport      = true
            };

            var report = rdlParser.Parse();

            report.RunGetData(reportInfo.Parameters);
            var pages = report.BuildPages();

            switch (reportInfo.PrintType)
            {
            case ReportInfo.PrintingType.Default:
                var orientation = report.PageHeightPoints > report.PageWidthPoints
                                                ? PageOrientation.Portrait
                                                : PageOrientation.Landscape;
                var defaultPrintOperation = new DefaultPrintOperation();
                defaultPrintOperation.Run(pages, orientation);
                break;

            case ReportInfo.PrintingType.MultiplePrinters:
                var multiplePrintOperation = new MultiplePrintOperation(_unitOfWorkFactory, _commonServices, _userPrintingRepository);
                multiplePrintOperation.Run(pages);
                break;

            default:
                throw new NotSupportedException($"{reportInfo.PrintType} is not supported");
            }
        }