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); } }
public void Write(DonerCollection donationData) { string text = "blah blah text to add"; StringBuilder sb = new StringBuilder(); sb.AppendLine(String.Format("{0}: \n", donationData.GetAllDoners().FirstOrDefault().Name)); sb.AppendLine(); sb.AppendLine(text); sb.AppendLine("Your total donations for " +donationData.GetAllDonations().FirstOrDefault().DonationTime.Year + " are: "); sb.AppendLine(String.Format("\t{0:C}", donationData.CalculateTotal())); sb.AppendLine(); sb.AppendLine(); sb.AppendLine("Thank you for your support!"); sb.AppendLine("--- CGC Finance Dept ---"); using (StreamWriter file = new StreamWriter(Filename)) { file.Write(sb.ToString()); } }