protected void btnUpdateStatus_OnClick(object sender, EventArgs e) { DataSet dsChangeDetails = objCamperApplication.GetChangeRequestDetails(strFJCID); structChangeDetails ChangeDetails = new structChangeDetails(); string strReason = txtareaUpdateComments.Text; if (!string.IsNullOrEmpty(strReason)) { if (dsChangeDetails.Tables[0].Rows.Count > 0) { ChangeDetails = objCamperApplication.SetChangeDetailsFromDataRow(dsChangeDetails.Tables[0].Rows[0]); } if (ddlRequestStatus.SelectedValue == Enum.Format(typeof(RequestStatus), RequestStatus.ClosedOrApproved, "D")) { if (sessionModifiedPenFJCApprovalStatus == ChangeDetails.Current_Status.ToString()) { string strNewFJCID = string.Empty; string answers = ConstructCamperAnswers(ChangeDetails.NewSession, ChangeDetails.NewSession_StartDate, ChangeDetails.NewSession_EndDate); objCamperApplication.CopyCamperApplicationForSessionChange(strFJCID, out strNewFJCID, Int32.Parse(secApprovalStatus), Convert.ToInt32(sessionModifiedCreditPending)); Session["FJCID"] = strNewFJCID; objCamperApplication.InsertCamperAnswers(strNewFJCID, answers, iUserID.ToString(), strReason); objCamperApplication.UpdateDetailsOnRequestType(strFJCID, strNewFJCID, ChangeDetails.RequestID, "", "Old application cancelled and new application created with second approval status", iUserID, null, null, Int32.Parse(Enum.Format(typeof(RequestStatus), RequestStatus.ClosedOrApproved, "D"))); } else if (cancellationPendingApprovalStatus == ChangeDetails.Current_Status.ToString()) { string strNewFJCID = string.Empty; objCamperApplication.UpdateStatus(strFJCID, Int32.Parse(cancellationPaymentCreditPending), strReason, iUserID); objCamperApplication.UpdateDetailsOnRequestType(strFJCID, string.Empty, ChangeDetails.RequestID, "", "Cancellation request approved and the payment will be applied for credit.", iUserID, null, null, Int32.Parse(Enum.Format(typeof(RequestStatus), RequestStatus.ClosedOrApproved, "D"))); } } else if (ddlRequestStatus.SelectedValue == Enum.Format(typeof(RequestStatus), RequestStatus.Rejected, "D")) { string strCamperAnswers = string.Empty; if (ChangeDetails.RequestType == 2) { strCamperAnswers = ConstructCamperAnswers(ChangeDetails.OldSession, ChangeDetails.OldSession_StartDate, ChangeDetails.OldSession_EndDate); } objCamperApplication.UpdateDetailsOnRequestType(strFJCID, string.Empty, ChangeDetails.RequestID, strCamperAnswers, string.Empty, iUserID, null, null, Int32.Parse(Enum.Format(typeof(RequestStatus), RequestStatus.Rejected, "D"))); } valobj.InnerHtml = ""; spnComments.Visible = false; string strMessage = ddlRequestStatus.SelectedValue == "3" ? "Request has been approved." : "Request has been rejected."; strScript = "<script language=javascript>" + (strMessage != string.Empty ? "alert('" + strMessage + "');" : string.Empty) + "window.opener.location.href = window.opener.location.href;" + "if (window.opener.progressWindow)" + "{ window.opener.progressWindow.close()" + "} window.close();</script>"; if (!ClientScript.IsStartupScriptRegistered("clientScript")) { ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strScript); } } else { valobj.InnerHtml = "<ul><li>Please enter comments</li></ul>"; spnComments.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { objCamperApplication = new CamperApplication(); structChangeDetails changeDetails = new structChangeDetails(); string campYearId = null; valobj.InnerHtml = string.Empty; pnlUpdateStatus.Visible = pnlNewRequest.Visible = false; bool error = false; if (Session["UsrID"] != null) { if (Session["FJCID"] != null) { strFJCID = Session["FJCID"].ToString(); if (!IsPostBack) { ExisitingDetailsDataBind(strFJCID, changeDetails, false); changeDetails = new structChangeDetails(); DataSet dsChangeDetails = objCamperApplication.GetChangeRequestDetails(strFJCID); if (dsChangeDetails.Tables[0].Rows.Count > 0) { foreach (DataRow dr in dsChangeDetails.Tables[0].Rows) { changeDetails = objCamperApplication.SetChangeDetailsFromDataRow(dr); hdnRequestID.Value = changeDetails.RequestID.ToString(); SetControlValues(changeDetails); hdnRequestStatus.Value = changeDetails.RequestStatus.ToString(); if (changeDetails.RequestStatus == 3 || changeDetails.RequestStatus == 2) { lnkBtnNewRequest.Visible = true; } else { lnkBtnNewRequest.Visible = false; } } } } GetRequestUserDetails(Session["UsrID"].ToString()); imgbtnCalStartDt.Attributes.Add("onclick", "return ShowCalendar('" + txtNewStartDate.ClientID + "');"); imgbtnCalEndDt.Attributes.Add("onclick", "return ShowCalendar('" + txtNewEndDate.ClientID + "');"); if (hdnRequestStatus.Value != "0" && !String.IsNullOrEmpty(hdnRequestStatus.Value)) { pnlForm.Enabled = false; } else { pnlForm.Enabled = true; } if (iUserRole.ToString() == FJCAdminUserRole && hdnRequestStatus.Value == "1") { pnlUpdateStatus.Visible = ddlRequestStatus.Enabled = btnUpdateStatus.Enabled = pnlUpdateStatus.Enabled = true; } if (iUserRole.ToString() == FEDAdminUserRole && hdnNewRequest.Value != "1" && (hdnRequestStatus.Value == "2" || hdnRequestStatus.Value == "3")) { pnlNewRequest.Visible = lnkBtnNewRequest.Enabled = true; } pnlComments.Visible = false; rfvComments.Enabled = false; //added by sreevani to display calender according to session year. campYearId = objCamperApplication.getCampYearId(strFJCID); string campyear = Application["CampYear"].ToString(); CampStartDate = ConfigurationManager.AppSettings["CampSessionStartMonth"] + "/01/" + campyear; hdnCampSessionStartDate.Value = DateTime.Parse(CampStartDate).AddDays(-1.0).ToShortDateString(); CampEndDate = ConfigurationManager.AppSettings["CampSessionEndMonth"] + "/01/" + campyear; hdnCampSessionEndDate.Value = DateTime.Parse(CampEndDate).AddMonths(1).ToShortDateString(); hdncampSeasonErrorMessage.Value = "Choose camp session between " + DateTime.Parse(CampStartDate).ToShortDateString() + " and " + DateTime.Parse(CampEndDate).AddMonths(1).AddDays(-1.0).ToShortDateString(); } else { error = true; } } else { error = true; } if (error) { strScript = "<script language=javascript>alert('Error occured please try again!'); window.opener.location.href = window.opener.location.href;" + "if (window.opener.progressWindow)" + "{ window.opener.progressWindow.close()" + "} window.close();</script>"; if (!ClientScript.IsStartupScriptRegistered("clientScript")) { ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strScript); } } if (pnlForm.Enabled) { btnSaveExit.Attributes.Add("onclick", "JavaScript:return ValidateForm(0);false;"); btnSubmit.Attributes.Add("onclick", "JavaScript:return ValidateForm(1);false;"); } }
private void EnableChangeCancelRequestButton(string strRole) { DataSet dsCamprDetails = GetValues(); _objCamperApp = new CamperApplication(); int requestType = -1; int requestStatus = -1; if (dsCamprDetails.Tables[0].Rows.Count > 0) { DataSet dsChangeRequestDetail = _objCamperApp.GetChangeRequestDetails(dsCamprDetails.Tables[0].Rows[0]["FJCID"].ToString()); if (dsChangeRequestDetail.Tables[0].Rows.Count > 0) { DataRow dr = dsChangeRequestDetail.Tables[0].Rows[0]; int requestTypeFromDB = Int32.Parse(dr["RequestType"].ToString()); int requestStatusFromDB = Int32.Parse(dr["RequestStatus"].ToString()); requestType = Int32.TryParse(dr["RequestType"].ToString(), out requestType) ? requestTypeFromDB : -1; requestStatus = Int32.TryParse(dr["RequestStatus"].ToString(), out requestStatus) ? requestStatusFromDB : -1; if (requestType != -1 && (requestStatus != (int)RequestStatus.Rejected && requestStatus != (int)RequestStatus.ClosedOrApproved)) { ddlAdjustmentType.SelectedValue = requestType.ToString(); } } if ((strRole == strFedAdmin) || (strRole == strCampDir) || (strRole == strFJCAdmin)) { if (requestStatus == (int)RequestStatus.Submitted) { btnViewCancelChangeRequest.Visible = true; btnViewCancelChangeRequest.Value = "View " + (requestType == 2 ? "Change" : "Cancel") + " Request"; btnCancelChangeRequest.Visible = false; ddlAdjustmentType.Visible = false; } else { if (ddlStatus.SelectedValue == CamperAppStatus.CamperDeclinedToGoToCamp.ToString()) { btnViewCancelChangeRequest.Visible = true; btnCancelChangeRequest.Visible = false; ddlAdjustmentType.Visible = false; } else { btnViewCancelChangeRequest.Visible = false; btnCancelChangeRequest.Visible = true; ddlAdjustmentType.Visible = true; } } } else if ((requestStatus != -1) && (strRole == strFJCAdmin) && (requestStatus > 0)) { btnViewCancelChangeRequest.Visible = true; btnViewCancelChangeRequest.Value = "View " + (requestType == 2 ? "Change" : "Cancel") + " Request"; btnCancelChangeRequest.Visible = false; ddlAdjustmentType.Visible = false; } } else { btnCancelChangeRequest.Visible = false; btnViewCancelChangeRequest.Visible = false; ddlAdjustmentType.Visible = false; } }