Beispiel #1
0
    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;
        }
    }
Beispiel #2
0
    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;");
        }
    }