Ejemplo n.º 1
0
 private void SetQuoteRequestPets(ref QuoteServiceCreateNewQuoteRequest qRequest, List<Pet> lstPets)
 {
     int count =lstPets.Count;
     if(count==1)
     {
         QuoteServiceReference.Pet pet1 = CreateQuotePet(lstPets[0]);
         qRequest.Pets = new QuoteServiceReference.Pet[1];
         qRequest.Pets[0] = pet1;
     }
     else if(count==2)
     {
         qRequest.Pets = new QuoteServiceReference.Pet[2];
         qRequest.Pets[0] = CreateQuotePet(lstPets[0]);
         qRequest.Pets[1] = CreateQuotePet(lstPets[1]);
     }
     else if(count ==3)
     {
         qRequest.Pets = new QuoteServiceReference.Pet[3];
         qRequest.Pets[0] = CreateQuotePet(lstPets[0]);
         qRequest.Pets[1] = CreateQuotePet(lstPets[1]);
         qRequest.Pets[2] = CreateQuotePet(lstPets[2]);
     }
     else
     {
         throw new Exception("Incorrect Pets count");
     }
 }
Ejemplo n.º 2
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.º 3
0
        private void SetQuoteOtherAttributes(ref QuoteServiceCreateNewQuoteRequest qRequest, PetfirstCustomer mCustomer, List<Pet> lstPets,bool bMontly)
        {
            qRequest.UnderwriterID = mCustomer.Underwriter;
            qRequest.IncludeRoutine = false;
            qRequest.IncludeRoutine125 = false;
            qRequest.IncludeRoutine250 = false;
            qRequest.IncludeRoutine400 = false;
            qRequest.MilitaryDiscount = mCustomer.DiscountMilitarySelected;
            qRequest.InternetDiscount = mCustomer.DiscountInternetPurchase;
            qRequest.VetDiscount = mCustomer.DiscountVetSelected;

            if (!lstPets[0].Routine.ToLower().Equals("0"))
            {
                qRequest.IncludeRoutine = true;
                switch (lstPets[0].Routine.ToLower())
                {
                    case "routine125":
                        qRequest.IncludeRoutine125 = true;
                        break;
                    case "routine250":
                        qRequest.IncludeRoutine250 = true;
                        break;
                    case "routine400": qRequest.IncludeRoutine400 = true;
                        break;

                }
            }
            qRequest.PlanId = lstPets[0].PlanId;
            if (bMontly)
                qRequest.PaymentFrequencyId = 1;//1 monthly, 2: annually
            else
                qRequest.PaymentFrequencyId = 2;
            qRequest.IncludeBreeders = lstPets[0].Breeder;

            if(lstPets[0].Hereditary.ToLower().Equals("hereditary100"))
            {
              qRequest.IncludeHereditary100 =true;
            }
            else if (lstPets[0].Hereditary.ToLower().Equals("hereditary25"))
            {
                qRequest.IncludeHereditary25 = true;
            }
            else
            {
                qRequest.IncludeHereditary100 = false;
                qRequest.IncludeHereditary25 = false;

            }
            qRequest.IncludePrescriptionFood = lstPets[0].PrescriptionFood;
            qRequest.KrogerLoyaltyNumber = String.Empty;
            qRequest.EnrollmentCode = mCustomer.EnrollmentCode;
            qRequest.Deductible = lstPets[0].DeductibleAmount;
            qRequest.CoInsurance = 1-lstPets[0].Reimbursement;
            qRequest.UnderwriterID = mCustomer.Underwriter;

            try
            {

                int nPlan = lstPets[0].PlanId;
                qRequest.FilingID = (from pts in context.v_PlansToStates
                                     where pts.stateProvinceID.Equals(mCustomer.MembershipInfo.StateId) &&
                                         pts.UnderwriterID.Equals(mCustomer.Underwriter) &&
                                         pts.plan_id == nPlan
                                     select pts.FilingID).First();
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Ejemplo n.º 4
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 { }
     }
 }