Ejemplo n.º 1
0
        private int AddCostsOfCulvertWork(ExcelWorksheet worksheet, List <SimulationDataModel> simulationDataModels, List <int> simulationYears, CurrentCell currentCell, List <string> treatments)
        {
            int startRow, startColumn, row, column;

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

            foreach (var item in treatments)
            {
                if (item.ToLower().Contains("culvert"))
                {
                    worksheet.Cells[row++, column].Value = item;
                }
            }
            worksheet.Cells[row++, column].Value = Properties.Resources.CulvertTotal;
            column++;
            var fromColumn = column + 1;

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

                foreach (var item in treatments)
                {
                    if (item.ToLower().Contains("culvert"))
                    {
                        var culvertCost = bridgeWorkSummaryComputationHelper.CalculateCost(simulationDataModels, year, item);
                        worksheet.Cells[row++, column].Value = culvertCost;
                        culvertTotalCost += culvertCost;
                    }
                }
                worksheet.Cells[row, column].Value = culvertTotalCost;
                culvertTotalRow = row;
                TotalCulvertSpent.Add(year, culvertTotalCost);
            }
            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[culvertTotalRow, fromColumn, culvertTotalRow, column], Color.FromArgb(84, 130, 53));
            excelHelper.SetTextColor(worksheet.Cells[culvertTotalRow, fromColumn, culvertTotalRow, column], Color.White);
            bridgeWorkSummaryCommon.UpdateCurrentCell(currentCell, ++row, column);
            return(culvertTotalRow);
        }
Ejemplo n.º 2
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);
        }