Ejemplo n.º 1
0
        public void GetMonthlyQuote(ref PetfirstCustomer mCustomer, List<Pet> lstPets)
        {
            mCustomer.WebserviceErrorMsg = "";
            QuoteServiceClient qclient = new QuoteServiceClient();
            QuoteServiceCreateNewQuoteRequest qRequest = new QuoteServiceCreateNewQuoteRequest();
            qRequest.Customer = CreateQuoteCustomer(mCustomer);
            SetQuoteRequestPets(ref qRequest, lstPets);
            SetQuoteOtherAttributes(ref qRequest, mCustomer,lstPets, true);
            try
            {
                QuoteServiceCreateNewQuoteResponse resp = qclient.CreateNewMonthlyQuote(qRequest);
                if (string.IsNullOrEmpty(resp.Error.ErrorText))
                {
                    foreach (Pet p in lstPets)
                    {
                        p.FirstMonthPaymentTotal = resp.FirstDebitAmt;
                        p.FirstMonthTax = resp.FirstTaxAmt;//this include tax and admin fee
                        p.RecurringMonthPaymentTotal = resp.RecurringDebitAmt;
                        p.RecurringMonthTax = resp.RecurringTaxAmt;//this include tax and admin fee
                        p.InternetDiscountAmount = resp.InternetDiscountAmount;
                        p.EBDiscountAmount = resp.EBDiscountAmount;
                        p.MilitaryDiscountAmount = resp.MilitaryDiscountAmount;
                        p.VetDiscountAmount = resp.VetDiscountAmount;

                        if (mCustomer.Underwriter == 4)
                        {
                            p.FirstMonthPremiumOnly = resp.FirstDebitAmt - resp.FirstTaxAmt;
                            p.RecurringMonthPremiumOnly = resp.RecurringDebitAmt - resp.RecurringTaxAmt;
                        }
                        else
                        {
                            p.FirstMonthPremiumOnly = resp.FirstDebitAmt - resp.FirstTaxAmt;
                            p.RecurringMonthPremiumOnly = resp.RecurringDebitAmt - resp.RecurringTaxAmt;
                        }
                        p.QuoteId = resp.Id;
                        p.Enrolled = true;
                        p.OldQuoteData = false;
                        p.MultiPetAvailable = resp.MultiPolicyDiscountAvailable;
                    }
                }
                else
                {
                    mCustomer.WebserviceErrorMsg = resp.Error.ErrorText;
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                try
                {
                    if (qclient.State == CommunicationState.Faulted)
                        qclient.Abort();
                    else if (qclient.State == CommunicationState.Opened)
                        qclient.Close();
                }
                catch { }
            }
        }
Ejemplo n.º 2
0
 public void GetAnnualQuote(ref PetfirstCustomer mCustomer, List<Pet> lstPets)
 {
     mCustomer.WebserviceErrorMsg = "";
     QuoteServiceClient qclient = new QuoteServiceClient();
     QuoteServiceCreateNewQuoteRequest qRequest = new QuoteServiceCreateNewQuoteRequest();
     qRequest.Customer = CreateQuoteCustomer(mCustomer);
     SetQuoteRequestPets(ref qRequest,lstPets);
     SetQuoteOtherAttributes(ref qRequest,mCustomer,lstPets, false);
     try
     {
         QuoteServiceCreateNewQuoteResponse resp = qclient.CreateNewQuote(qRequest);
         if (string.IsNullOrEmpty(resp.Error.ErrorText))
         {
             foreach (Pet p in lstPets)
             {
                 p.AnnualPaymentTotal = resp.FirstDebitAmt;
             }
         }
         else
         {
             mCustomer.WebserviceErrorMsg = resp.Error.ErrorText;
         }
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         try
         {
             if (qclient.State == CommunicationState.Faulted)
                 qclient.Abort();
             else if (qclient.State == CommunicationState.Opened)
                 qclient.Close();
         }
         catch { }
     }
 }