Esempio n. 1
0
        private int AddSimulationYearData(ExcelWorksheet worksheet, int row, int column, YearsData yearData, int familyId,
                                          BridgeDataModel bridgeDataModel, Dictionary <int, int> projectPickByYear)
        {
            var minCActionCallDecider  = MinCValue.minOfCulvDeckSubSuper;
            var familyIdLessThanEleven = familyId < 11;

            if (familyId > 10)
            {
                worksheet.Cells[row, ++column].Value = "N";
                worksheet.Cells[row, ++column].Value = "N";
                worksheet.Cells[row, ++column].Value = "N";

                worksheet.Cells[row, column + 2].Value = "N";
                worksheet.Cells[row, column + 3].Value = "N";
                worksheet.Cells[row, column + 4].Value = "N";
                yearData.Deck         = "N";
                yearData.Super        = "N";
                yearData.Sub          = "N";
                minCActionCallDecider = MinCValue.valueEqualsCulv;
            }
            else
            {
                worksheet.Cells[row, ++column].Value = Convert.ToDouble(yearData.Deck);
                worksheet.Cells[row, ++column].Value = Convert.ToDouble(yearData.Super);
                worksheet.Cells[row, ++column].Value = Convert.ToDouble(yearData.Sub);

                worksheet.Cells[row, column + 2].Value = Convert.ToDouble(yearData.DeckD);
                worksheet.Cells[row, column + 3].Value = Convert.ToDouble(yearData.SuperD);
                worksheet.Cells[row, column + 4].Value = Convert.ToDouble(yearData.SubD);
            }
            if (familyIdLessThanEleven)
            {
                worksheet.Cells[row, ++column].Value   = "N";
                worksheet.Cells[row, column + 4].Value = "N";
                yearData.Culv  = "N";
                yearData.CulvD = "N";
                if (minCActionCallDecider == MinCValue.valueEqualsCulv)
                {
                    minCActionCallDecider = MinCValue.defaultValue;
                }
                else
                {
                    minCActionCallDecider = MinCValue.minOfDeckSubSuper;
                }
            }
            else
            {
                worksheet.Cells[row, ++column].Value = Convert.ToDouble(yearData.Culv);

                worksheet.Cells[row, column + 4].Value = Convert.ToDouble(yearData.CulvD);
            }
            column += 4;

            column = valueForMinC[minCActionCallDecider](worksheet, row, column, yearData); // It returns the column number where MinC value is written

            if (bridgeDataModel.P3 > 0 && yearData.MinC < 5)
            {
                excelHelper.ApplyColor(worksheet.Cells[row, column], Color.Yellow);
                excelHelper.SetTextColor(worksheet.Cells[row, column], Color.Black);
            }
            //worksheet.Cells[row, ++column].Value = yearData.SD;
            //worksheet.Cells[row, ++column].Value = Convert.ToDouble(yearData.MinC) < 5 ? "Y" : "N" ;
            worksheet.Cells[row, ++column].Value = yearData.MinC < 5 ? "Y" : "N"; //poor

            if (yearData.Year != 0)
            {
                //worksheet.Cells[row, ++column].Value = bridgeDataModel.Posted == "Y" ? getPostedType(yearData.Project) : "N"; // Posted
                worksheet.Cells[row, ++column].Value = yearData.ProjectPick; // Project Pick
                worksheet.Cells[row, ++column].Value = yearData.Budget;      // Budget
                worksheet.Cells[row, ++column].Value = yearData.Project;
                if (projectPickByYear[yearData.Year] == 2)
                {
                    excelHelper.ApplyColor(worksheet.Cells[row, column], Color.FromArgb(0, 255, 0));
                    excelHelper.SetTextColor(worksheet.Cells[row, column], Color.Black);
                }
                worksheet.Cells[row, ++column].Value = yearData.Cost;
                excelHelper.SetCurrencyFormat(worksheet.Cells[row, column]);
                worksheet.Cells[row, ++column].Value = ""; // District Remarks
            }
            // Empty column
            column++;
            worksheet.Column(column).Style.Fill.PatternType = ExcelFillStyle.Solid;
            worksheet.Column(column).Style.Fill.BackgroundColor.SetColor(Color.Gray);

            return(column);
        }
Esempio n. 2
0
        private void FillDataInWorkSheet(ExcelWorksheet worksheet, CurrentCell currentCell, BridgeDataModel bridgeData)
        {
            var row    = currentCell.Row;
            var column = currentCell.Column;


            worksheet.Cells[row, column++].Value = bridgeData.BridgeID;
            worksheet.Cells[row, column++].Value = bridgeData.BRKey;
            worksheet.Cells[row, column++].Value = bridgeData.District;
            worksheet.Cells[row, column++].Value = bridgeData.BridgeCulvert;
            worksheet.Cells[row, column++].Value = bridgeData.DeckArea;
            worksheet.Cells[row, column++].Value = bridgeData.StructureLength;
            worksheet.Cells[row, column++].Value = bridgeData.PlanningPartner;
            worksheet.Cells[row, column++].Value = bridgeData.BridgeFamily;
            worksheet.Cells[row, column++].Value = bridgeData.NHS;
            worksheet.Cells[row, column++].Value = bridgeData.BPN;
            worksheet.Cells[row, column++].Value = bridgeData.StructureType;
            worksheet.Cells[row, column++].Value = bridgeData.FunctionalClass;
            worksheet.Cells[row, column++].Value = bridgeData.YearBuilt;
            worksheet.Cells[row, column++].Value = bridgeData.Age;
            worksheet.Cells[row, column++].Value = bridgeData.AdtTotal;
            worksheet.Cells[row, column++].Value = bridgeData.ADTOverTenThousand;
            worksheet.Cells[row, column++].Value = bridgeData.RiskScore;
            worksheet.Cells[row, column++].Value = bridgeData.P3 > 0 ? "Y" : "N";

            currentCell.Column = column;
        }