Esempio n. 1
0
 /// <summary>TBD</summary>
 private void InitializeHeaderRows()
 {
     this.HeaderRow = new ExcelXml.Row(null, 20, null, null, null, string.Empty);
     this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, "Station"), string.Empty, string.Empty, null, null, null));
     DateTime startDate = new DateTime(this.ReportYear, 1, 1);
     for (int i = 0; i < 12; i++)
     {
         this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("{0:MMM} {1} Utilized", startDate, this.ReportYear)), string.Empty, string.Empty, null, null, null));
         this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("{0:MMM} {1} Available", startDate, this.ReportYear)), string.Empty, string.Empty, null, null, null));
         this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("{0:MMM} {1} Utilization %", startDate, this.ReportYear)), string.Empty, string.Empty, null, null, null));
         startDate = startDate.AddMonths(1);
     }
     this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("Full Year {0} Utilization", this.ReportYear)), string.Empty, string.Empty, null, null, null));
     this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("Full Year {0} Availability", this.ReportYear)), string.Empty, string.Empty, null, null, null));
     this.HeaderRow.Cells.Add(new ExcelXml.Cell("sHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Format("Full Year {0} Utilization %", this.ReportYear)), string.Empty, string.Empty, null, null, null));
 }
Esempio n. 2
0
 /// <summary>TBD</summary>
 public void InitializeHeaderRows()
 {
     List<ExcelXml.Row> headerRows = new List<ExcelXml.Row>();
     ExcelXml.Row monthHeaderRow = new ExcelXml.Row(null, 20, null, null, null, string.Empty
     , new ExcelXml.Cell(string.Empty, string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Empty), string.Empty, string.Empty, null, null, null));
     ExcelXml.Row dateHeaderRow = new ExcelXml.Row(null, 18, null, null, null, string.Empty
     , new ExcelXml.Cell("sDateHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, "Date"), string.Empty, string.Empty, null, null, null));
     int prevMonth = this.ReportDates[0].Month;
     string prevMonthDisplay = this.ReportDates[0].ToString("MMMM");
     int monthSpanCount = 0;
     foreach (DateTime spotDate in this.ReportDates)
     {
         dateHeaderRow.Cells.Add(new ExcelXml.Cell("sDateHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, spotDate.ToShortDateString()), string.Empty, string.Empty, null, null, null));
         if (prevMonth == spotDate.Month)
         {
             monthSpanCount++;
         }
         else
         {
             monthHeaderRow.Cells.Add(new ExcelXml.Cell("sMonthHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, prevMonthDisplay), string.Empty, null, null, Convert.ToUInt32(monthSpanCount - 1), null));
             monthSpanCount = 1;
         }
         prevMonthDisplay = spotDate.ToString("MMMM");
         prevMonth = spotDate.Month;
     }
     monthHeaderRow.Cells.Add(new ExcelXml.Cell("sMonthHeader", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, prevMonthDisplay), string.Empty, null, null, Convert.ToUInt32(monthSpanCount - 1), null));
     this.MonthDateHeaderRows = new List<ExcelXml.Row>();
     this.MonthDateHeaderRows.Add(monthHeaderRow);
     this.MonthDateHeaderRows.Add(dateHeaderRow);
 }
Esempio n. 3
0
 /// <summary>TBD</summary>
 /// <returns>TBD</returns>
 private ExcelXml.Row GenerateTotalRow()
 {
     ExcelXml.Row totalRow = new ExcelXml.Row(null, 20, null, null, null, string.Empty);
     totalRow.Cells.Add(new ExcelXml.Cell("sTotalCell", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, "Total"), string.Empty, string.Empty, null, null, null));
     int stationCount = this.ReportItems.Count;
     for (var i = 0; i < 13; i++)
     {
         totalRow.Cells.Add(new ExcelXml.Cell("sTotalCell", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Empty), string.Format("=SUM(R[-{0}]C:R[-1]C)", stationCount), string.Empty, null, null, null));
         totalRow.Cells.Add(new ExcelXml.Cell("sTotalCell", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Empty), string.Format("=SUM(R[-{0}]C:R[-1]C)", stationCount), string.Empty, null, null, null));
         totalRow.Cells.Add(new ExcelXml.Cell("sTotalCellPercent", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, string.Empty), "=IF(RC[-2]=0,0,RC[-2]/RC[-1])", string.Empty, null, null, null));
     }
     return totalRow;
 }
Esempio n. 4
0
 /// <summary>TBD</summary>
 /// <param name="numberOfSpots">TBD</param>
 /// <param name="spotTypeBreakdownData">TBD</param>
 /// <returns>TBD</returns>
 public List<ExcelXml.Row> GenerateSpotTypeBreakdownRows(int numberOfSpots, List<SpotTypeBreakdown> spotTypeBreakdownData)
 {
     List<ExcelXml.Row> spotTypeBreakdownRows = new List<ExcelXml.Row>();
     List<ExcelXml.Cell> spotTypeBreakdownCells;
     ExcelXml.Row spotTypeBreakdownRow;
     string spotTypeStyleBase = "sSpotTypeId_{0}";
     string spotTypeStylePercentageBase = "sSpotTypeId_{0}_Percentage";
     string styleBase;
     bool isPercentage;
     //TODO REFACTOR!
     foreach (SpotTypeBreakdown spotTypeBreakdown in spotTypeBreakdownData)
     {
         isPercentage = spotTypeBreakdown.SpotType.Contains("%");
         styleBase = (isPercentage ? spotTypeStylePercentageBase : spotTypeStyleBase);
         spotTypeBreakdownRow = new ExcelXml.Row(null, 20, null, null, null, null);
         spotTypeBreakdownCells = new List<ExcelXml.Cell>();
         spotTypeBreakdownCells.Add(new ExcelXml.Cell(string.Format(styleBase, spotTypeBreakdown.SpotTypeId), string.Empty, new ExcelXml.Data(ExcelXml.Type.String, HttpUtility.HtmlEncode(spotTypeBreakdown.SpotType)), string.Empty, string.Empty, null, null, null));
         foreach (int spotTypeCount in spotTypeBreakdown.SpotTypeCount)
         {
             spotTypeBreakdownCells.Add(new ExcelXml.Cell(string.Format(styleBase, spotTypeBreakdown.SpotTypeId), string.Empty, new ExcelXml.Data(ExcelXml.Type.Number, HttpUtility.HtmlEncode(Convert.ToString(string.Format("{0}", (isPercentage ? spotTypeCount / 100.0 : spotTypeCount))))), string.Empty, string.Empty, null, null, null));
         }
         spotTypeBreakdownRow.Cells = spotTypeBreakdownCells;
         spotTypeBreakdownRows.Add(spotTypeBreakdownRow);
     }
     spotTypeBreakdownRow = new ExcelXml.Row(null, 20, null, null, null, null);
     spotTypeBreakdownCells = new List<ExcelXml.Cell>();
     spotTypeBreakdownCells.Add(new ExcelXml.Cell("sSpotTypeBreakdownTotal", string.Empty, new ExcelXml.Data(ExcelXml.Type.String, "Total Available Spots"), string.Empty, string.Empty, null, null, null));
     for (int i = 0; i < spotTypeBreakdownData[0].SpotTypeCount.Count; i++)
     {
         spotTypeBreakdownCells.Add(new ExcelXml.Cell("sSpotTypeBreakdownTotal", string.Empty, new ExcelXml.Data(ExcelXml.Type.Number, HttpUtility.HtmlEncode(Convert.ToString(numberOfSpots))), string.Empty, string.Empty, null, null, null));
     }
     spotTypeBreakdownRow.Cells = spotTypeBreakdownCells;
     spotTypeBreakdownRows.Add(spotTypeBreakdownRow);
     return spotTypeBreakdownRows;
 }