public void bindLetterVersionRecs(string mailinName, int pageIndex) { Campaign objCampaign = new Campaign(ConnectionString); DataTable letterVersionRecs = objCampaign.getMailingRptByLetterVersion(ConnectionString, mailinName, "LetterVersion", SortExpression.ToString(), ViewState["SortDirection"].ToString(), pageIndex, 10, out rowCount); RadGridLetterVersionRecs.CurrentPageIndex = pageIndex; RadGridLetterVersionRecs.VirtualItemCount = rowCount; RadGridLetterVersionRecs.DataSource = letterVersionRecs; RadGridLetterVersionRecs.DataBind(); }
protected void lbtnDownload_Click(object sender, EventArgs e) { if (Session["AdvMailingName"] != null && Session["AdvMailingName"].ToString().Length != 0) { Export Export = new Export("Web"); DataTable exportTable = null; Campaign objCampaign = new Campaign(ConnectionString); string mailinName = Session["AdvMailingName"].ToString(); if (rtsMailingDemographic.SelectedIndex == 0) // Year Of Grad { exportTable = objCampaign.getMailingRptByYearofGrade(ConnectionString, mailinName, "GradYear_4Bytes", "Year", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 1) //Majors { exportTable = objCampaign.getMailingRptByMajors(ConnectionString, mailinName, "Selected_MajorCodeDescription", "Name", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 2) //Soucecode { exportTable = objCampaign.getMailingRptBySourceCode(ConnectionString, mailinName, "SourceCode", "SourceCode", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 3) //Ethnicity { exportTable = objCampaign.getMailingRptByEthnicity(ConnectionString, mailinName, "Ethnicity", "Ethnicity", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 4) //State { exportTable = objCampaign.getMailingRptByState(ConnectionString, mailinName, "State", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 5) // Engagment { exportTable = objCampaign.getAllMailingLinkUrls(ConnectionString, mailinName, "Clicks", "desc"); } if (rtsMailingDemographic.SelectedIndex == 6) // LetterVersion { exportTable = objCampaign.getMailingRptByLetterVersion(ConnectionString, mailinName, "LetterVersion", "LetterVersion", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 7) // Gender { exportTable = objCampaign.getMailingRptByGender(ConnectionString, mailinName, "Gender", "asc", 0, rowCount, out rowCount); } if (rtsMailingDemographic.SelectedIndex == 8) // HighSchoolName { exportTable = objCampaign.getMailingRptBySchool(ConnectionString, mailinName, "HighSchoolName", "HighSchoolName", "asc", 0, rowCount, out rowCount); } if (exportTable.Rows.Count != 0) { if (exportTable.Columns.Contains("RowRank")) exportTable.Columns.Remove("RowRank"); Export.ExportDetails(exportTable, Export.ExportFormat.CSV, rtsMailingDemographic.SelectedTab.Text.Trim() + ".csv"); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } }
public void MailingRecords() { #region Mailing Demographics if (Request.QueryString["Page"].ToLower() == "yearsofgrade") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable yearOfGradRecs = objCampaign.getMailingRptByYearofGrade(ConnectionString, titleName, "GradYear_4Bytes", "Year", "ASC", 0, rowCount, out rowCount); yearOfGradRecs.Columns.Remove("RowRank"); if (yearOfGradRecs.Rows.Count != 0) { gvPrint.DataSource = yearOfGradRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Years of Grad"; } if (Request.QueryString["Page"].ToLower() == "major") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable academicRecs = objCampaign.getMailingRptByMajors(ConnectionString, titleName, "Selected_MajorCodeDescription", "Name", "ASC", 0, rowCount, out rowCount); academicRecs.Columns.Remove("RowRank"); if (academicRecs.Rows.Count != 0) { gvPrint.DataSource = academicRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Major"; } if (Request.QueryString["Page"].ToLower() == "sourcecode") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable sourceCodeRecs = objCampaign.getMailingRptBySourceCode(ConnectionString, titleName, "SourceCode", "SourceCode", "ASC", 0, rowCount, out rowCount); sourceCodeRecs.Columns.Remove("RowRank"); if (sourceCodeRecs.Rows.Count != 0) { gvPrint.DataSource = sourceCodeRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Source Code"; } if (Request.QueryString["Page"].ToLower() == "ethnicity") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable ethnicityRecs = objCampaign.getMailingRptByEthnicity(ConnectionString, titleName, "Ethnicity", "Ethnicity", "ASC", 0, rowCount, out rowCount); ethnicityRecs.Columns.Remove("RowRank"); if (ethnicityRecs.Rows.Count != 0) { gvPrint.DataSource = ethnicityRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Ethnicity"; } if (Request.QueryString["Page"].ToLower() == "state") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable stateRecs = objCampaign.getMailingRptByState(ConnectionString, titleName, "state", "ASC", 0, rowCount, out rowCount); stateRecs.Columns.Remove("RowRank"); if (stateRecs.Rows.Count != 0) { gvPrint.DataSource = stateRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "State"; } if (Request.QueryString["Page"].ToLower() == "engagment") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable EngagLinkUrls = objCampaign.getAllMailingLinkUrls(ConnectionString, titleName, "Clicks", "ASC"); if (EngagLinkUrls.Rows.Count != 0) { gvPrint.DataSource = EngagLinkUrls.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Engagement"; } if (Request.QueryString["Page"].ToLower() == "letterversion") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable letterVersionRecs = objCampaign.getMailingRptByLetterVersion(ConnectionString, titleName, "LetterVersion", "LetterVersion", "ASC", 0, rowCount, out rowCount); letterVersionRecs.Columns.Remove("RowRank"); if (letterVersionRecs.Rows.Count != 0) { gvPrint.DataSource = letterVersionRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Letter Version"; } if (Request.QueryString["Page"].ToLower() == "gender") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable genderRecs = objCampaign.getMailingRptByGender(ConnectionString, titleName, "Gender", "ASC", 0, rowCount, out rowCount); genderRecs.Columns.Remove("RowRank"); if (genderRecs.Rows.Count != 0) { gvPrint.DataSource = genderRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Gender"; } if (Request.QueryString["Page"].ToLower() == "highschoolname") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable schoolRecs = objCampaign.getMailingRptBySchool(ConnectionString, titleName, "HighSchoolName", "HighSchoolName", "ASC", 0, rowCount, out rowCount); schoolRecs.Columns.Remove("RowRank"); if (schoolRecs.Rows.Count != 0) { gvPrint.DataSource = schoolRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "High School Name"; } #endregion #region Mailing Details if (Request.QueryString["Page"].ToLower() == "totalcontacted") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; string MailingID = Request.QueryString["MailingId"] != null ? Request.QueryString["MailingId"] : string.Empty; DataTable ListSuccessfulDelivered = null; ListSuccessfulDelivered = ContactMaster.SelectSuccessfulDeliveredByCampId_PageWise(ConnectionString, MailingID, "ContactId", "desc", 0, rowCount, out rowCount); if (ListSuccessfulDelivered.Rows.Count != 0) { gvPrint.DataSource = ListSuccessfulDelivered.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Total Contacted"; } if (Request.QueryString["Page"].ToLower() == "uniqueemailopens") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; string MailingID = Request.QueryString["MailingId"] != null ? Request.QueryString["MailingId"] : string.Empty; DataTable ContactsMailOpened = null; ContactsMailOpened = ContactMaster.EmailOpendRecByCampId_PageWise(ConnectionString, MailingID, "ContactId", "desc", 0, rowCount, out rowCount, out TotalOpenCounts, out UniqueOpenCounts); if (ContactsMailOpened.Rows.Count != 0) { gvPrint.DataSource = ContactsMailOpened.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Unique Email Opens"; } if (Request.QueryString["Page"].ToLower() == "uniqueemailclicks") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; string MailingID = Request.QueryString["MailingId"] != null ? Request.QueryString["MailingId"] : string.Empty; DataTable ContactsMailClicked = null; ContactsMailClicked = ContactMaster.EmailClickedRecByCampId_PageWise(ConnectionString, MailingID, "ContactId", "desc", 0, rowCount, out rowCount, out TotalClickCounts, out UniqueClickCounts); if (ContactsMailClicked.Rows.Count != 0) { gvPrint.DataSource = ContactsMailClicked.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Unique Email Clicks"; } if (Request.QueryString["Page"].ToLower() == "uniqueformsubmits") { titleName = (Session["AdvMailingName"] != null) ? Session["AdvMailingName"].ToString() : string.Empty; string MailingID = Request.QueryString["MailingId"] != null ? Request.QueryString["MailingId"] : string.Empty; DataTable ContactsMailClicked = ContactMaster.EmailWheelockClickedRecByCampId_PageWise(ConnectionString, MailingID, "ContactId", "desc", 0, rowCount, out rowCount); // ContactsMailClicked.Columns.Remove("RowRank"); if (ContactsMailClicked.Rows.Count != 0) { gvPrint.DataSource = ContactsMailClicked.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Mailing:" + ' ' + titleName + ':' + ' ' + "Unique Form Submits"; } #endregion #region Campaign Demographics if (Request.QueryString["Page"].ToLower() == "camp_yearsofgrade") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable yearOfGradRecs = objCampaign.getCampaignRptByYearofGrade(ConnectionString, CampId, "GradYear_4Bytes", "Year", "desc", 0, rowCount, out rowCount); yearOfGradRecs.Columns.Remove("RowRank"); if (yearOfGradRecs.Rows.Count != 0) { gvPrint.DataSource = yearOfGradRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Years of Grad"; } if (Request.QueryString["Page"].ToLower() == "camp_major") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string campId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable academicRecs = objCampaign.getCampaignRptByMajors(ConnectionString, campId, "Selected_MajorCodeDescription", "Name", "desc", 0, rowCount, out rowCount); academicRecs.Columns.Remove("RowRank"); if (academicRecs.Rows.Count != 0) { gvPrint.DataSource = academicRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Major"; } if (Request.QueryString["Page"].ToLower() == "camp_sourcecode") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable sourceCodeRecs = objCampaign.getCampaignRptBySourceCode(ConnectionString, CampId, "SourceCode", "SourceCode", "desc", 0, rowCount, out rowCount); sourceCodeRecs.Columns.Remove("RowRank"); if (sourceCodeRecs.Rows.Count != 0) { gvPrint.DataSource = sourceCodeRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Source Code"; } if (Request.QueryString["Page"].ToLower() == "camp_ethnicity") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable ethnicityRecs = objCampaign.getCampaignRptByEthnicity(ConnectionString, CampId, "Ethnicity", "Ethnicity", "desc", 0, rowCount, out rowCount); ethnicityRecs.Columns.Remove("RowRank"); if (ethnicityRecs.Rows.Count != 0) { gvPrint.DataSource = ethnicityRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Ethnicity"; } if (Request.QueryString["Page"].ToLower() == "camp_state") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable stateRecs = objCampaign.getCampaignRptByState(ConnectionString, CampId, "state", "desc", 0, rowCount, out rowCount); stateRecs.Columns.Remove("RowRank"); if (stateRecs.Rows.Count != 0) { gvPrint.DataSource = stateRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "State"; } if (Request.QueryString["Page"].ToLower() == "camp_engagment") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable EngagLinkUrls = objCampaign.getAllMailingLinkUrlsByCampaign(ConnectionString, CampId, "Clicks", "desc"); if (EngagLinkUrls.Rows.Count != 0) { gvPrint.DataSource = EngagLinkUrls.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Engagement"; } if (Request.QueryString["Page"].ToLower() == "camp_letterversion") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable letterVersionRecs = objCampaign.getCampaignRptByLetterVersion(ConnectionString, CampId, "LetterVersion", "LetterVersion", "desc", 0, rowCount, out rowCount); letterVersionRecs.Columns.Remove("RowRank"); if (letterVersionRecs.Rows.Count != 0) { gvPrint.DataSource = letterVersionRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Letter Version"; } if (Request.QueryString["Page"].ToLower() == "camp_gender") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable genderRecs = objCampaign.getCampaignRptByGender(ConnectionString, CampId, "Gender", "desc", 0, rowCount, out rowCount); genderRecs.Columns.Remove("RowRank"); if (genderRecs.Rows.Count != 0) { gvPrint.DataSource = genderRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "Gender"; } if (Request.QueryString["Page"].ToLower() == "camp_highschoolname") { titleName = (Session["AdvCampName"] != null) ? Session["AdvCampName"].ToString() : string.Empty; string CampId = (Session["AdvCampId"] != null) ? Session["AdvCampId"].ToString() : string.Empty; Campaign objCampaign = new Campaign(ConnectionString); DataTable schoolRecs = objCampaign.getCampaignRptBySchool(ConnectionString, CampId, "HighSchoolName", "HighSchoolName", "desc", 0, rowCount, out rowCount); schoolRecs.Columns.Remove("RowRank"); if (schoolRecs.Rows.Count != 0) { gvPrint.DataSource = schoolRecs.DefaultView; gvPrint.DataBind(); } else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Print.')", true); lblTitle.Text = "Campaign:" + ' ' + titleName + ':' + ' ' + "High School Name"; } #endregion }