protected void Page_Load(object sender, EventArgs e) { int id; string email; AnniversaryBookSaleVolunteerDA bookSaleVolunteerDA = new AnniversaryBookSaleVolunteerDA(); DataTable dtVolunteers = bookSaleVolunteerDA.GetAllVolunteers(); foreach (DataRow row in dtVolunteers.Rows) { id = (int)row["Id"]; email = (string)row["Email"]; MailUtil.SendVolunteerEmail(email, bookSaleVolunteerDA.GetEmailBody(id, Server.MapPath(MailUtil.AnniversaryBookSaleVolunteerTemplate))); } bookSaleVolunteerDA = null; }
protected void Page_Load(object sender, EventArgs e) { int id = 0; if (!String.IsNullOrEmpty(Request["typeid"])) { CSVExporter.ExportType exportType = (CSVExporter.ExportType)Enum.Parse(typeof(CSVExporter.ExportType), Request["typeid"]); if (Enum.IsDefined(typeof(CSVExporter.ExportType), exportType)) { if (!String.IsNullOrEmpty(Request["id"])) { if (Int32.TryParse(Request["id"], out id)) { switch (exportType) { case CSVExporter.ExportType.Advocacy: AdvocacyDA advocacyDA = new AdvocacyDA(); using (DataTable dt = advocacyDA.GetAdvocacy(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Advocacy, advocacyDA.DetailsViewName); } advocacyDA = null; break; case CSVExporter.ExportType.Donation: DonationDA donationDA = new DonationDA(); using (DataTable dt = donationDA.GetDonation(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Donation, donationDA.DetailsViewName); } donationDA = null; break; case CSVExporter.ExportType.Membership: MembershipDA membershipDA = new MembershipDA(); using (DataTable dt = membershipDA.GetMembership(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Membership, membershipDA.DetailsViewName); } membershipDA = null; break; case CSVExporter.ExportType.StudentVolunteer: StudentVolunteerDA studentVolunteerDA = new StudentVolunteerDA(); using (DataTable dt = studentVolunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.StudentVolunteer, studentVolunteerDA.DetailsViewName); } studentVolunteerDA = null; break; case CSVExporter.ExportType.Volunteer: VolunteerDA volunteerDA = new VolunteerDA(); using (DataTable dt = volunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Volunteer, volunteerDA.DetailsViewName); } volunteerDA = null; break; case CSVExporter.ExportType.BigBookSaleVolunteer: BigBookSaleVolunteerDA bookSaleVolunteerDA = new BigBookSaleVolunteerDA(); using (DataTable dt = bookSaleVolunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BigBookSaleVolunteer, bookSaleVolunteerDA.DetailsViewName); } bookSaleVolunteerDA = null; break; case CSVExporter.ExportType.BookAndPlantSaleVolunteer: BookAndPlantSaleVolunteerDA bookAndPlantSaleVolunteerDA = new BookAndPlantSaleVolunteerDA(); using (DataTable dt = bookAndPlantSaleVolunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BookAndPlantSaleVolunteer, bookAndPlantSaleVolunteerDA.DetailsViewName); } bookAndPlantSaleVolunteerDA = null; break; case CSVExporter.ExportType.BigBookSaleStudentVolunteer: BigBookSaleStudentVolunteerDA bookSaleStudentVolunteerDA = new BigBookSaleStudentVolunteerDA(); using (DataTable dt = bookSaleStudentVolunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BigBookSaleStudentVolunteer, bookSaleStudentVolunteerDA.DetailsViewName); } bookSaleStudentVolunteerDA = null; break; case CSVExporter.ExportType.AnniversaryBookSaleVolunteer: AnniversaryBookSaleVolunteerDA anniversaryBookSaleVolunteerDA = new AnniversaryBookSaleVolunteerDA(); using (DataTable dt = anniversaryBookSaleVolunteerDA.GetVolunteer(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.AnniversaryBookSaleVolunteer, anniversaryBookSaleVolunteerDA.DetailsViewName); } anniversaryBookSaleVolunteerDA = null; break; case CSVExporter.ExportType.BookDonation: BookDonationDA bookDonationDA = new BookDonationDA(); using (DataTable dt = bookDonationDA.GetBookDonation(id)) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BookDonation, bookDonationDA.DetailsViewName); } bookDonationDA = null; break; } } } else if (!String.IsNullOrEmpty(Request["all"])) { switch (exportType) { case CSVExporter.ExportType.Advocacy: AdvocacyDA advocacyDA = new AdvocacyDA(); using (DataTable dt = advocacyDA.GetAllAdvocacy()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Advocacy, advocacyDA.DetailsViewName); } advocacyDA = null; break; case CSVExporter.ExportType.Donation: DonationDA donationDA = new DonationDA(); using (DataTable dt = donationDA.GetAllDonations()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Donation, donationDA.DetailsViewName); } donationDA = null; break; case CSVExporter.ExportType.Membership: MembershipDA membershipDA = new MembershipDA(); using (DataTable dt = membershipDA.GetAllMemberships()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Membership, membershipDA.DetailsViewName); } membershipDA = null; break; case CSVExporter.ExportType.StudentVolunteer: StudentVolunteerDA studentVolunteerDA = new StudentVolunteerDA(); using (DataTable dt = studentVolunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.StudentVolunteer, studentVolunteerDA.DetailsViewName); } studentVolunteerDA = null; break; case CSVExporter.ExportType.Volunteer: VolunteerDA volunteerDA = new VolunteerDA(); using (DataTable dt = volunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.Volunteer, volunteerDA.DetailsViewName); } volunteerDA = null; break; case CSVExporter.ExportType.BigBookSaleVolunteer: BigBookSaleVolunteerDA bookSaleVolunteerDA = new BigBookSaleVolunteerDA(); using (DataTable dt = bookSaleVolunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BigBookSaleVolunteer, bookSaleVolunteerDA.DetailsViewName); } bookSaleVolunteerDA = null; break; case CSVExporter.ExportType.BookAndPlantSaleVolunteer: BookAndPlantSaleVolunteerDA bookAndPlantSaleVolunteerDA = new BookAndPlantSaleVolunteerDA(); using (DataTable dt = bookAndPlantSaleVolunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BookAndPlantSaleVolunteer, bookAndPlantSaleVolunteerDA.DetailsViewName); } bookAndPlantSaleVolunteerDA = null; break; case CSVExporter.ExportType.BigBookSaleStudentVolunteer: BigBookSaleStudentVolunteerDA bookSaleStudentVolunteerDA = new BigBookSaleStudentVolunteerDA(); using (DataTable dt = bookSaleStudentVolunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BigBookSaleStudentVolunteer, bookSaleStudentVolunteerDA.DetailsViewName); } bookSaleStudentVolunteerDA = null; break; case CSVExporter.ExportType.AnniversaryBookSaleVolunteer: AnniversaryBookSaleVolunteerDA anniversaryBookSaleVolunteerDA = new AnniversaryBookSaleVolunteerDA(); using (DataTable dt = anniversaryBookSaleVolunteerDA.GetAllVolunteers()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.AnniversaryBookSaleVolunteer, anniversaryBookSaleVolunteerDA.DetailsViewName); } anniversaryBookSaleVolunteerDA = null; break; case CSVExporter.ExportType.BookDonation: BookDonationDA bookDonationDA = new BookDonationDA(); using (DataTable dt = bookDonationDA.GetAllBookDonations()) { CSVExporter.WriteToCSV(dt, CSVExporter.ExportType.BookDonation, bookDonationDA.DetailsViewName); } bookDonationDA = null; break; } } } } }