private bool FillParameters(WebReport report, IEpsConfiguration config) { var result = false; foreach (var param in Request.QueryString) { var name = param.ToString(); var value = Request.QueryString[name]; var upperName = name.ToUpper(); switch (upperName) { case "REPORTID": LoadReport(report, value, config); break; case "REPORTFILE": LoadReportByReportFile(report, value, config); break; case "USEODBC": bool.TryParse(value, out result); break; default: var p = new Parameter(upperName) { Value = value }; report.Report.Parameters.Add(p); break; } } return(result); }
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 EpsJobConfigurator(IEpsConfiguration epsConfiguration, IMacroProcessor macroProcessor) { Contract.Requires(epsConfiguration != null); Contract.Requires(macroProcessor != null); EpsConfig = epsConfiguration; _baseMacroProcessor = macroProcessor; }
public EpsReportFactory(IEpsConfiguration configuration, IReportExporterFactory reportExporterFactory) { Contract.Requires(configuration != null); Contract.Requires(reportExporterFactory != null); _configuration = configuration; _reportExporterFactory = reportExporterFactory; }
public EpsTestReportFactory(IEpsConfiguration configuration, IReportExporterFactory reportExporterFactory) : base(configuration, reportExporterFactory) { _configuration = configuration; _reportExporterFactory = reportExporterFactory; Reports = new List <IEpsReport>(); }
private WebReport GetReport(IEpsConfiguration config) { var report = new WebReport(); var useodbc = FillParameters(report, config); ChangeConnectionStrings(report, config, useodbc); SetupReport(report); return(report); }
public EpsTaskMailExport(IEpsTaskConfig config, IEpsConfiguration epsConfiguration, Archiver archiver, IEpsMailConfig mailConfig) : base(config, epsConfiguration, archiver) { Contract.Requires(mailConfig != null); _mailConfig = mailConfig; }
private static string GetReportPath(IEpsConfiguration config) { var path = config == null ? ConfigurationManager.AppSettings[ReportPathSettingsName] : config.ReportPath; if (string.IsNullOrEmpty(path)) { throw new ConfigurationErrorsException("Найстрока пути к отчетам не задана."); } return(path); }
public EpsJob(IEpsJobConfig config, IEpsConfiguration epsConfiguration, IEpsTaskFactory taskFactory, IEpsReportFactory reportFactory) { Contract.Requires(config != null); Contract.Requires(epsConfiguration != null); Contract.Requires(taskFactory != null); Contract.Requires(reportFactory != null); _config = config; _epsConfiguration = epsConfiguration; _taskFactory = taskFactory; _reportFactory = reportFactory; // проверяем var tasks = config.Tasks; if (tasks.Length == 0) { throw new Exception(string.Format("Can't find any task for job {0}.", _config.JobId)); } var unsupportedTypes = tasks.Where(i => i.TaskExecutorType == EpsTaskExecutorTypes.None || i.TaskExecutorType == EpsTaskExecutorTypes.ARCH || i.TaskExecutorType == EpsTaskExecutorTypes.DCL || i.TaskExecutorType == EpsTaskExecutorTypes.WF) .Select(i => i.TaskExecutorType) .Distinct() .ToArray(); if (unsupportedTypes.Length > 0) { throw new Exception(string.Format("Job {0} contains unsupported task types {1}.", _config.JobId, string.Join(";", unsupportedTypes))); } //TODO: разобаться зачем была нужна сортировка TASK-ов по TaskOrder (где это использовалось) Tasks = tasks.Select(i => _taskFactory.CreateTask(i)).ToArray(); Reports = _config.Reports.Select(i => _reportFactory.CreateReport(i)).ToArray(); CheckWorkingFolder(_config.JobId); var exportTypes = Tasks.Where(i => i.ExportType != null).Select(i => i.ExportType).Distinct(); // отмечаем форматы, в которые выгружаем foreach (var exportType in exportTypes) { foreach (var report in Reports) { report.AddExportType(exportType); } } }
public EpsTask(IEpsTaskConfig config, IEpsConfiguration epsConfiguration, Archiver archiver) { Contract.Requires(config != null); Contract.Requires(epsConfiguration != null); Contract.Requires(archiver != null); Log = LogManager.GetLogger(GetType()); _config = config; _epsConfiguration = epsConfiguration; _archiver = archiver; CheckConfig(); }
/* * 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; } }
private static void ChangeConnectionStrings(WebReport report, IEpsConfiguration config, bool useodbc) { if (report.Report.Dictionary.Connections.Count == 0) { return; } string repConnection; if (config == null) { repConnection = ConfigurationManager.ConnectionStrings["rep"].ConnectionString; } else { repConnection = useodbc ? config.OdbcConnectionString : config.OdacConnectionString; } foreach (DataConnectionBase reportConnection in report.Report.Dictionary.Connections) { reportConnection.ConnectionString = repConnection; } }
public EpsTaskShareExport(IEpsTaskConfig config, IEpsConfiguration epsConfiguration, Archiver archiver) : base(config, epsConfiguration, archiver) { }
public EpsTestReport(IEpsReportConfig config, IEpsConfiguration epsConfiguration, IReportExporterFactory reportExporterFactory) : base(config, epsConfiguration, reportExporterFactory) { }
private static void LoadReportByReportFile(WebReport report, string reportFile, IEpsConfiguration config) { var path = GetReportPath(config); var fullName = Path.Combine(path, reportFile); //ODAC if (!FastReport.Utils.RegisteredObjects.IsTypeRegistered(typeof(OracleDataConnection))) { FastReport.Utils.RegisteredObjects.AddConnection(typeof(OracleDataConnection)); } report.Report.Load(fullName); }
private static void LoadReport(WebReport report, string reportId, IEpsConfiguration config) { var fileName = string.Format("{0}.frx", reportId); LoadReportByReportFile(report, fileName, config); }