public void bindYearOfGradRecs(string campId, int pageIndex, string fillflag) { string sortdir = (fillflag == "sort" ? GetSortDirection() : GridViewSortDirection); Campaign objCampaign = new Campaign(ConnectionString); DataTable yearOfGradRecs = objCampaign.getCampaignRptByYearofGrade(ConnectionString, campId, "GradYear_4Bytes", GridSortExpression, sortdir, pageIndex, 10, out rowCount); RGridYearOfGradRecs.CurrentPageIndex = pageIndex; RGridYearOfGradRecs.VirtualItemCount = rowCount; RGridYearOfGradRecs.DataSource = yearOfGradRecs; RGridYearOfGradRecs.DataBind(); GridPrevSortExpression = GridSortExpression; }
protected void lbtnDownload_Click(object sender, EventArgs e) { Export Export = new Export("Web"); DataTable dtexportTable = null; Campaign objCampaign = new Campaign(ConnectionString); if (ddlCampaignsNames.SelectedItem.Text != defaultCampItem) { if (Session["AdvCampId"] != null && Session["AdvCampId"].ToString() != string.Empty) { if (rtsCampaigndemographic.SelectedIndex == 0) // Year Of Grad { bindYearOfGradRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByYearofGrade(ConnectionString, Session["AdvCampId"].ToString(), "GradYear_4Bytes", "Year", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "YearGrade.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 1) //Majors { bindAcademicInterestRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByMajors(ConnectionString, Session["AdvCampId"].ToString(), "Selected_MajorCodeDescription", "Name", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "Majors.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 2) //Soucecode { bindSourceCodeRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptBySourceCode(ConnectionString, Session["AdvCampId"].ToString(), "SourceCode", "SourceCode", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "SourceCode.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 3) //Ethnicity { bindEthnicityRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByEthnicity(ConnectionString, Session["AdvCampId"].ToString(), "Ethnicity", "Ethnicity", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "Ethnicity.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 4) //State { bindStateRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByState(ConnectionString, Session["AdvCampId"].ToString(), "UniqueEmailClicks", "desc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "State.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 5) // Engagment { bindEngagmentRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getAllMailingLinkUrlsByCampaign(ConnectionString, Session["AdvCampId"].ToString(), "Clicks", "desc"); //dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "Engagment.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 6) // LetterVersion { bindLetterVersionRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByLetterVersion(ConnectionString, Session["AdvCampId"].ToString(), "LetterVersion", "LetterVersion", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "LetterVersion.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 7) // Gender { bindGenderRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptByGender(ConnectionString, Session["AdvCampId"].ToString(), "Gender", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "Gender.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } if (rtsCampaigndemographic.SelectedIndex == 8) // HighSchoolName { bindSchoolRecs(Session["AdvCampId"].ToString(), 0,""); if (Session["AdvCampId"] != null) { dtexportTable = objCampaign.getCampaignRptBySchool(ConnectionString, Session["AdvCampId"].ToString(), "HighSchoolName", "HighSchoolName", "asc", 0, rowCount, out rowCount); dtexportTable.Columns.Remove("RowRank"); } if (dtexportTable.Rows.Count != 0) Export.ExportDetails(dtexportTable, Export.ExportFormat.CSV, "HighSchoolName.csv"); else ScriptManager.RegisterStartupScript(Page, Page.GetType(), "Success", "alert('No Records to Download.')", true); } } } 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 }