/// <summary> /// Gets the report generator. /// </summary> /// <param name="reportGenerationQueueItemId">The report generation queue item id.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns></returns> public static AbstractReportGenerator GetReportGenerator(int reportGenerationQueueItemId, IReportQueueStatusService reportQueueStatusService) { return GetReportGenerator( reportGenerationQueueItemId, new ReportGenerationConfiguration(new AppSettingsProvider()), reportQueueStatusService); }
public FakeReportGenerator(AbstractReportParameter parameter, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this.ReportParameter = parameter; }
/// <summary> /// Initializes a new instance of the <see cref="AbstractReportGenerator"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public AbstractReportGenerator( IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) { this._Configuration = configuration; this._ReportQueueStatusService = reportQueueStatusService; }
/// <summary> /// Initializes a new instance of the InProcessReportGenerationController class /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public InProcessReportGenerationController( IInProcessConfiguration configuration, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this._Configuration = configuration; }
/// <summary> /// Initializes a new instance of the <see cref="GenerationControllerBase"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public GenerationControllerBase( IControllerConfigurationBase configuration, IReportQueueStatusService reportQueueStatusService) { this._Configuration = configuration; this._DatabaseQueuePollInterval = new CachedValue<int>(() => this._Configuration.DatabaseQueuePollInterval); this._ReportQueueStatusService = reportQueueStatusService; }
/// <summary> /// Initializes a new instance of the <see cref="ProfitabilityReportGenerator"/> class /// </summary> /// <param name="reportParameter">A profitability report parameter containing all the report parameters</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public ProfitabilityReportGenerator( ProfitabilityReportParameter reportParameter, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this._ExcelExportHandler = new ProfitabilityV2ExcelExportHandler(reportParameter); this.ReportParameter = reportParameter; }
/// <summary> /// Initializes a new instance of the <see cref="BudgetOriginatorFTEReportGenerator"/> class. /// </summary> /// <param name="reportParameter">A Budget Originator FTE Report Parameter instance containing all the report parameters</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public BudgetOriginatorFTEReportGenerator( BudgetOriginatorFTEReportParameter reportParameter, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this.ReportParameter = reportParameter; this._ExcelExportHandler = new BudgetOriginatorFTEv2ExcelExportHandler(reportParameter); }
/// <summary> /// Initializes a new instance of the OutOfProcessReportGenerationController class /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="processFactory">The process factory.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public OutOfProcessReportGenerationController( IOutOfProcessConfiguration configuration, IProcessFactory processFactory, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this._Configuration = configuration; this._ProcessFactory = processFactory; }
/// <summary> /// Initializes a new instance of the <see cref="ExpenseCzarReportGenerator"/> class. /// </summary> /// <param name="reportParameter">An Expense Czar Report Parameter instance containing all the report parameters</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> public ExpenseCzarReportGenerator( ExpenseCzarReportParameter reportParameter, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) : base(configuration, reportQueueStatusService) { this._ExcelExportHandler = new ExpenseCzarTotalComparisonDetailv2ExcelExportHandler(reportParameter); this.ReportParameter = reportParameter; }
public static OutOfProcessReportGenerationController CreateController( IOutOfProcessConfiguration configuration, IProcessFactory processFactory, IReportQueueStatusService statusService) { var controller = new OutOfProcessReportGenerationController(configuration, processFactory, statusService); controller.RunProcess = true; controller.DatabaseQueuePollInterval = 500; return controller; }
/// <summary> /// Updates the queued report status. /// </summary> /// <param name="service">The service.</param> /// <param name="reportGenerationQueueId">The report generation queue id.</param> /// <param name="reportStatus">The report status.</param> /// <param name="message">The message.</param> public static void UpdateQueuedReportStatus( IReportQueueStatusService service, int reportGenerationQueueId, ReportStatus reportStatus, string message) { UpdateQueuedReportStatus( service, reportGenerationQueueId, reportStatus, new List<string>(new[] { message }), message); }
/// <summary> /// Generates a budget owner FTE report generator for a specific report /// </summary> /// <param name="report">The report Instance</param> /// <param name="reportGenerationQueueId">The report generation queue instance id</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns></returns> private static BudgetOwnerFTEReportGenerator GetFTEBudgetOwnerReportGenerator( Report report, int reportGenerationQueueId, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) { BudgetOwnerFTEReportParameter reportParameter = BuildBudgetOwnerFTEReportParameter( report, reportGenerationQueueId, configuration, reportQueueStatusService); return new BudgetOwnerFTEReportGenerator(reportParameter, configuration, reportQueueStatusService); }
/// <summary> /// Updates the queued report status. /// I would prefer this to be an instance method on the GenerationDao (but this is ok for now) /// </summary> /// <param name="service">The service.</param> /// <param name="reportGenerationQueueId">The report generation queue id.</param> /// <param name="reportStatus">The report status.</param> /// <param name="executionLog">The execution log.</param> /// <param name="queryText">The query text.</param> public static void UpdateQueuedReportStatus( IReportQueueStatusService service, int reportGenerationQueueId, ReportStatus reportStatus, List<string> executionLog, string queryText) { string executionLogStr = string.Empty; string queryTextStr = string.Empty; if (reportStatus == ReportStatus.Completed || reportStatus == ReportStatus.Failed) { executionLogStr = " Execution Log : " + executionLog.Concatenate(System.Environment.NewLine); queryTextStr = "QueryText: " + queryText; } else if (reportStatus == ReportStatus.Cancelled) { executionLogStr = "-- Report cancelled due to deactivated ReportType"; queryTextStr = "-- Report cancelled due to deactivated ReportType"; } service.UpdateReportGenerationQueue(new ReportGenerationQueueStatusDto() { ReportGenerationQueueId = reportGenerationQueueId, ReportStatus = reportStatus, QueryText = queryTextStr, ExecutionLog = executionLogStr }); }
/// <summary> /// Generates an Expense Czar report generator for a specific report /// </summary> /// <param name="report">The report instance</param> /// <param name="reportGenerationQueueId">The report generation queue instance id</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns>The report generator</returns> private static ExpenseCzarReportGenerator GetExpenseCzarReportGenerator( Report report, int reportGenerationQueueId, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) { ExpenseCzarReportParameter reportParameter = BuildExpenseCzarReportParameter( report, reportGenerationQueueId, configuration, reportQueueStatusService); return new ExpenseCzarReportGenerator(reportParameter, configuration, reportQueueStatusService); }
/// <summary> /// Creates a new Budget Owner Report Parameter object encapsulating all the report parameters /// </summary> /// <param name="report">The report for which to fetch the parameters</param> /// <param name="reportGenerationQueueId">The report generation queue instance id</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns>The budget owner report parameter object</returns> private static BudgetOwnerReportParameter BuildBudgetOwnerReportParameter( Report report, int reportGenerationQueueId, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService, int isEU) { ReportGenerationQueue reportGenerationQueue = DataAccessFactory.Create<GenerationDao>().GetReportGenerationQueueItem(reportGenerationQueueId); if (reportGenerationQueue != null && report != null) { // Validate all parameters first, because the database does not enforce constraints if (report.ReportParameterShowMRISourceForPayroll == null) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterShowMRISourceForPayroll"); } if (report.ReportParameterCalculationMethod == null) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterCalculationMethod"); } if (report.ReportParameterGLCategorization == null) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterGLCategorization"); } if (report.ReportParameterCurrency == null) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterCurrency"); } if (report.ReportParameterEntityTypes.Count == 0) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterEntityTypes"); } else { bool validPropertyFunds = false; foreach (ReportParameterEntityType reportParameterEntityType in report.ReportParameterEntityTypes) { if (reportParameterEntityType.ReportParameterPropertyFunds.Count > 0) { validPropertyFunds = true; } } if (!validPropertyFunds) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterPropertyFunds"); } } if (report.ReportParameterActivityTypes.Count == 0) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterActivityTypes"); } if (report.ReportParameterAllocationSubRegions.Count == 0) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterAllocationSubRegions"); } if (report.ReportParameterFunctionalDepartments.Count == 0) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterFunctionalDepartments"); } if (report.ReportParameterReportReceivers.Count == 0) { throw new InvalidReportParameterException(report.ReportId, "ReportParameterReportReceivers"); } // Get all the parameters we need bool mustDeliverToTest = reportGenerationQueue.MustDeliverReportToTestLocation; bool showMRISourceForPayroll = report.ReportParameterShowMRISourceForPayroll.ShowMRISourceForPayroll; DateTime insertedDate = reportGenerationQueue.InsertedDate; int reportPeriod = reportGenerationQueue.Period; string reforecastQuarterName = reportGenerationQueue.ReforecastQuarterName; bool reportTypeIsActive = report.ReportType.IsActive; string reportName = report.Name; List<ParameterActivityType> activityTypes = new List<ParameterActivityType>(); foreach (ReportParameterActivityType reportParameterActivityType in report.ReportParameterActivityTypes) { activityTypes.Add(reportParameterActivityType.ParameterActivityType); } List<ParameterAllocationSubRegion> allocationSubRegions = new List<ParameterAllocationSubRegion>(); foreach (ReportParameterAllocationSubRegion reportParameterAllocationSubRegion in report.ReportParameterAllocationSubRegions) { allocationSubRegions.Add(reportParameterAllocationSubRegion.ParameterAllocationSubRegion); } ParameterCalculationMethod calculationMethod = report.ReportParameterCalculationMethod.ParameterCalculationMethod; ParameterGLCategorization glCategorization = report.ReportParameterGLCategorization.ParameterGLCategorization; Currency currency = report.ReportParameterCurrency.Currency; List<ParameterFunctionalDepartment> functionalDepartments = new List<ParameterFunctionalDepartment>(); foreach (ReportParameterFunctionalDepartment reportParameterFunctionalDepartment in report.ReportParameterFunctionalDepartments) { functionalDepartments.Add(reportParameterFunctionalDepartment.ParameterFunctionalDepartment); } List<ParameterGLFinancialCategory> financialCategories = new List<ParameterGLFinancialCategory>(); List<ParameterGLMajorCategory> majorCategories = new List<ParameterGLMajorCategory>(); List<ParameterGLMinorCategory> minorCategories = new List<ParameterGLMinorCategory>(); foreach (ReportParameterGLFinancialCategory reportParameterGLFinancialCategory in report.ReportParameterGLCategorization.ReportParameterGLFinancialCategories) { financialCategories.Add(reportParameterGLFinancialCategory.ParameterGLFinancialCategory); foreach (ReportParameterGLMajorCategory reportParameterGLMajorCategory in reportParameterGLFinancialCategory.ReportParameterGLMajorCategories) { majorCategories.Add(reportParameterGLMajorCategory.ParameterGLMajorCategory); foreach (ReportParameterGLMinorCategory reportParameterGLMinorCategory in reportParameterGLMajorCategory.ReportParameterGLMinorCategories) { minorCategories.Add(reportParameterGLMinorCategory.ParameterGLMinorCategory); } } } List<ParameterOriginatingSubRegion> originatingSubRegions = new List<ParameterOriginatingSubRegion>(); foreach (ReportParameterOriginatingSubRegion reportParameterOriginatingSubRegion in report.ReportParameterOriginatingSubRegions) { originatingSubRegions.Add(reportParameterOriginatingSubRegion.ParameterOriginatingSubRegion); } List<ParameterEntityType> entityTypes = new List<ParameterEntityType>(); foreach (ReportParameterEntityType reportParameterEntityType in report.ReportParameterEntityTypes) { entityTypes.Add(reportParameterEntityType.ParameterEntityType); } List<ParameterPropertyFund> propertyFunds = new List<ParameterPropertyFund>(); foreach (ReportParameterEntityType reportParameterEntityType in report.ReportParameterEntityTypes) { foreach (ReportParameterPropertyFund reportParameterPropertyFund in reportParameterEntityType.ReportParameterPropertyFunds) { propertyFunds.Add(reportParameterPropertyFund.ParameterPropertyFund); } } List<ParameterReportReceiver> reportReceivers = new List<ParameterReportReceiver>(); foreach (ReportParameterReportReceiver reportParameterReportReceiver in report.ReportParameterReportReceivers) { reportReceivers.Add(reportParameterReportReceiver.ParameterReportReceiver); } return new BudgetOwnerReportParameter( mustDeliverToTest, insertedDate, reportPeriod, reforecastQuarterName, reportTypeIsActive, reportGenerationQueueId, reportName, showMRISourceForPayroll, activityTypes, allocationSubRegions, calculationMethod, glCategorization, currency, functionalDepartments, financialCategories, majorCategories, minorCategories, originatingSubRegions, entityTypes, propertyFunds, reportReceivers, isEU == 0 ? BusinessLayer.Automation.Enums.ReportType.BudgetOwnerReport : BusinessLayer.Automation.Enums.ReportType.BudgetOwnerEUReport); } return null; }
/// <summary> /// Gets the report generator. /// </summary> /// <param name="reportGenerationQueueItemId">The report generation queue item id.</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns></returns> public static AbstractReportGenerator GetReportGenerator( int reportGenerationQueueItemId, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) { using (GenerationDao generationDao = DataAccessFactory.Create<GenerationDao>(GetReportDataLoadOptions())) { Report report = generationDao.GetReport(reportGenerationQueueItemId); if (report != null) { switch (EnumHelper.GetEnum<GRP.BusinessLayer.Automation.Enums.ReportType>(report.ReportType.Name)) { case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOriginatorReport: return GetBudgetOriginatorReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOwnerReport: return GetBudgetOwnerReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.ExpenseCzarReport: return GetExpenseCzarReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOriginatorJobCodeDetailsReport: return GetBudgetJobCodeReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.ProfitabilityReport: return GetProfitabilityReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOriginatorFTEReport: return GetFTEBudgetOriginatorReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOwnerFTEReport: return GetFTEBudgetOwnerReportGenerator(report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOriginatorEUReport: return GetBudgetOriginatorEUReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); case GRP.BusinessLayer.Automation.Enums.ReportType.BudgetOwnerEUReport: return GetBudgetOwnerEUReportGenerator( report, reportGenerationQueueItemId, configuration, reportQueueStatusService); default: throw new ReportGenerationException("Invalid report type for report with report generation queue item with ID " + reportGenerationQueueItemId); } } else { throw new ReportGenerationException("No report could be found for the report generation queue item with ID " + reportGenerationQueueItemId); } } }
/// <summary> /// Creates a new Profitability Report Generator for a given report /// </summary> /// <param name="report">The report to generate</param> /// <param name="reportGenerationQueueId">The report generation queue instance id</param> /// <param name="configuration">The configuration.</param> /// <param name="reportQueueStatusService">The report queue status service.</param> /// <returns>The report generator</returns> private static ProfitabilityReportGenerator GetProfitabilityReportGenerator( Report report, int reportGenerationQueueId, IReportGenerationConfiguration configuration, IReportQueueStatusService reportQueueStatusService) { ProfitabilityReportParameter reportParameter = BuildProfitabilityReportParameter(report, reportGenerationQueueId); return new ProfitabilityReportGenerator( reportParameter, configuration, reportQueueStatusService); }