protected void Page_Load(object sender, EventArgs e) { int ID = 0; string strID = Security.Decrypt(Request["id"]); string strTypeID = Request["typeid"]; masterPage = (masterpages_Site)Master; if (!String.IsNullOrEmpty(strID)) { Int32.TryParse(strID, out ID); } try { if (strTypeID == MailUtil.EmailType.Donation.ToString("D")) { DonationDA DA = new DonationDA(); StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath("~/App_Data/DonationEmail.xsl")); litEmailBody.Text += sb.ToString(); pageName = "Donation_Confirmation_Template"; } else if (strTypeID == MailUtil.EmailType.Membership.ToString("D")) { MembershipDA DA = new MembershipDA(); StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath("~/App_Data/MembershipEmail.xsl")); litEmailBody.Text += sb.ToString().Replace("Please keep this email as receipt for your order.", "Please keep this as receipt for your order."); pageName = "Membership_Confirmation_Template"; } else if (strTypeID == MailUtil.EmailType.Volunteer.ToString("D")) { VolunteerDA DA = new VolunteerDA(); StringBuilder sb = DA.GetEmailBody_Test(ID, Server.MapPath("~/App_Data/VolunteerEmail_Test.xsl")); litEmailBody.Text += sb.ToString(); pageName = "Volunteer_Confirmation_Template"; } else if (strTypeID == MailUtil.EmailType.StudentVolunteer.ToString("D")) { StudentVolunteerDA DA = new StudentVolunteerDA(); StringBuilder sb = DA.GetEmailBody_Test(ID, Server.MapPath("~/App_Data/StudentVolunteerEmail_Test.xsl")); litEmailBody.Text += sb.ToString(); pageName = "Volunteer_Confirmation_Template"; } else if (strTypeID == MailUtil.EmailType.Advocacy.ToString("D")) { AdvocacyDA DA = new AdvocacyDA(); StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath("~/App_Data/AdvocacyEmail.xsl")); litEmailBody.Text += sb.ToString(); pageName = "Volunteer_Confirmation_Template"; } else if (strTypeID == MailUtil.EmailType.BigBookSaleVolunteer.ToString("D")) { BigBookSaleVolunteerDA DA = new BigBookSaleVolunteerDA(); StringBuilder sb = DA.GetEmailBody(ID, Server.MapPath("~/App_Data/BigBookSaleVolunteerEmail.xsl")); litEmailBody.Text += sb.ToString(); pageName = "Volunteer_Confirmation_Template"; } } catch (Exception ex) { pageName = ""; litEmailBody.Text = ex.Message; } finally { masterPage.ComponentName = pageName; } }
protected void btnInsert_Click(object sender, EventArgs e) { int newID = 0; HttpContext ctx = HttpContext.Current; if (IsValid) { try { sb.Append("<h1>Volunteer_Form</h1>"); sb.AppendFormat("<h2>Url:</h2><p>{0}</p>", ctx.Request.Url); sb.AppendFormat("<h2>Referrer:</h2><p>{0}</p>", ctx.Request.UrlReferrer); sb.AppendFormat("<h2>QueryString:</h2><p>{0}</p>", HttpUtility.HtmlEncode(ctx.Request.QueryString.ToString())); sb.AppendFormat("<h2>UserHostName:</h2><p>{0}</p>", ctx.Request.UserHostName); sb.AppendFormat("<h2>UserHostAddress:</h2><p>{0}</p>", ctx.Request.UserHostAddress); sb.Append("<h2>Form Data</h2>"); addField("FirstName", txtFirstName.Text); addField("LastName", txtLastName.Text); addField("Address1", txtAddress1.Text); addField("Address2", txtAddress2.Text); addField("City", txtCity.Text); addField("StateCode", ddlState.SelectedValue); addField("ZipCode", txtZipCode.Text); addField("HomePhone", txtHomePhone.Text); addField("Email", txtEmail.Text); addField("LocalLibrary", txtLocalLibrary.Text); addCheckbox("OpportunityStepSale", cbxOpportunityStepSale.Checked); addCheckbox("OpportunityStepSaleTime1", cbxOpportunityStepSaleTime1.Checked); addCheckbox("OpportunityStepSaleTime2", cbxOpportunityStepSaleTime2.Checked); addCheckbox("OpportunityBookPickups", cbxOpportunityBookPickups.Checked); addCheckbox("OpportunityBookPickupsBranch", cbxOpportunityBookPickupsBranch.Checked); addField("OpportunityBookPickupsBranchName", txtOpportunityBookPickupsBranch.Text); addCheckbox("OpportunityDonationCenter", cbxOpportunityDonationCenter.Checked); addCheckbox("OpportunityDonationCenterTime1", cbxOpportunityDonationCenterTime1.Checked); addCheckbox("OpportunityDonationCenterTime2", cbxOpportunityDonationCenterTime2.Checked); addCheckbox("OpportunityLaureates", cbxOpportunityLaureates.Checked); addCheckbox("OpportunityBookBayFortMason", cbxOpportunityBookBayFortMason.Checked); addCheckbox("OpportunityBookBayMain", cbxOpportunityBookBayMain.Checked); addCheckbox("OpportunityFriendsOffice", cbxOpportunityFriendsOffice.Checked); addCheckbox("OpportunityFriendsOfficeSkill", cbxOpportunityFriendsOfficeSkill.Checked); addField("OpportunityFriendsOfficeSkillOther", txtOpportunityFriendsOfficeSkillOther.Text); addCheckbox("OpportunitySpecialEvents", cbxOpportunitySpecialEvents.Checked); addCheckbox("OpportunitySpecialEventsDaytime", cbxOpportunitySpecialEventsDaytime.Checked); addCheckbox("OpportunitySpecialEventsEvening", cbxOpportunitySpecialEventsEvening.Checked); addCheckbox("OpportunitySpecialEventsWeekend", cbxOpportunitySpecialEventsWeekend.Checked); addCheckbox("OpportunityAdvocacyEfforts", cbxOpportunityAdvocacyEfforts.Checked); addCheckbox("OpportunityBigBookSale", cbxOpportunityBigBookSale.Checked); addCheckbox("OpportunityDollarBookSale", cbxOpportunityDollarBookSale.Checked); addCheckbox("OpportunityDollarBookSaleTime1", cbxOpportunityDollarBookSaleTime1.Checked); addCheckbox("OpportunityDollarBookSaleTime2", cbxOpportunityDollarBookSaleTime2.Checked); addCheckbox("NewsLetter", cbxNewsLetter.Checked); } catch (Exception ex) { sb.AppendFormat("<p>Field Capture EXCEPTION : {0}</p>", ex.ToString()); sb.AppendFormat("<p>Source : {0}</p>", ex.Source); sb.AppendFormat("<p>Message : {0}</p>", ex.Message); sb.AppendFormat("<p>Stack Trace : {0}</p>", ex.StackTrace); } SqlCommand cmd = null; try { cmd = new SqlCommand("dbo.FSFPL_AddVolunteer"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("FirstName", txtFirstName.Text.Trim()); cmd.Parameters.AddWithValue("LastName", txtLastName.Text.Trim()); cmd.Parameters.AddWithValue("Address1", txtAddress1.Text.Trim()); cmd.Parameters.AddWithValue("Address2", txtAddress2.Text.Trim()); cmd.Parameters.AddWithValue("City", txtCity.Text.Trim()); cmd.Parameters.AddWithValue("StateCode", ddlState.SelectedValue); cmd.Parameters.AddWithValue("ZipCode", txtZipCode.Text.Trim()); cmd.Parameters.AddWithValue("HomePhone", txtHomePhone.Text.Trim()); cmd.Parameters.AddWithValue("WorkPhone", ""); cmd.Parameters.AddWithValue("Email", txtEmail.Text.Trim()); cmd.Parameters.AddWithValue("CurrentEmployer", String.Empty); cmd.Parameters.AddWithValue("LocalLibrary", txtLocalLibrary.Text.Trim()); cmd.Parameters.AddWithValue("EmergencyContact", String.Empty); cmd.Parameters.AddWithValue("EmergencyContactPhone", String.Empty); //cmd.Parameters.AddWithValue("AvailableTypeIdList", String.Empty); //cmd.Parameters.AddWithValue("SkillsTypeIdList", String.Empty); //cmd.Parameters.AddWithValue("OtherInterests", String.Empty); //cmd.Parameters.AddWithValue("VolunteerTypeIdList", String.Empty); cmd.Parameters.AddWithValue("OpportunityStepSale", cbxOpportunityStepSale.Checked); // added Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityStepSaleTime1", cbxOpportunityStepSaleTime1.Checked); // new cmd.Parameters.AddWithValue("OpportunityStepSaleTime2", cbxOpportunityStepSaleTime2.Checked); // new cmd.Parameters.AddWithValue("OpportunityBookPickups", cbxOpportunityBookPickups.Checked); cmd.Parameters.AddWithValue("OpportunityBookPickupsBranch", cbxOpportunityBookPickupsBranch.Checked); cmd.Parameters.AddWithValue("OpportunityBookPickupsBranchName", txtOpportunityBookPickupsBranch.Text); cmd.Parameters.AddWithValue("OpportunityDonationCenter", cbxOpportunityDonationCenter.Checked); // added Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityDonationCenterTime1", cbxOpportunityDonationCenterTime1.Checked); // new cmd.Parameters.AddWithValue("OpportunityDonationCenterTime2", cbxOpportunityDonationCenterTime2.Checked); // new // removed Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityDonationCenterFortMason", false); // cbxOpportunityDonationCenterFortMason.Checked cmd.Parameters.AddWithValue("OpportunityNLC", false); //cbxOpportunityNLC.Checked // removed May 15, 2009 // restored Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityLaureates", cbxOpportunityLaureates.Checked); cmd.Parameters.AddWithValue("OpportunityBookBayFortMason", cbxOpportunityBookBayFortMason.Checked); // removed Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteered", false); //cbxOpportunityBookBayFortMasonVolunteered.Checked cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteeredDay", ""); //txtOpportunityBookBayFortMasonVolunteeredDay.Text cmd.Parameters.AddWithValue("OpportunityBookBayFortMasonVolunteeredTime", ""); //txtOpportunityBookBayFortMasonVolunteeredTime.Text cmd.Parameters.AddWithValue("OpportunityBookBayMain", cbxOpportunityBookBayMain.Checked); // removed Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteered", false); //cbxOpportunityBookBayMainVolunteered.Checked cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteeredDay", ""); //txtOpportunityBookBayMainVolunteeredDay.Text cmd.Parameters.AddWithValue("OpportunityBookBayMainVolunteeredTime", ""); //txtOpportunityBookBayMainVolunteeredTime.Text cmd.Parameters.AddWithValue("OpportunityFriendsOffice", cbxOpportunityFriendsOffice.Checked); // added Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityFriendsOfficeSkill", cbxOpportunityFriendsOfficeSkill.Checked); // new cmd.Parameters.AddWithValue("OpportunityFriendsOfficeSkillOther", txtOpportunityFriendsOfficeSkillOther.Text); // new cmd.Parameters.AddWithValue("OpportunitySpecialEvents", cbxOpportunitySpecialEvents.Checked); // added Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunitySpecialEventsDaytime", cbxOpportunitySpecialEventsDaytime.Checked); // new cmd.Parameters.AddWithValue("OpportunitySpecialEventsEvening", cbxOpportunitySpecialEventsEvening.Checked); // new cmd.Parameters.AddWithValue("OpportunitySpecialEventsWeekend", cbxOpportunitySpecialEventsWeekend.Checked); // new cmd.Parameters.AddWithValue("OpportunityAdvocacyEfforts", cbxOpportunityAdvocacyEfforts.Checked); // added May 15, 2009 // removed Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityMission2009", false); //cbxOpportunityMission2009.Checked cmd.Parameters.AddWithValue("OpportunityBigBookSale", cbxOpportunityBigBookSale.Checked); // added Dec 2, 2009 cmd.Parameters.AddWithValue("OpportunityDollarBookSale", cbxOpportunityDollarBookSale.Checked); // new cmd.Parameters.AddWithValue("OpportunityDollarBookSaleTime1", cbxOpportunityDollarBookSaleTime1.Checked); // new cmd.Parameters.AddWithValue("OpportunityDollarBookSaleTime2", cbxOpportunityDollarBookSaleTime2.Checked); // new cmd.Parameters.AddWithValue("NewsLetter", cbxNewsLetter.Checked); SqlParameter param = new SqlParameter("Id", SqlDbType.Int); param.Size = 8; param.Direction = ParameterDirection.Output; cmd.Parameters.Add(param); cmd.Connection = new SqlConnection(WebConfigurationManager.ConnectionStrings["FSFPL"].ConnectionString); cmd.Connection.Open(); cmd.ExecuteNonQuery(); newID = (int)cmd.Parameters["Id"].Value; sb.AppendFormat("<p>FSFPL_Volunteer added, ID : {0}</p>", newID); try { VolunteerDA DA = new VolunteerDA(); StringBuilder sbEmailBody = DA.GetEmailBody(newID, Server.MapPath(MailUtil.VolunteerTemplate)); MailUtil.SendVolunteerEmail(txtEmail.Text, sbEmailBody); sb.Append("<p>Confirmation Email SUCCESS</p>"); } catch (Exception exEmail1) { sb.AppendFormat("<p>Confirmation Email EXCEPTION : {0}</p>", exEmail1.ToString()); sb.AppendFormat("<p>Source : {0}</p>", exEmail1.Source); sb.AppendFormat("<p>Message : {0}</p>", exEmail1.Message); sb.AppendFormat("<p>Stack Trace : {0}</p>", exEmail1.StackTrace); } try { MailUtil.SendDataGramEmail("Volunteer_Form submitted", sb); } catch (Exception exEmail2) { // ignore } //Response.Redirect(String.Format("/?Confirmation&id={0}&typeid={1}", Server.UrlEncode(Security.Encrypt(newID.ToString())), MailUtil.EmailType.Volunteer.ToString("D")), true); } catch (Exception ex) { sb.AppendFormat("<p>General Exception : {0}</p>", ex.ToString()); sb.AppendFormat("<p>Source : {0}</p>", ex.Source); sb.AppendFormat("<p>Message : {0}</p>", ex.Message); sb.AppendFormat("<p>Stack Trace : {0}</p>", ex.StackTrace); try { MailUtil.SendDataGramEmail("Volunteer_Form EXCEPTION", sb); } catch (Exception exEmail3) { // ignore } throw ex; } finally { if (cmd.Connection != null && cmd.Connection.State == ConnectionState.Open) { cmd.Connection.Close(); } cmd.Dispose(); } Response.Redirect(String.Format("/?Confirmation&id={0}&typeid={1}", Server.UrlEncode(Security.Encrypt(newID.ToString())), MailUtil.EmailType.Volunteer.ToString("D")), true); } }
protected void FormView1_DataBound(object sender, EventArgs e) { Panel panel; HtmlTableRow tr = null; HtmlTableCell td = null; FormView fv = (FormView)sender; DataRowView dv = (DataRowView)fv.DataItem; if (dv != null) { int version = (int)dv["Version"]; switch (version) { case 1 : ShowLegacyVersionPanel(); td = FormView1.FindControl("tdVolunteerInfoV1") as HtmlTableCell; if (td != null) td.Visible = true; tr = FormView1.FindControl("trWorkPhone") as HtmlTableRow; if (tr != null) tr.Visible = true; // show version 1 details tr = FormView1.FindControl("trVolunteerOpportunitiesV1") as HtmlTableRow; if (tr != null) tr.Visible = true; // set checkboxs for "I am Available:" string typeIdList = dv["AvailableTypeIdList"] as string; ArrayList typeIdArray = new ArrayList(typeIdList.Split(',')); CheckBoxList cbxList = FormView1.FindControl("cbxWeekdaysV1") as CheckBoxList; foreach (ListItem item in cbxList.Items) { if (typeIdArray.Contains(item.Value)) { item.Selected = true; } } cbxList = FormView1.FindControl("cbxWeekendsV1") as CheckBoxList; foreach (ListItem item in cbxList.Items) { if (typeIdArray.Contains(item.Value)) { item.Selected = true; } } // set checkboxs for "Special Skills:" typeIdList = dv["SkillsTypeIdList"] as string; typeIdArray = new ArrayList(typeIdList.Split(',')); cbxList = FormView1.FindControl("cbxSkillsV1") as CheckBoxList; foreach (ListItem item in cbxList.Items) { if (typeIdArray.Contains(item.Value)) { item.Selected = true; } } // set checkboxs for "Volunteer Opportunties:" typeIdList = dv["VolunteerTypeIdList"] as string; typeIdArray = new ArrayList(typeIdList.Split(',')); cbxList = FormView1.FindControl("cbxOpportunitiesV1") as CheckBoxList; foreach (ListItem item in cbxList.Items) { if (typeIdArray.Contains(item.Value)) { item.Selected = true; } } break; case 2 : ShowLegacyVersionPanel(); tr = FormView1.FindControl("trVolunteerOpportunitiesV2") as HtmlTableRow; if (tr != null) tr.Visible = true; break; case 3 : ShowLegacyVersionPanel(); tr = FormView1.FindControl("trVolunteerOpportunitiesV3") as HtmlTableRow; if (tr != null) tr.Visible = true; if ((bool)dv["OpportunityStepSaleTime1"] || (bool)dv["OpportunityStepSaleTime2"]) { panel = FormView1.FindControl("pnlOpportunityStepSaleV3") as Panel; panel.Visible = true; } if ((bool)dv["OpportunityDonationCenterTime1"] || (bool)dv["OpportunityDonationCenterTime2"]) { panel = FormView1.FindControl("pnlOpportunityDonationCenterV3") as Panel; panel.Visible = true; } if ((bool)dv["OpportunityDollarBookSaleTime1"] || (bool)dv["OpportunityDollarBookSaleTime2"]) { panel = FormView1.FindControl("pnlOpportunityDollarBookSale") as Panel; panel.Visible = true; } break; case 2011: int id = (int)dv["Id"]; VolunteerDA DA = new VolunteerDA(); StringBuilder sb = DA.GetEmailBody(id, Server.MapPath(MailUtil.VolunteerInfoTemplate)); Literal litCurrentInfo = FormView1.FindControl("litCurrentInfo") as Literal; litCurrentInfo.Text = sb.ToString(); break; } } }
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; } } } } }