Example #1
0
 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);
     }
 }
Example #2
0
 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);    
     }
 }
Example #3
0
        private static void CreateMonthlyReports(DonerCollection data)
        {
            List<Doner> doners = data.GetAllDoners();
            for (DateTime start = new DateTime(reportingYear, 1, 1); start.Year < reportingYear+1; start = start.AddMonths(1))
            //for (DateTime start = new DateTime(2010, 1, 1); start.Month < 2; start = start.AddMonths(1))
            {
                DateTime end = start.AddMonths(1);
                logger.WriteInfo("Processing Month: {0} ....", CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName( start.Month ));
                var monthData = data.GetDonationsByDate(start, end);
                if (!monthData.Any())
                {
                    logger.WriteWarning("No data found for this month");
                    continue;
                }
                ExcelWriter writer = new ExcelWriter(String.Format("{0}_{1}_TallyReport.xlsx", 
                    CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName( start.Month ), start.Year.ToString()),
                    FinanceApplication.ExcelWriter.ReportType.MonthyTally);
                logger.WriteInfo("Done. Total = {0:C}", writer.Write(monthData, new Doner("nobody")));
                // TEMP CODE FOR DEBUGGING
                //data.GetDonationsByDate(start, end).ForEach(d => d.PrintDonations());

            }
        }
Example #4
0
 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;
 }