protected void btnSubmit_Click(object sender, EventArgs e) { string strMode = rdbtnlstMode.SelectedItem.Value; lblMode.Text = strMode == "1" ? "Final" : "Prelimary"; // 2013-07-30 Seth asked to generate second time camper's list for survey purpose string type = ""; if (rdoFirstTime.Checked) { type = "FirstTimer"; } else { type = "SecondTimer"; } if (strMode == "0") //Preliminary Mode { dsANReportCampers = GetAnReportCampers(ddlRecCount.SelectedValue, Application["CampYear"].ToString(), 0, type); //grdANReport.DataSource = UpdateDays(dsANReportCampers.Tables[0]);//Wil calculate no. of days from startdate and enddate columns grdANReport.DataSource = dsANReportCampers.Tables[0]; grdANReport.PageIndex = 0; grdANReport.DataBind(); ddlRecCount.Enabled = false; Session["ANReportID"] = "0"; } else if (strMode == "1" && chkFinal.Checked)//Final Mode { dsANReportCampers = _objCamperApplication.RunFinalMode(Application["CampYear"].ToString(), type); //grdANReport.DataSource = UpdateDays(dsANReportCampers.Tables[0]);//Wil calculate no. of days from startdate and enddate columns grdANReport.DataSource = dsANReportCampers.Tables[0]; grdANReport.PageIndex = 0; grdANReport.DataBind(); ddlRecCount.Enabled = true; string strFolder = Request.MapPath(ConfigurationManager.AppSettings["AwardNotificationFolderPath"], Request.ApplicationPath, false); string strANReportID = string.Empty; if (dsANReportCampers.Tables[1].Rows.Count > 0) { strANReportID = dsANReportCampers.Tables[1].Rows[0]["ANReportID"].ToString(); Session["ANReportID"] = String.IsNullOrEmpty(strANReportID) ? "0" : strANReportID; } if (Directory.Exists(strFolder)) { ProcessFile(strFolder, strANReportID); } else { Directory.CreateDirectory(strFolder); ProcessFile(strFolder, strANReportID); } } lblNoOfRecords.Text = dsANReportCampers.Tables[0].Rows.Count.ToString(); int cntPreANRecords = _objCamperApplication.GetExistingCountOfANPremilinaryRecords(Application["CampYear"].ToString()); if (cntPreANRecords > 0 && strMode == "0" && ddlRecCount.Enabled) { lblMessage.Visible = true; lblMessage.Text = "Note: There are already " + cntPreANRecords.ToString() + " camper applications which are in premiliminary mode, untill these records are run in final mode you cannot change the no. of records you want to view."; ddlRecCount.Enabled = false; } else if (cntPreANRecords == 0 && strMode == "0") { lblMessage.Visible = true; lblMessage.Text = "Note: There are no campers with payment request status, please try running the preliminary mode later."; } else if (cntPreANRecords == 0 && strMode == "1" && dsANReportCampers.Tables[0].Rows.Count <= 0) { lblMessage.Visible = true; lblMessage.Text = "Note: There are no records in preliminary mode, please run the report in preliminary mode by selecting the mode option provided above."; } if (pnlFinal.Visible) { pnlFinal.Visible = false; } lblReqTime.Text = DateTime.Now.ToString(); tblReportDetails.Visible = grdANReport.Visible = true; }