private static void CheckConfig(IEpsReportConfig config, IEpsConfiguration epsConfiguration) { if (string.IsNullOrEmpty(config.ReportName)) { throw new Exception("ReportName for is not set."); } if (string.IsNullOrEmpty(config.ReportFullFileName)) { throw new Exception($"ReportFileName for report {config.ReportName} is not set."); } if (!File.Exists(config.ReportFullFileName)) { throw new FileNotFoundException(config.ReportFullFileName); } if (string.IsNullOrEmpty(config.ConnectionString)) { throw new Exception($"ConnectionString for report {config.ReportName} is not set."); } if (string.IsNullOrEmpty(epsConfiguration.TmpPath)) { throw new Exception("Ошибка конфигурации EPS. Не задан путь хренения временных файлов TMP."); } }
public override IEpsReport CreateReport(IEpsReportConfig config) { var res = new EpsTestReport(config, _configuration, _reportExporterFactory); Reports.Add(res); return(res); }
/* * public EpsFastReport(string reportName, string reportFileName, string connectionString, string tempFolder) * { * if (string.IsNullOrEmpty(reportName)) * throw new ArgumentNullException("reportName"); * * if (string.IsNullOrEmpty(reportFileName)) * throw new ArgumentNullException("reportFileName"); * * if (!(File.Exists(reportFileName))) * throw new FileNotFoundException(reportFileName); * * if (string.IsNullOrEmpty(tempFolder)) * throw new ArgumentNullException("tempFolder"); * * if (!Directory.Exists(tempFolder)) * Directory.CreateDirectory(tempFolder); * FastReport.Utils.Config.TempFolder = tempFolder; * * ReportName = reportName; * ReportFileName = reportFileName; * * _report = new Report(); * _report.Load(reportFileName); * * if (!string.IsNullOrEmpty(connectionString)) * { * for (var i = 0; i < _report.Dictionary.Connections.Count; i++) * { * _report.Dictionary.Connections[i].ConnectionString = connectionString; * } * } * * _exportStreams = new List<EpsStreamType>(); * _exportTypes = new List<ExportType>(); * } */ public EpsFastReport(IEpsReportConfig config, IEpsConfiguration epsConfiguration, IReportExporterFactory reportExporterFactory) { Contract.Requires(config != null); Contract.Requires(epsConfiguration != null); Contract.Requires(reportExporterFactory != null); _config = config; _reportExporterFactory = reportExporterFactory; _exportContainers = new List <EpsReportExportContainer>(); _exportTypes = new List <ExportType>(); CheckConfig(config, epsConfiguration); // создаем временную папку (если еще нет) if (!Directory.Exists(epsConfiguration.TmpPath)) { Directory.CreateDirectory(epsConfiguration.TmpPath); } // настраиваем FastReport if (!string.Equals(FastReport.Utils.Config.TempFolder, epsConfiguration.TmpPath)) { FastReport.Utils.Config.TempFolder = epsConfiguration.TmpPath; } // убираем окно прогресса FastReport.Utils.Config.ReportSettings.ShowProgress = false; //ODAC if (!FastReport.Utils.RegisteredObjects.IsTypeRegistered(typeof(FastReport.Data.OracleDataConnection))) { FastReport.Utils.RegisteredObjects.AddConnection(typeof(FastReport.Data.OracleDataConnection)); } // создаем отчет _report = new Report(); _report.Load(config.ReportFullFileName); //CheckReport(_report); for (var i = 0; i < _report.Dictionary.Connections.Count; i++) { _report.Dictionary.Connections[i].ConnectionString = config.ConnectionString; } }
public virtual IEpsReport CreateReport(IEpsReportConfig config) { return(new EpsFastReport(config, _configuration, _reportExporterFactory)); }
IEpsReport IEpsReportFactory.CreateReport(IEpsReportConfig config) { Contract.Requires(config != null); throw new System.NotImplementedException(); }
public EpsTestReport(IEpsReportConfig config, IEpsConfiguration epsConfiguration, IReportExporterFactory reportExporterFactory) : base(config, epsConfiguration, reportExporterFactory) { }