示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <param name="dataTable"></param>
        /// <param name="reportParameters"></param>
        /// <returns></returns>

        public static IReportCreator CreatePageBuilder(IReportModel reportModel,
                                                       DataTable dataTable,
                                                       ReportParameters reportParameters)
        {
            Console.WriteLine("ReportEngine:CreatePageBuilder_3");
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            ReportEngine.CheckForParameters(reportModel, reportParameters);
            IDataManager dataMan = DataManager.CreateInstance(dataTable, reportModel.ReportSettings);

            if (dataMan != null)
            {
                return(DataPageBuilder.CreateInstance(reportModel, dataMan));
            }
            else
            {
                throw new MissingDataManagerException();
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportModel"></param>
        /// <param name="list"></param>
        /// <param name="reportParameters"></param>
        /// <returns></returns>
        public static IReportCreator CreatePageBuilder(IReportModel reportModel,
                                                       IList list,
                                                       ReportParameters reportParameters)
        {
            if (reportModel == null)
            {
                throw new ArgumentNullException("reportModel");
            }
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }
            ReportEngine.CheckForParameters(reportModel, reportParameters);
            IDataManager dataMan = DataManager.CreateInstance(list, reportModel.ReportSettings);

            if (dataMan != null)
            {
                Layouter layouter = new Layouter();
                return(DataPageBuilder.CreateInstance(reportModel, dataMan, layouter));
            }
            else
            {
                throw new MissingDataManagerException();
            }
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="dataTable"></param>
        /// <param name="reportModel"></param>
        public void PrintPushDataReport(string fileName, DataTable dataTable,
                                        ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }
            if (dataTable == null)
            {
                throw new ArgumentNullException("dataTable");
            }
            AbstractRenderer renderer = null;

            try {
                IReportModel model = ReportEngine.ValidatePushModel(fileName);
                CheckForParameters(model, reportParameters);
                renderer = SetupPushDataRenderer(model, dataTable);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }
示例#4
0
        /// <summary>
        /// send a Standart (PullModel/FormSheet) Report to printer
        /// </summary>
        /// <param name="fileName">Path to ReportFile</param>
        /// <param name="renderTo">Type of renderer currently only "ToText" is implemented</param>
//		[Obsolete("use PrintStandardReport (fileName,null)")]
//		public void PrintStandardReport (string fileName) {
//			if (String.IsNullOrEmpty(fileName)) {
//				throw new ArgumentNullException("fileName");
//			}
//			PrintStandardReport (fileName,null);
//
//		}
//

        public void PrintStandardReport(string fileName, ReportParameters reportParameters)
        {
            if (String.IsNullOrEmpty(fileName))
            {
                throw new ArgumentNullException("fileName");
            }

            AbstractRenderer renderer = null;

            try {
                IReportModel model = LoadReportModel(fileName);
//				if (this.connectionObject == null) {
//					this.connectionObject = ReportEngine.PrepareConnectionFromParameters (model.ReportSettings,reportParameters);
//				}
//
                ReportEngine.CheckForParameters(model, reportParameters);
                renderer = SetupStandardRenderer(model, reportParameters);
                ReportEngine.ReportToPrinter(renderer, model);
            } catch (Exception) {
                throw;
            }
        }
示例#5
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        // instance reporting engine
        // assign parameters
        ReportEngine engine = new ReportEngine();
        string reportPath = Server.MapPath("SalesByYear.srd");
		PageBuilder pageBuilder = engine.CreatePageBuilder(reportPath);
		pageBuilder.BuildExportList();
        string outputPath = Server.MapPath("SalesByYear.Pdf");

        // render report
		PdfRenderer pdfRenderer =
			PdfRenderer.CreateInstance(pageBuilder.Pages, outputPath, false);
		pdfRenderer.Start();
		pdfRenderer.RenderOutput();
		pdfRenderer.End();

        // send report to the client
		Response.ContentType = "Application/pdf";
		Response.WriteFile(outputPath);
		Response.End();
    }