public void Area(List<Garden> gardenList, Report newReport) { foreach (Garden garden in gardenList) { String ownerName = garden.OwnerName; String area = garden.GetArea().ToString(); String line = String.Format("{0,-14}:{1,10:f2}", ownerName, area); newReport.currentReportContent.Add(line); } }
public void AccountBalance(List<Garden> gardenList, Report newReport) { foreach (Garden garden in gardenList) { String ownerName = garden.OwnerName; String symbol = "$"; String balance = garden.GetAccountBalance().ToString(); String line = String.Format("{0,-14}:{1,7}{2,1:f2}", ownerName, symbol, balance); newReport.currentReportContent.Add(line); } }
public void Charges(List<Garden> gardenList, Report newReport) { String horizontalLine = "=====================================================\n"; newReport.currentReportContent.Add(horizontalLine); foreach (Garden garden in gardenList) { String ownerName = garden.OwnerName; List<double> chargesList = garden.CurrentCharges; String symbol = "$"; newReport.currentReportContent.Add(ownerName); newReport.currentReportContent.Add(horizontalLine); foreach (double charge in chargesList) { newReport.currentReportContent.Add(symbol + charge.ToString("f2")); } newReport.currentReportContent.Add(horizontalLine); } }
public void createReport(List<Garden> gardenList, Report newReport) { newReport.generateReport = new Report.GenerateReport(Charges); }
public List<String> GetChargesReport() { Report reportType = new Report(chargesReportItem); return ProcessGardens(reportType); }
public List<String> GetAreaReport() { Report reportType = new Report(areaReportItem); return ProcessGardens(reportType); }
/// <summary> /// Create a report using the given delegate /// </summary> /// <param name="report">Report type</param> /// <returns>String list of report</returns> private List<String> ProcessGardens(Report report) { //Hold the report ready to return List<String> output = new List<String>(); foreach (Garden g in gardenList) { output.Add(report(g)); } return output; }
public ReportManager() { gardenManager = new GardenManager(); newReport = new Report(); }
public void createReport(List<Garden> gardenList, Report newReport) { newReport.generateReport = new Report.GenerateReport(AccountBalance); }