/// <summary>
        /// Update credit card details when the update button is clicked.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void ImgBtnUpdate_Click(object sender, ImageClickEventArgs e)
        {
            PlaceHolder PH_PolicyDetail = (PlaceHolder)this.NamingContainer.FindControl(Constants.PC_CNTRL_NAME);

            if (PH_PolicyDetail != null)
            {
                PH_PolicyDetail.Visible = true;
            }
            string PC_ProductCode = string.Empty;

            //MAIG - CH13 - BEGIN - Modified the below logic to check if the Page is Valid
            if (_isValid && Page.IsValid)
            //MAIG - CH13 - END - Modified the below logic to check if the Page is Valid
            {
                try
                {
                    //MAIG - CH4 - BEGIN - Logic to set the Update button Enabled property to false
                    ImgBtnUpdate.Enabled = false;
                    //OrderClasses.Service.Order authUserObj = new OrderClasses.Service.Order();
                    //UserInfo userInfoObj = new UserInfo();

                    //userInfoObj = authUserObj.Authenticate(HttpContext.Current.User.Identity.Name, string.Empty, CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL);
                    //MAIG - CH4 - END - Logic to set the Update button Enabled property to false
                    if (!string.IsNullOrEmpty(hdnPaymentToken.Value))
                    {
                        List <string>             response    = new List <string>();
                        OrderClasses.OrderInfo    ordderInfo  = new OrderClasses.OrderInfo();
                        SessionInfo               sessionInfo = new SessionInfo();
                        IssueDirectPaymentWrapper actObj      = new IssueDirectPaymentWrapper();
                        string token = string.Empty;
                        ordderInfo.S                  = new SessionInfo();
                        ordderInfo.S.AppName          = CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL;
                        ordderInfo.User               = new UserInfo();
                        ordderInfo.User.UserId        = HttpContext.Current.User.Identity.Name;
                        ordderInfo.Card               = new OrderClasses.CardInfo();
                        ordderInfo.Card.CCExpMonth    = _ExpireMonth.SelectedValue.ToString();
                        ordderInfo.Card.CCExpYear     = _ExpireYear.SelectedValue.ToString();
                        ordderInfo.Card.CCNumber      = lblCardNumberLast4Digit.Text;
                        ordderInfo.Detail             = new OrderClasses.OrderDetailInfo();
                        ordderInfo.Detail.PaymentType = 1;
                        OrderClasses.AddressInfo addressInfo = new OrderClasses.AddressInfo();
                        addressInfo.FirstName   = _Name.Text;
                        addressInfo.LastName    = " ";
                        addressInfo.Zip         = _txtZipCode.Text;
                        addressInfo.City        = " ";
                        addressInfo.State       = " ";
                        addressInfo.AddressType = OrderClasses.AddressInfoType.BillTo;
                        ordderInfo.Addresses.Add(addressInfo);

                        MaintainPaymentAccountRequest  inputRequest  = new MaintainPaymentAccountRequest();
                        MaintainPaymentAccountResponse tokenResponse = new MaintainPaymentAccountResponse();
                        inputRequest = actObj.Tokenmapping(ordderInfo, sessionInfo, hdnPaymentToken.Value);
                        inputRequest.MaintainPaymentAccountRequest1.saveForFuture = true;
                        if (inputRequest != null)
                        {
                            //Invokes the Payment Token Service
                            tokenResponse = actObj.InvokePaymentTokenService(inputRequest);
                        }
                        if (tokenResponse != null)
                        {
                            token = tokenResponse.MaintainPaymentAccountResponse1.paymentAccountToken;
                        }
                        else
                        {
                            //Added the below code to set Error flag if response object is null
                            Logger.Log(CSAAWeb.Constants.PC_ERR_RESPONSE_NULL);
                            lblErrMessage.Visible = true;
                            lblErrMessage.Text    = CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION;
                        }

                        PCEnrollmentMapping pCEnroll = new PCEnrollmentMapping();
                        //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request
                        RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest statusRequest = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest();
                        statusRequest = CreatePaymentStatusRequest(token);
                        //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request

                        //MAIG - CH5 - BEGIN -  Including Agent & Agency ID to the Enrollment Request
                        if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID) || ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString().Equals("0"))
                        {
                            statusRequest.agency = string.Empty;
                        }
                        else
                        {
                            statusRequest.agency = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString();
                        }

                        //////if (string.IsNullOrEmpty(userInfoObj.RepId.ToString()) || userInfoObj.RepId.ToString().Equals("0"))
                        //////    statusRequest.agentIdentifier = string.Empty;
                        //////else
                        //////    statusRequest.agentIdentifier = userInfoObj.RepId.ToString();

                        if (this.Page.User.Identity.Name.Length > 9)
                        {
                            statusRequest.agentIdentifier = Convert.ToString(this.Page.User.Identity.Name).Substring(1);
                        }
                        else if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID) || !((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID.ToString().Equals("0"))
                        {
                            statusRequest.agentIdentifier = Convert.ToString(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID);
                        }
                        else
                        {
                            statusRequest.agentIdentifier = null;
                        }
                        //MAIG - CH5 - END -  Including Agent & Agency ID to the Enrollment Request

                        //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the method
                        response = pCEnroll.PCPaymentEnrollService(statusRequest);
                        //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the method

                        if (response[0].Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper()))
                        {
                            Logger.Log(Constants.PC_LOG_STATUS_REQUEST_SUCCESS + statusRequest.policyInfo.policyNumber + Constants.PC_LOG_CNFRM_NUMBER + response[1].ToString());
                            Context.Items.Add(Constants.PC_CNFRMNUMBER, response[1].ToString());

                            //MAIG - CH6 - BEGIN -  Logic to set the Invalid Unenroll flag passed to Confirmation page and removing PUP Prefix
                            ////// Removing the logic to prefix the PUP for PUP Policies - start
                            ////////if (statusRequest.policyInfo.type == Constants.PC_TYPE_PUP)
                            ////////{
                            ////////    Context.Items.Add(Constants.PC_POLICYNUMBER, Constants.PC_PUP + statusRequest.policyInfo.policyNumber.ToString());
                            ////////}
                            ////////else
                            ////////{
                            Context.Items.Add(Constants.PC_POLICYNUMBER, statusRequest.policyInfo.policyNumber.ToString());
                            ////////}
                            ///// Removing the logic to prefix the PUP for PUP Policies - end

                            ////// Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false);
                            if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow != null)
                            {
                                Context.Items.Add("PC_INVALID_UNENROLL_FLOW_FLAG", true);
                                Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false);
                            }
                            else
                            {
                                Context.Items.Add("PC_INVALID_UNENROLL_FLOW_FLAG", false);
                                Context.Items.Add("PC_INVALID_POLICY_FLOW_FLAG", false);
                            }
                            //MAIG - CH6 - END -  Logic to set the Invalid Unenroll flag passed to Confirmation page and removing PUP Prefix

                            Context.Items.Add(Constants.PC_CCNumber, Constants.PC_MASK_TXT + statusRequest.paymentItem.card.number);
                            //MAIG - CH15 - BEGIN - Added logic to add the condition for Amex and Discover
                            if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_MASTER))
                            {
                                statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_MASTER_EXPANSION;
                            }
                            else if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_AMEX))
                            {
                                statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_AMEX_EXPANSION;
                            }
                            else if (statusRequest.paymentItem.card.type.ToUpper().Equals(CSAAWeb.Constants.PC_CRD_TYPE_DISC))
                            {
                                statusRequest.paymentItem.card.type = CSAAWeb.Constants.PC_CRD_TYPE_DISC_EXPANSION;
                            }
                            //MAIG - CH15 - END - Added logic to add the condition for Amex and Discover
                            Context.Items.Add(Constants.PC_CCType, statusRequest.paymentItem.card.type.ToUpper());
                            //MAIG - CH7 - BEGIN -  Condition added to check if the policy is an valid policy
                            if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow == null)
                            {
                                Context.Items.Add(Constants.PC_BILL_PLAN, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).BillingPlan);
                                Context.Items.Add(Constants.PC_IS_ENROLLED, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._IsEnrolled);
                                Context.Items.Add(Constants.PC_VLD_MDFY_ENROLLMENT, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Modifyenrollment);
                                Context.Items.Add(Constants.PC_VLD_ENROLLMENT, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_enrollment);
                            }
                            //MAIG - CH7 - END -  Condition added to check if the policy is an valid policy
                            if ((_ExpireMonth.SelectedValue.Length) != 2)
                            {
                                Context.Items.Add(Constants.PC_CCEXP, "0" + _ExpireMonth.SelectedValue + "/" + _ExpireYear.SelectedValue);
                            }
                            else
                            {
                                Context.Items.Add(Constants.PC_CCEXP, _ExpireMonth.SelectedValue + "/" + _ExpireYear.SelectedValue);
                            }
                            Context.Items.Add(Constants.PC_PAYMT_TYPE, Constants.PC_CC);
                            Context.Items.Add(Constants.PC_CUST_NAME, _Name.Text);
                            Context.Items.Add(Constants.PC_EMAIL_ID, _txtEmailAddress.Text.ToString());
                            Context.Items.Add(Constants.PC_EDIT_CC, Constants.PC_EDIT_CC);
                            Context.Items.Add(Constants.PC_EDIT_CONST_RESPONSE, Constants.PC_EDIT_RESPONSE);
                            Server.Transfer(Constants.PC_RECURR_CNFRM_URL);
                        }
                        else
                        {
                            Logger.Log(Constants.PC_LOG_FAIL + statusRequest.policyInfo.policyNumber);
                            lblErrMessage.Visible = true;
                            //MAIG - CH14 - BEGIN - Modified code to display the Error Code only once
                            //lblErrMessage.Text = response[1].ToString() + " (" + response[0].ToString() + ")";
                            lblErrMessage.Text = response[1].ToString();
                            //MAIG - CH14 - END - Modified code to display the Error Code only once
                        }
                    }
                    else
                    {
                        lblErrMessage.Visible = true;
                        lblErrMessage.Text    = CSAAWeb.Constants.PC_ERR_RUNTIME_EXCEPTION;
                        Logger.Log(Constants.PC_UPCC_PToken_Empty + ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).PolicyNumber);
                    }
                }
                catch (FaultException faultExp)
                {
                    DisplayException(faultExp);
                    //MAIG - CH8 - BEGIN -  Condition added to enable the Update Button
                    ImgBtnUpdate.Enabled = true;
                    //MAIG - CH8 - END -  Condition added to enable the Update Button
                }
            }
        }
        //MAIG - CH1 - END -  Adding region which contains un-used code
        /// <summary>
        /// Get the details for Email content
        /// </summary>

        private void CreateRequestAndGetResponse(Boolean result, string status)
        {
            if (result)
            {
                List <string> response = new List <string>();
                //MAIG - CH2 - BEGIN -  Adding variable and set the value based on the entered poicy is valid or invalid
                string invalidUnEnrollFlow = string.Empty;

                if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow) != null)
                {
                    invalidUnEnrollFlow = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidUnEnrollFlow;
                }


                // Included MAIG Iteration2 - start - for getting the UserInfo details
                //OrderClasses.Service.Order authUserObj = new OrderClasses.Service.Order();
                //UserInfo userInfoObj = new UserInfo();

                //userInfoObj = authUserObj.Authenticate(HttpContext.Current.User.Identity.Name, string.Empty, CSAAWeb.Constants.PC_APPID_PAYMENT_TOOL);
                // Included MAIG Iteration2 - end - for getting the UserInfo details
                //MAIG - CH2 - END -  Adding variable and set the value based on the entered poicy is valid or invalid
                PCEnrollmentMapping pCEnroll = new PCEnrollmentMapping();
                //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request
                RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest statusRequest = new RecordPaymentEnrollment.recordPaymentEnrollmentStatusRequest();
                statusRequest.applicationContext = new RecordPaymentEnrollment.ApplicationContext();
                //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the Autpay Enrollment request to Payment Enrollment request
                statusRequest.applicationContext.application = Config.Setting(CSAAWeb.Constants.PC_ApplicationContext_Payment_Tool);
                statusRequest.applicationContext.address     = CSAAWeb.AppLogger.Logger.GetIPAddress();
                statusRequest.userId = HttpContext.Current.User.Identity.Name;
                //MAIG - CH3 - BEGIN -  Logic added to pass the Blaze rule if it is an valid flow
                if (!(invalidUnEnrollFlow.Equals("True")))
                {
                    statusRequest.enrollmentEffectiveDateSpecified = true;
                    statusRequest.enrollmentEffectiveDate          = Convert.ToDateTime(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[2]);
                    statusRequest.enrollmentReasonCode             = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[3];
                }
                //MAIG - CH3 - END -  Logic added to pass the Blaze rule if it is an valid flow
                //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace
                statusRequest.policyInfo = new RecordPaymentEnrollment.PolicyProductSource();
                //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace
                statusRequest.policyInfo.policyNumber = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page)).PolicyNumber;
                statusRequest.policyInfo.type         = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ProductType_PC;



                //MAIG - CH4 - BEGIN -  Including Agent ID, Agency ID & SourceSystem to the Enrollment Request
                if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID) || ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString().Equals("0"))
                {
                    statusRequest.agency = string.Empty;
                }
                else
                {
                    statusRequest.agency = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoAgencyID.ToString();
                }


                //////if (string.IsNullOrEmpty(userInfoObj.RepId.ToString()) || userInfoObj.RepId.ToString().Equals("0"))
                //////    statusRequest.agentIdentifier = string.Empty;
                //////else
                //////    statusRequest.agentIdentifier = userInfoObj.RepId.ToString();

                if (this.Page.User.Identity.Name.Length > 9)
                {
                    statusRequest.agentIdentifier = Convert.ToString(this.Page.User.Identity.Name).Substring(1);
                }
                else if (string.IsNullOrEmpty(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID) || !((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID.ToString().Equals("0"))
                {
                    statusRequest.agentIdentifier = Convert.ToString(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._UserInfoRepID);
                }
                else
                {
                    statusRequest.agentIdentifier = null;
                }


                /*if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._InvalidPolicyFlow == null) && (!(invalidUnEnrollFlow.Equals("True"))))
                 * {
                 *  statusRequest.policyInfo.dataSource = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidPolicySourceSystem;
                 * }
                 * else
                 * {
                 *  IssueDirectPaymentWrapper wrap = new IssueDirectPaymentWrapper();
                 *  statusRequest.policyInfo.dataSource = wrap.DataSource(((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ProductType_PT, statusRequest.policyInfo.policyNumber.Length);
                 * }*/
                statusRequest.policyInfo.dataSource = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidPolicySourceSystem;
                //MAIG - CH4 - END -  Including Agent ID, Agency ID & SourceSystem to the Enrollment Request
                //MAIG - CH5 - BEGIN -  Condition added to check if it is an valid policy number
                if (!(invalidUnEnrollFlow.Equals("True")))
                {
                    //MAIG - CH5 - END -  Condition added to check if it is an valid policy number

                    //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace
                    statusRequest.paymentItem = new RecordPaymentEnrollment.PaymentItemHeader();
                    //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace
                    if (((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1].Equals(CSAAWeb.Constants.PC_YES_NOTATION) ||
                        ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1].Equals(string.Empty))
                    {
                        if (paymentType.Equals(CSAAWeb.Constants.PC_Payment_CC))
                        {
                            statusRequest.paymentItem.paymentMethod = Config.Setting(CSAAWeb.Constants.PC_CreditCard_Code);
                            //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace
                            statusRequest.paymentItem.card = new RecordPaymentEnrollment.PaymentCard();
                            //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace
                            statusRequest.paymentItem.card.number = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._CCNumber;
                            statusRequest.paymentItem.card.type   = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._CCType;
                        }
                        else
                        {
                            statusRequest.paymentItem.paymentMethod = Config.Setting(CSAAWeb.Constants.PC_ElectronicFund_Code);
                            //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Added the namespace
                            statusRequest.paymentItem.account = new RecordPaymentEnrollment.PaymentAccount();
                            //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Added the namespace
                            statusRequest.paymentItem.account.accountNumber = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ECAccountNo;
                            statusRequest.paymentItem.account.type          = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ECaacType;
                        }

                        //MAIG - CH6 - BEGIN -  Adding Email ID value to the REQUEST
                        if (!string.IsNullOrEmpty(TextBoxValue))
                        {
                            statusRequest.emailTo = TextBoxValue.ToString();
                        }
                        //MAIG - CH6 - END -  Adding Email ID value to the REQUEST

                        Logger.Log("Request sent to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber);
                        //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the new service method
                        response = pCEnroll.PCPaymentEnrollService(statusRequest);
                        //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the new service method
                        if (response != null)
                        {
                            if (response[0].ToString().ToUpper().Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper()))
                            {
                                Logger.Log("Success Response to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber);

                                //MAIG - CH7 - BEGIN -  Disabling the PT Email trigger
                                ////if (status.Equals(CSAAWeb.Constants.PC_SUCESS) && !string.IsNullOrEmpty(TextBoxValue))
                                ////{
                                ////    SendMail(TextBoxValue, status);
                                ////}
                                //MAIG - CH7 - END -  Disabling the PT Email trigger

                                Context.Items.Add(Constants.PC_VLD_UNENROLL, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment);
                                Server.Transfer(CSAAWeb.Constants.PC_UNENROLL_CONFIRM_PATH, false);
                            }

                            else
                            {
                                Logger.Log(Constants.PC_LOG_EMAIL_POPUP + statusRequest.policyInfo.policyNumber);
                                //MAIG - CH12 - BEGIN - Modified code to display the Error Code only once
                                //lblError.Text = response[1].ToString() + " (" + response[0].ToString() + ")";
                                lblError.Text = response[1].ToString();
                                //MAIG - CH12 - END - Modified code to display the Error Code only once
                                content.Visible  = false;
                                lblError.Visible = false;
                                Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG);
                                if (Error != null)
                                {
                                    Error.Visible = true;
                                    Error.Text    = lblError.Text;
                                }
                                Logger.Log(lblError.Text.ToString());

                                //MAIG - CH8 - BEGIN -  Disabling the PT Email trigger
                                ////if (!string.IsNullOrEmpty(TextBoxValue))
                                ////{
                                ////    SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL);
                                ////}
                                //MAIG - CH8 - END -  Disabling the PT Email trigger
                            }
                        }
                        else
                        {
                            Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG);
                            content.Visible = false;
                            if (Error != null)
                            {
                                Error.Visible = true;
                                Error.Text    = lblError.Text;
                            }
                            Logger.Log(lblError.Text.ToString());

                            //MAIG - CH9 - BEGIN -  Disabling the PT Email trigger
                            ////if (!string.IsNullOrEmpty(TextBoxValue))
                            ////{
                            ////    SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL);
                            ////}
                            //MAIG - CH9 - END -  Disabling the PT Email trigger
                        }
                    }


                    else
                    {
                        content.Visible = false;
                        if ((((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[1]).ToString().Equals("N"))
                        {
                            lblError.Text = ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment[0];
                        }

                        Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG);
                        if (Error != null)
                        {
                            Error.Visible = true;
                            Error.Text    = lblError.Text;
                        }
                        Logger.Log(lblError.Text.ToString());

                        //MAIG - CH10 - BEGIN -  Disabling the PT Email trigger
                        ////if (!string.IsNullOrEmpty(TextBoxValue))
                        ////{
                        ////    SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL);
                        ////}
                        //MAIG - CH10 - END -  Disabling the PT Email trigger
                    }
                }
                else
                {
                    //MAIG - CH11 - BEGIN -  Disabling the PT Email trigger and set the Email ID value to PC Request
                    if (!string.IsNullOrEmpty(TextBoxValue))
                    {
                        statusRequest.emailTo = TextBoxValue.ToString();
                    }

                    Logger.Log("Request sent to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber);
                    //CHG0112662 - BEGIN - Record Payment Enrollment SOA Service changes - Renamed the new service method
                    response = pCEnroll.PCPaymentEnrollService(statusRequest);
                    //CHG0112662 - END - Record Payment Enrollment SOA Service changes - Renamed the new service method
                    if (response != null)
                    {
                        if (response[0].ToString().ToUpper().Equals(CSAAWeb.Constants.PC_SUCESS.ToUpper()))
                        {
                            Logger.Log("Success Response to un-Enroll for policy number " + statusRequest.policyInfo.policyNumber);

                            ////if (status.Equals(CSAAWeb.Constants.PC_SUCESS) && !string.IsNullOrEmpty(TextBoxValue))
                            ////{
                            ////    SendMail(TextBoxValue, status);
                            ////}

                            //////Context.Items.Add(Constants.PC_VLD_UNENROLL, ((MSC.Forms.ManageEnrollment)(((SiteTemplate)Page).OrderService.Page))._ValidationService_Unenrollment);
                            Server.Transfer(CSAAWeb.Constants.PC_UNENROLL_CONFIRM_PATH, false);
                        }

                        else
                        {
                            Logger.Log(Constants.PC_LOG_EMAIL_POPUP + statusRequest.policyInfo.policyNumber);
                            //MAIG - CH13 - BEGIN - Modified code to display the Error Code only once
                            //lblError.Text = response[1].ToString() + " (" + response[0].ToString() + ")";
                            lblError.Text = response[1].ToString();
                            //MAIG - CH13 - END - Modified code to display the Error Code only once
                            content.Visible  = false;
                            lblError.Visible = false;
                            Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG);
                            if (Error != null)
                            {
                                Error.Visible = true;
                                Error.Text    = lblError.Text;
                            }
                            Logger.Log(lblError.Text.ToString());

                            ////if (!string.IsNullOrEmpty(TextBoxValue))
                            ////{
                            ////    SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL);
                            ////}
                        }
                    }
                    else
                    {
                        Label Error = (Label)this.Parent.FindControl(Constants.PC_LBLERRORMSG);
                        content.Visible = false;
                        if (Error != null)
                        {
                            Error.Visible = true;
                            Error.Text    = lblError.Text;
                        }
                        Logger.Log(lblError.Text.ToString());

                        ////if (!string.IsNullOrEmpty(TextBoxValue))
                        ////{
                        ////    SendMail(TextBoxValue, CSAAWeb.Constants.PC_FAIL);
                        ////}
                        //MAIG - CH11 - END -  Disabling the PT Email trigger and set the Email ID value to PC Request
                    }
                }
            }
        }