示例#1
0
    private bool UpdateDays()
    {
        int    iStatus;
        string strReason = txtReason.Text.Trim();

        //Check if the Days value is changed, if yes then update the same
        if (txtDays.Text.Trim() != hdnDays.Value)
        {
            string strFJCID = (string)Session["FJCID"];
            int    iUserId  = Convert.ToInt32(Session["UsrID"]);

            //AG: A-028
            //The system should not ask for reason if the user changes the status
            //from Eligible by staff to Register in camp
            if (strReason == string.Empty && hdnDays.Value != string.Empty)
            {
                lblErr.Font.Bold = true;
                lblErr.Text      = "Please enter Reason(s) for change";
                return(false);
            }
            else
            {
                lblErr.Text = "";
                int iDays;

                if (txtDays.Text.Trim() != "")
                {
                    iDays = Convert.ToInt32(txtDays.Text.Trim());
                    _objCamperApp.UpdateDays(strFJCID, iDays, iUserId, strReason);
                    EligibilityBase.checkEligibilityDays2(strFJCID, iDays, out iStatus);
                    if (iStatus == 15)
                    {
                        ReverceSecondApprovalFlag(strFJCID);
                    }
                    UpdateStatus(iStatus);
                }
                else
                {
                    iDays   = -1;
                    iStatus = Convert.ToInt32(ddlStatus.SelectedItem.Value);
                    UpdateStatus(iStatus);
                }


                return(true);
            }
        }
        else
        {
            if (strReason == string.Empty)
            {
                lblErr.Font.Bold = true;
                lblErr.Text      = "Please enter Reason(s) for change";
                return(false);
            }
            else
            {
                if (txtDays.Text.Trim() != "" && ddlStatus.SelectedItem.Value == "11")
                {
                    //This is the case when a camper director updates
                    //the status from the eligible by staff to
                    //the status Registered in camp
                    //after beeing approved by approver (this is why days exist and equal
                    //to the previous value in the hidden field).
                    //The system sets the status of Campership approved.
                    //This is the fix of the issue A-034

                    iStatus = 14;
                }
                else
                {
                    iStatus = Convert.ToInt32(ddlStatus.SelectedItem.Value);
                }
                UpdateStatus(iStatus);
                return(true);
            }
        }
    }