예제 #1
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        _objCamperApp = new CamperApplication();
        string strRole     = (string)Session["RoleID"];
        string strFJCAdmin = ConfigurationManager.AppSettings["FJCADMIN"];
        string strFedAdmin = ConfigurationManager.AppSettings["FEDADMIN"];
        string strCampDir  = ConfigurationManager.AppSettings["CAMPDIRECTOR"];
        string strApprover = ConfigurationManager.AppSettings["APPROVER"];
        int    iStatus;
        bool   blnCampUpdated     = false;
        bool   blnStatusUpdated   = false;
        bool   blnDaysUpdated     = false;
        bool   blnAmtUpdated      = false;
        bool   blnWorkQueue       = false;
        bool   blnCampYearUpdated = false;

        ///A-057 - When an FJC admin or a Federation admin tries to select the status "Eligible by Staff" in the camnper summary,
        ///the system should check to see whether or not a camp and session start/end dates have been selected.
        ///If all of this data has been selected, the system should allow the state transition.
        ///If any of this data is missing, the system should display a msg indicating that this data must first be supplied,
        ///and the transistion should be state rejected returned back to the previous state)
        if (Convert.ToInt32(ddlStatus.SelectedItem.Value) == 7)
        {
            if (!CampDaysExist())
            {
                lblErr.Font.Bold = true;
                lblErr.Text      = "Please open the camper application (Federation Questionnaire) and make sure that a camp" +
                                   " has been selected and that the session start and end dates have been provided before selecting" +
                                   " the Eligible by Staff status. You will not be able to change the status to Eligible by Staff if the camper application" +
                                   " lacks camp and session date selections. You can also select the Under Review status if you are not prepared to supply" +
                                   " the required information at this time.";

                try
                {
                    ddlStatus.SelectedValue = hdnStatus.Value;
                }
                catch { }

                return;
            }
            else
            {
                lblErr.Text = "";
            }
        }



        //If Role is Camp Director, update Status and/or Days
        if (strRole == strCampDir)
        {
            //blnDaysUpdated = UpdateDays();
            iStatus          = Convert.ToInt32(ddlStatus.SelectedItem.Value);
            blnStatusUpdated = UpdateStatus(iStatus);
        }

        //If Role is Fed Admin or FJC Admin, update Status and/or Camp and/or Amount
        else if (strRole == strFedAdmin)
        {
            iStatus          = Convert.ToInt32(ddlStatus.SelectedItem.Value);
            blnStatusUpdated = UpdateStatus(iStatus);
            blnCampUpdated   = UpdateCamp();
            blnAmtUpdated    = UpdateAmount();
        }
        else if (strRole == strFJCAdmin)
        {
            iStatus          = Convert.ToInt32(ddlStatus.SelectedItem.Value);
            blnStatusUpdated = UpdateStatus(iStatus);
            blnCampUpdated   = UpdateCamp();

            blnDaysUpdated = UpdateDays();
            if (strRole == strFJCAdmin)
            {
                blnAmtUpdated = UpdateAmount();
            }
        }
        if (strRole == strApprover)
        {
            if (hdnConfirm.Value == "true")
            {
                iStatus          = Convert.ToInt32(ddlStatus.SelectedItem.Value);
                blnStatusUpdated = UpdateStatus(iStatus);

                blnCampUpdated = UpdateCamp();
                blnDaysUpdated = UpdateDays();

                int iCampyear = Convert.ToInt32(ddlCampYear.SelectedItem.Value);
                blnCampYearUpdated = UpdateCampYear(iCampyear);

                blnAmtUpdated = UpdateAmount();
                //string strCheckScript = "ConfirmUpdateAmt(); ";
                //if (!ClientScript.IsStartupScriptRegistered("clientScript"))
                //{
                //    ClientScript.RegisterStartupScript(Page.GetType(), "clientScript", strCheckScript, true);

                //}
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "clientScript", strCheckScript, true);
            }
        }
        //AG: 4-013
        //If a camper is "under review" you cannot update notes and keep them as "under review".

        //AG: A-048
        //Not only for Under Review - allow It universally.
        //if (!blnStatusUpdated && !blnCampUpdated && !blnAmtUpdated && Convert.ToInt32(ddlStatus.SelectedItem.Value) == Convert.ToInt32(StatusInfo.BeingResearched))
        //{
        string FJCID         = (string)Session["FJCID"];
        string OriginalValue = "";
        string ChangedValue  = "";
        string Comment       = txtReason.Text.Trim();
        string Type          = "Review Comments";
        int    ModifiedBy    = Convert.ToInt32(Session["UsrID"]);

        if (Comment.Length > 0)
        {
            _objCamperApp.InsertApplicationChangeHistory(FJCID, OriginalValue, ChangedValue, Comment, Type, ModifiedBy);
            blnWorkQueue = true;
        }
        //}
        if (ddlAdjustmentType.SelectedItem.Value == "1")
        {
            //SaveChangeRequest();
        }
        else
        {
            if (blnStatusUpdated || blnCampUpdated || (blnAmtUpdated && txtReason.Text.Trim() != "") || blnDaysUpdated || blnWorkQueue || blnCampYearUpdated)
            {
                string strPrevPage = Request.QueryString["page"];
                if (strPrevPage == "wrkq")
                {
                    Server.Transfer("~/Administration/Search/WorkQueue.aspx");
                }
                else if (strPrevPage == "srch")
                {
                    Server.Transfer("~/Administration/Search/AdminSearch.aspx?page=cs");
                }
            }
        }
    }