private static void CreateReportForDoners(DonerCollection data) { List<Doner> doners = data.GetAllDoners(); foreach (var item in doners) { logger.WriteInfo("Processing Doner: {0} ....", item.Name); ExcelWriter writer = new ExcelWriter(String.Format("{0}_Donations{1}.xlsx", item.Name, reportingYear), ExcelWriter.ReportType.YearlyDonerReport); DonerCollection donationsByDoner = new DonerCollection(); donationsByDoner.AddDonation(item, data.GetDonationsOfDonerByMonth(item, reportingYear)); writer.Write(donationsByDoner.GetAllDonations(), item); } }
private static void TestPrintDonationsOfAaronEx(DonerCollection data) { List<Doner> doner = data.GetAllDoners().Where(d => d.Name.Contains("Aaron")).ToList(); foreach (var item in doner) { logger.WriteInfo("Printing Donations for {0}", item.Name); data.GetDonationsOfDoner(item).ForEach(donation => donation.PrintDonations()); double donationTotal = 0.0; logger.WriteInfo("Total of all donations is ${0}", data.GetDonationsOfDoner(item).Aggregate(donationTotal, (total, variant) => total + variant.CalculateTotal())); logger.WriteInfo("Processing Doner: {0} ....", item.Name); ExcelWriter writer = new ExcelWriter(String.Format("{0}_Donations2010.xlsx", item.Name), FinanceApplication.ExcelWriter.ReportType.YearlyDonerReport); writer.Write(data.GetDonationsOfDoner(item), item); logger.WriteInfo("Printing Donations by Month......"); data.GetDonationsOfDonerByMonth(item, 2010).ForEach( d => d.PrintDonations() ); } }