Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
 public void createReport(List<Garden> gardenList, Report newReport)
 {
     newReport.generateReport = new Report.GenerateReport(Charges);
 }
Ejemplo n.º 5
0
 public List<String> GetChargesReport()
 {
     Report reportType = new Report(chargesReportItem);
     return ProcessGardens(reportType);
 }
Ejemplo n.º 6
0
 public List<String> GetAreaReport()
 {
     Report reportType = new Report(areaReportItem);
     return ProcessGardens(reportType);
 }
Ejemplo n.º 7
0
        /// <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;
        }
Ejemplo n.º 8
0
 public ReportManager()
 {
     gardenManager = new GardenManager();
     newReport = new Report();
 }
 public void createReport(List<Garden> gardenList, Report newReport)
 {
     newReport.generateReport = new Report.GenerateReport(AccountBalance);
 }