private ValidationResponse ValidateUserCredential(string encrptedToken)
        {
            ValidationServiceClient serviceClient = new ValidationServiceClient();
            ValidationResponse      response      = serviceClient.UserCredentialValidation(encrptedToken);

            return(response);
        }
        private ValidationResponse Validate(string encrptedToken)
        {
            ValidationServiceClient serviceClient = new ValidationServiceClient();
            ValidationResponse      response      = serviceClient.AccessTokenValidation(encrptedToken);

            return(response);
        }
        //private string GetHighestMultiRateDeductible()
        //{
        //     string maximumString = string.Empty;
        //    switch (this.QHeader.FormCode)
        //    {
        //        case 4:
        //            {
        //                int maximum = 0;
        //                var options =
        //                    (new UIServices()).GetMultiRateOptions(this.QHeader.FormCode, this.QHeader.State) as
        //                    MultiRateOptionsForm4;
        //                    for (int i = 0; (options != null) && i < 3; i++)
        //                    {
        //                        string currentVal = options.Deductible[i].Replace("$", string.Empty).Trim();
        //                        if (currentVal.Length > 0 && maximum < Convert.ToInt32(currentVal))
        //                        {
        //                            maximum = Convert.ToInt32(currentVal);
        //                            maximumString = options.Deductible[i];
        //                        }
        //                    }
        //            }
        //            break;
        //        case 3:
        //            {
        //                int maximum = 0;
        //                var options =
        //                    (new UIServices()).GetMultiRateOptions(this.QHeader.FormCode, this.QHeader.State) as
        //                    MultiRateOptionsForm3;
        //                    for (int i = 0; (options != null) && i < 3; i++)
        //                    {
        //                        string currentVal = options.Deductible[i].Replace("$", string.Empty).Trim();
        //                        if (currentVal.Length > 0 && maximum < Convert.ToInt32(currentVal))
        //                        {
        //                            maximum = Convert.ToInt32(currentVal);
        //                            maximumString = options.Deductible[i];
        //                        }
        //                    }
        //            }
        //            break;
        //    }
        //    return maximumString;
        //}
        private void ProccessCoverages()
        {
            int inspectionResult = -2;

            if (qHeader.FormCode == 3)
            {
                this.Log("Calling APlus..");
                this.ServiceInterface.CallAPlusService(out this.displayAPlusModal);
                this.Log("Calling GetInspectionCode..");

                // Calling and Logging Inspection Model
                inspectionResult = ServiceInterface.GetInspectionCode();
                this.Log("GetInspectionCode result : " + inspectionResult.ToString());
            }
            else if (qHeader.FormCode == 6)
            {
                this.Log("Calling APlus..");

                this.ServiceInterface.CallAPlusService(out this.displayAPlusModal);
            }

            if (!String.IsNullOrEmpty(this.ServiceInterface.ErrorMessage))
            {
                this.ErrorMessage = this.ServiceInterface.ErrorMessage;
            }
            else
            {
                this.Log("ProccessCoverages - Saving Quote..");
                if (QuoteServices.IsFeeState(qHeader.State))
                {
                    this.ServiceInterface.CallSaveQuoteService();
                }
                else
                {
                    this.ServiceInterface.CallSaveQuoteServiceAsync();
                }
                this.Log("ProccessCoverages - Quote Saved... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString());
            }

            // Save the tracking id to quote submaster on complete quotes
            DirectWebDAC.InsertTrackingId(this.BusinessLogic().QHeader.QuoteNumber, this.BusinessLogic().QHeader.TrackingId);

            // ITR#7684
               // this.BusinessLogic().QHeader.XWindFlag = (!string.IsNullOrEmpty(this.BusinessLogic().PropertyAddressBrokerOutput.WindPool) && this.BusinessLogic().PropertyAddressBrokerOutput.WindPool == "IN");

            var isXWindState = this.BusinessLogic().Header.IsXWindState;
            if (isXWindState != null)
                this.BusinessLogic().QHeader.XWindFlag = (bool) isXWindState;
            this.BusinessLogic().QHeader.CtrFlag = this.BusinessLogic().Quote.CTRFlag ?? string.Empty;

            if (ProcessWalmartFlow())
            {
                SetWalmartSpecificHeaderFields();
            }
            // Below logic will be called if user does not enter discount.
            if (this.BusinessLogic().QHeader.PartnerId.Equals(2319))
            {
                //we need to strip off the discount here
                if (string.IsNullOrEmpty(this.BusinessLogic().QData.cvgPartnerDiscount) && this.BusinessLogic().QHeader.OLSStatus != OlsStatusEmailValidated)
                {
                    this.BusinessLogic().Quote.AutoPolicyNumber = string.Empty;
                    this.BusinessLogic().Quote.PartnerAutoPolicy = 0;
                    this.BusinessLogic().Quote.Save();
                    this.ServiceInterface.CallRatingService();
                }
            }
            if (this.BusinessLogic().QHeader.OLSStatus == OlsStatusEmailValidated)
            {
                ValidationService.ValidationServiceClient validationClient = null;
                try
                {
                    validationClient = new ValidationServiceClient();
                    DataTable table = DirectWebDAC.GetOLSEnrollmentValues(QHeader.QuoteNumber);
                    ValidationServiceMessage validationService = validationClient.ValidateResponse(table.Rows[0]["Token"].ToString(), table.Rows[0]["EMailVerificationCode"].ToString());
                    if (!validationService.Result)
                    {
                        //Call failed, try again or set OLSStatus to a failure state
                    }

                }
                catch (FaultException e)
                {
                    // OLSStatus to error for customer ~ -5?

                }
                finally
                {
                    if (validationClient != null)
                    {
                        validationClient.Close();
                    }
                }
            }

            // For Apex we HAVE to re rate after saving down the selected billing option.
            if (qHeader.IsApexState)
            {
                this.BusinessLogic().Quote.ApexBillingOption = qHeader.ApexBillingOption;
                this.BusinessLogic().Quote.Save();
                this.ServiceInterface.CallRatingService();
            }

            this.BusinessLogic().Coverage.Save();
        }
        private string InitiateOLSToken()
        {
            string token = String.Empty;
            ValidationService.ValidationServiceClient validationClient = null;
            try
            {
                validationClient = new ValidationServiceClient();
                var request = new ValidationRequestMessage();
                request.Channel = ValidationChannel.ConsumerWeb;
                request.PartnerAccountNumber = this.BusinessLogic().QHeader.PartnerId.ToString();
                request.DeviceAddress = this.BusinessLogic().QData.email;
                request.RequestType = ValidationRequestType.Token;
                ValidationServiceMessage validationService = validationClient.Initiate(request);
                if (validationService.Result)
                {
                    ValidateResponseMessage validationReference = (ValidateResponseMessage)validationService;
                    token = validationReference.RequestId;
                }

            }
            catch (Exception e)
            {
                this.Log("Exception occurred in InitiateOLSToken: Message: " + e.Message);

            }
            finally
            {
                if (validationClient != null)
                {
                    validationClient.Close();
                }
            }
            return token;
        }