private static bool TestExcelWriter(ref DonerCollection data) { List<Doner> doners = data.GetAllDoners().Where( d => d.Name.ToLower().Contains("aaron")).ToList(); 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), FinanceApplication.ExcelWriter.ReportType.YearlyDonerReport); writer.Write(data.GetDonationsOfDoner(item), item); } return true; }
private static void TestPrintDonationsOfAaron(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); } }
private static void TestDonationQueries() { string[] files = { @"C:\temp\TestData\03-07-2010.xls", @"C:\temp\TestData\03-8-2010.xls", @"C:\temp\TestData\2-28-2010.xls", @"C:\temp\TestData\8-1-2010.xls", @"C:\temp\TestData\09-01-2010.xls"}; DonerCollection data = new DonerCollection(); ReadExcel(files, data); logger.WriteInfo("*************ALL DATA START******************"); data.Print(); logger.WriteInfo("*************ALL DATA END ******************"); logger.WriteInfo("*************ALL DONERS START******************"); data.PrintDoners(); logger.WriteInfo("*************ALL DONERS END ******************"); logger.WriteInfo("*************ALL DONATIONS FOR FIRST START******************"); data.GetDonationsOfDoner(data.GetAllDoners().First()).ForEach( d => d.PrintDonations() ); logger.WriteInfo("*************ALL DONATIONS FOR FIRST END ******************"); //logger.WriteInfo("*************ALL DONATIONS FOR FIRST START******************"); //data.GetCategoryDonations(Donation.Category.Tithes).ForEach(d => d.PrintDonations()); //logger.WriteInfo("*************ALL DONATIONS FOR FIRST END ******************"); logger.WriteInfo("*************ALL TITHES START******************"); data.GetDonationsByCategory(Donation.Category.Tithes).ForEach(d => d.PrintDonations()); logger.WriteInfo("*************ALL TITHES END ******************"); logger.WriteInfo("*************RANGE TITHES START******************"); data.GetDonationsByCategory(Donation.Category.Tithes, new DateTime(2010, 02, 01), new DateTime(2010, 04, 01)).ForEach(d => d.PrintDonations()); logger.WriteInfo("*************RANGE TITHES END ******************"); logger.WriteInfo("*************ALL DONATIONS FOR FEB START******************"); data.GetAllDonersAndDonations(new DateTime(2010, 02, 01), new DateTime(2010, 02, 29)) .ForEach(d => { Console.WriteLine( "Name: {0}", ((Doner)d.Key).Name); ((Donation)d.Value).PrintDonations(); } ); logger.WriteInfo("*************ALL DONATIONS FOR FEB END ******************"); }