コード例 #1
0
 private static void UpdateLevelFor(ReportData[] reportDatas)
 {
     foreach (var reportModule in reportDatas)
     {
         reportModule.Level++;
     }
 }
コード例 #2
0
 public static string FormatEachLineInReport(ReportData reportdata)
 {
     return String.Format(
         "{0}{1} {2} {3}\r\n", GeneratePrefix(reportdata.Level),
         reportdata.Style,
         reportdata.CarsParked,
         reportdata.AvailableStalls);
 }
コード例 #3
0
 public static string FormatReportDatas(ReportData[] reportdatas)
 {
     var report = new StringBuilder();
     foreach (var reportdata in reportdatas)
     {
         report.Append(FormatEachLineInReport(reportdata));
     }
     return report.ToString();
 }
コード例 #4
0
 public static ReportData[] GenerateReportDatas(IParkable[] parkables, string style)
 {
     var reportDatas = new List<ReportData>();
     var summary = new ReportData()
     {
         AvailableStalls = 0,
         CarsParked = 0,
         Level = 0,
         Style = style
     };
     reportDatas.Add(summary);
     foreach (var parkable in parkables)
     {
         var datas = parkable.GenerateReportDatas();
         UpdateLevelFor(datas);
         UpdateSummaryData(summary, datas.First());
         reportDatas.AddRange(datas);
     }
     return reportDatas.ToArray();
 }
コード例 #5
0
 private static void UpdateSummaryData(ReportData dataForManager, ReportData reportData)
 {
     dataForManager.AvailableStalls += reportData.AvailableStalls;
     dataForManager.CarsParked += reportData.CarsParked;
 }