예제 #1
0
        internal void Fill(ExcelWorksheet worksheet, SimulationModel simulationModel, int simulationYearsCount, ParametersModel parametersModel)
        {
            var simulationId            = simulationModel.simulationId;
            var investmentPeriod        = analysisData.GetAnySimulationAnalysis(simulationId, db);
            var inflationAndInvestments = getInflationRate.GetAnySimulationInvestmentLibrary(simulationId, db);
            var priorities = getPriorities.GetAnySimulationPriorityLibrary(simulationId, db).Priorities;
            var criterias  = budgetCriteria.GetAnyCriteriaDrivenBudgets(simulationId, db);

            // Simulation Name format
            excelHelper.MergeCells(worksheet, 1, 1, 1, 2);
            excelHelper.MergeCells(worksheet, 1, 3, 1, 10);
            excelHelper.ApplyColor(worksheet.Cells[1, 1, 1, 2], Color.Gray);

            worksheet.Cells["A1:B1"].Value = "Simulation Name";
            worksheet.Cells["C1:J1"].Value = simulationModel.simulationName;
            excelHelper.ApplyColor(worksheet.Cells[1, 3, 1, 10], Color.FromArgb(142, 169, 219));
            excelHelper.ApplyBorder(worksheet.Cells[1, 1, 1, 10]);
            // End of Simulation Name format

            FillData(worksheet, parametersModel);

            FillSimulationDetails(worksheet, investmentPeriod, inflationAndInvestments.InflationRate, simulationYearsCount);
            FillAnalysisDetails(worksheet, investmentPeriod);
            FillJurisdictionCriteria(worksheet, investmentPeriod.Criteria);
            FillPriorities(worksheet, priorities);
            FillInvestmentAndBudgetCriteria(worksheet, inflationAndInvestments, criterias);
            worksheet.Cells.AutoFitColumns(50);
        }
예제 #2
0
        /// <summary>
        ///     Creates a mapping from user roles to the appropriate methods for getting simulation analyses
        /// </summary>
        private Dictionary <string, SimulationAnalysisGetMethod> CreateGetMethods()
        {
            SimulationAnalysisModel GetAnySimulationAnalysis(int id, UserInformationModel userInformation) =>
            repo.GetAnySimulationAnalysis(id, db);
            SimulationAnalysisModel GetPermittedSimulationAnalysis(int id, UserInformationModel userInformation) =>
            repo.GetPermittedSimulationAnalysis(id, db, userInformation.Name);

            return(new Dictionary <string, SimulationAnalysisGetMethod>
            {
                [Role.ADMINISTRATOR] = GetAnySimulationAnalysis,
                [Role.DISTRICT_ENGINEER] = GetPermittedSimulationAnalysis,
                [Role.CWOPA] = GetPermittedSimulationAnalysis,
                [Role.PLANNING_PARTNER] = GetPermittedSimulationAnalysis
            });
        }