Exemple #1
0
        private void AddDetailsForNonNHSCountAndArea(ExcelWorksheet worksheet, CurrentCell currentCell, List <int> simulationYears,
                                                     int totalBridgeCountOrDeckAreaStartRow, int nHSBridgeCountOrDeckAreaStartRow, bool isDeckArea)
        {
            int startRow, startColumn, row, column;

            bridgeWorkSummaryCommon.InitializeLabelCells(worksheet, currentCell, out startRow, out startColumn, out row, out column);
            for (var index = 0; index <= simulationYears.Count; index++)
            {
                var bridgeGood = Convert.ToDouble(worksheet.Cells[totalBridgeCountOrDeckAreaStartRow + 1, column].Value);
                var bridgeFair = Convert.ToDouble(worksheet.Cells[totalBridgeCountOrDeckAreaStartRow + 2, column].Value);
                var bridgePoor = Convert.ToDouble(worksheet.Cells[totalBridgeCountOrDeckAreaStartRow + 3, column].Value);

                var NHSGood = Convert.ToDouble(worksheet.Cells[nHSBridgeCountOrDeckAreaStartRow + 1, column].Value);
                var NHSFair = Convert.ToDouble(worksheet.Cells[nHSBridgeCountOrDeckAreaStartRow + 2, column].Value);
                var NHSPoor = Convert.ToDouble(worksheet.Cells[nHSBridgeCountOrDeckAreaStartRow + 3, column].Value);

                var nonNHSGood = bridgeGood - NHSGood;
                var nonNHSFair = bridgeFair - NHSFair;
                var nonNHSPoor = bridgePoor - NHSPoor;

                worksheet.Cells[startRow, column].Value     = nonNHSGood;
                worksheet.Cells[startRow + 1, column].Value = nonNHSFair;
                worksheet.Cells[startRow + 2, column].Value = nonNHSPoor;
                column++;
            }

            excelHelper.ApplyBorder(worksheet.Cells[startRow, startColumn, row, column - 1]);
            excelHelper.SetCustomFormat(worksheet.Cells[startRow, startColumn + 1, row, column - 1], "Number");
            //if (isDeckArea)
            //{
            //    excelHelper.ApplyColor(worksheet.Cells[row - 1, startColumn + 1, row - 1, column - 1], Color.Khaki);
            //}
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, row + 1, column);
        }
Exemple #2
0
        private void AddDetailsForTotalDeckArea(ExcelWorksheet worksheet, CurrentCell currentCell, List <int> simulationYears, List <SimulationDataModel> simulationDataModels)
        {
            int startRow, startColumn, row, column;

            bridgeWorkSummaryCommon.InitializeLabelCells(worksheet, currentCell, out startRow, out startColumn, out row, out column);
            AddTotalDeckArea(worksheet, simulationDataModels, startRow, column, 0);
            foreach (var year in simulationYears)
            {
                row    = startRow;
                column = ++column;
                AddTotalDeckArea(worksheet, simulationDataModels, row, column, year);
            }
            excelHelper.ApplyBorder(worksheet.Cells[startRow, startColumn, row + 2, column]);
            excelHelper.SetCustomFormat(worksheet.Cells[startRow, startColumn + 1, row + 2, column], "Number");
            excelHelper.ApplyColor(worksheet.Cells[row + 2, startColumn + 1, row + 2, column], Color.Khaki);
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, row + 3, column);
        }
        private void AddDetailsForTotalBridgeAndDeckPercent(ExcelWorksheet worksheet, CurrentCell currentCell, List <int> simulationYears, int dataStartRow)
        {
            int startRow, startColumn, row, column;

            bridgeWorkSummaryCommon.InitializeLabelCells(worksheet, currentCell, out startRow, out startColumn, out row, out column);
            for (var index = 0; index <= simulationYears.Count; index++)
            {
                var sumFormula = "SUM(" + worksheet.Cells[dataStartRow, column, dataStartRow + 2, column] + ")";
                worksheet.Cells[startRow, column].Formula     = worksheet.Cells[dataStartRow, column] + "/" + sumFormula;
                worksheet.Cells[startRow + 1, column].Formula = worksheet.Cells[dataStartRow + 1, column] + "/" + sumFormula;
                worksheet.Cells[startRow + 2, column].Formula = worksheet.Cells[dataStartRow + 2, column] + "/" + sumFormula;
                column++;
            }
            excelHelper.ApplyBorder(worksheet.Cells[startRow, startColumn, startRow + 2, column - 1]);
            excelHelper.SetCustomFormat(worksheet.Cells[startRow, startColumn + 1, startRow + 2, column], "Percentage");
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, row, column - 1);
        }
        private int AddCostsOfCommittedWork(ExcelWorksheet worksheet, List <int> simulationYears, CurrentCell currentCell,
                                            List <WorkSummaryByBudgetModel> comittedProjectsData)
        {
            var startYear = simulationYears[0];
            int startRow, startColumn, row, column;

            bridgeWorkSummaryCommon.SetRowColumns(currentCell, out startRow, out startColumn, out row, out column);
            currentCell.Column = column;
            var committedTotalRow = 0;

            var uniqueTreatments  = new Dictionary <string, int>();
            var costForTreatments = new Dictionary <string, double>();

            foreach (var data in comittedProjectsData)
            {
                if (data.YEARS < startYear || data.TREATMENT.ToLower() == "no treatment")
                {
                    continue;
                }
                if (!uniqueTreatments.ContainsKey(data.TREATMENT))
                {
                    uniqueTreatments.Add(data.TREATMENT, currentCell.Row);
                    worksheet.Cells[currentCell.Row, currentCell.Column].Value = data.TREATMENT;
                    var cellToEnterCost = data.YEARS - startYear;
                    worksheet.Cells[uniqueTreatments[data.TREATMENT], currentCell.Column + cellToEnterCost + 2].Value = data.CostPerTreatmentPerYear;
                    costForTreatments.Add(data.TREATMENT, data.CostPerTreatmentPerYear);
                    currentCell.Row += 1;
                }
                else
                {
                    var cellToEnterCost = data.YEARS - startYear;
                    worksheet.Cells[uniqueTreatments[data.TREATMENT], currentCell.Column + cellToEnterCost + 2].Value = data.CostPerTreatmentPerYear;
                }
            }
            row    = currentCell.Row;
            column = currentCell.Column;
            worksheet.Cells[row, column].Value = Properties.Resources.CommittedTotal;
            column++;
            var fromColumn = column + 1;

            foreach (var year in simulationYears)
            {
                var yearlyBudget           = comittedProjectsData.FindAll(_ => _.YEARS == year);
                var aggregateAmountPerYear = yearlyBudget.Sum(s => s.CostPerTreatmentPerYear);
                column = ++column;

                worksheet.Cells[row, column].Value = aggregateAmountPerYear;
                TotalCommittedSpent.Add(year, aggregateAmountPerYear);
                committedTotalRow = row;
            }
            excelHelper.ApplyBorder(worksheet.Cells[startRow, startColumn, row, column]);
            excelHelper.SetCustomFormat(worksheet.Cells[startRow, fromColumn, row, column], "NegativeCurrency");
            excelHelper.ApplyColor(worksheet.Cells[startRow, fromColumn, row, column], Color.FromArgb(198, 224, 180));
            excelHelper.ApplyColor(worksheet.Cells[committedTotalRow, fromColumn, committedTotalRow, column], Color.FromArgb(84, 130, 53));
            excelHelper.SetTextColor(worksheet.Cells[committedTotalRow, fromColumn, committedTotalRow, column], Color.White);
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, ++row, column);
            return(committedTotalRow);
        }
Exemple #5
0
        private int AddCostsOfCulvertWork(ExcelWorksheet worksheet, List <SimulationDataModel> simulationDataModels, List <int> simulationYears, CurrentCell currentCell)
        {
            int startRow, startColumn, row, column;

            bridgeWorkSummaryCommon.SetRowColumns(currentCell, out startRow, out startColumn, out row, out column);
            int culvertTotalRow = 0;

            worksheet.Cells[row++, column].Value = Properties.Resources.Preservation;
            worksheet.Cells[row++, column].Value = Properties.Resources.Rehabilitation;
            worksheet.Cells[row++, column].Value = Properties.Resources.Replacement;
            worksheet.Cells[row++, column].Value = Properties.Resources.CulvertTotal;
            column++;
            var fromColumn = column + 1;

            foreach (var year in simulationYears)
            {
                row    = startRow;
                column = ++column;

                var preservationCost = bridgeWorkSummaryComputationHelper.CalculateCost(simulationDataModels, year, Properties.Resources.CulvertPreservation);
                worksheet.Cells[row, column].Value = preservationCost;

                var rehabilitationCost = bridgeWorkSummaryComputationHelper.CalculateCost(simulationDataModels, year, Properties.Resources.CulvertRehabilitation);
                worksheet.Cells[++row, column].Value = rehabilitationCost;

                var replacementCost = bridgeWorkSummaryComputationHelper.CalculateCost(simulationDataModels, year, Properties.Resources.CulvertReplacement);
                worksheet.Cells[++row, column].Value = replacementCost;

                worksheet.Cells[++row, column].Value = preservationCost + rehabilitationCost + replacementCost;
                culvertTotalRow = row;
            }
            excelHelper.ApplyBorder(worksheet.Cells[startRow, startColumn, row, column]);
            excelHelper.SetCustomFormat(worksheet.Cells[startRow, fromColumn, row, column], "NegativeCurrency");
            excelHelper.ApplyColor(worksheet.Cells[startRow, fromColumn, row, column], Color.DarkSeaGreen);
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, ++row, column);
            return(culvertTotalRow);
        }