Exemple #1
0
        public void SetDiscounts(Quote quote)
        {
            try
            {
                string state = quote.AiisQuoteMaster.getCustomer().getAddressStateCode();
                using (var context = new AutoQuoteEntitie7())
                {
                    var discounts = from d in context.states_master
                                    where d.state_master.Equals(state)
                                    select d;
                    if (discounts.Count() == 1)
                    {
                        var   dis                      = discounts.First();
                        Int32 esigDiscount             = (Int32)dis.esig_discount;
                        Int32 webDiscount              = dis.is_webDisc ? 1 : 0;
                        Int32 passiveRestraintDiscount = 1; //subsystems
                        Int32 instantRenters           = dis.allow_ho_instant_renter ? 1 : 0;
                        Int32 embeddedRenters          = dis.allow_affinity_embedded_renter ? 1 : 0;
                        Int32 homeownersDiscount       = dis.is_homeownerDisc ? 1 : 0;
                        Int32 rentersDiscount          = dis.allow_ho_instant_renter ? 1 : 0;
                        Int32 groupDiscount            = 0;
                        //select top 1 gr_discount_level from dgrpdisc
                        //where gr_state = @state and gr_group = @group and gr_release_date > 0 and gr_new_eff_date_begin <= convert(char(8), @effdate, 112) and (gr_new_eff_date_end > convert(char(8), @effdate, 112) or gr_new_eff_date_end = 0)

                        Int32 groupNumber = 0;
                        if (quote.AiisQuoteMaster.getPolicyInfo().getAffinityNo() > 0)
                        {
                            groupNumber = (Int32)quote.AiisQuoteMaster.getPolicyInfo().getAffinityNo();
                        }
                        else if (quote.AiisQuoteMaster.getPolicyInfo().getAssocNo() > 0)
                        {
                            groupNumber = (Int32)quote.AiisQuoteMaster.getPolicyInfo().getAssocNo();
                        }
                        else if (quote.AiisQuoteMaster.getPolicyInfo().getAlumniNo() > 0)
                        {
                            groupNumber = (Int32)quote.AiisQuoteMaster.getPolicyInfo().getAlumniNo();
                        }
                        if (quote.AddInfo.Element("Discounts") != null)
                        {
                            quote.AddInfo.Element("Discounts").Remove();
                        }

                        quote.AddInfo.Add(new XElement("Discounts"));
                        quote.AddInfo.Element("Discounts").Add(new XElement("Esignature", esigDiscount));
                        quote.AddInfo.Element("Discounts").Add(new XElement("Web", webDiscount));
                        quote.AddInfo.Element("Discounts").Add(new XElement("PassiveRestraint", passiveRestraintDiscount));
                        quote.AddInfo.Element("Discounts").Add(new XElement("Renters", rentersDiscount));
                        quote.AddInfo.Element("Discounts").Add(new XElement("Homeowners", homeownersDiscount));
                        quote.AddInfo.Element("Discounts").Add(new XElement("Group", groupDiscount));
                        //wsun 7409 returnandsave discount 11/10/2011
                        quote.AiisQuoteMaster.getPolicyInfo().setComeBackDis(0);
                        quote.AiisQuoteMaster.getPolicyInfo().setWelcomeBackDis(0);
                        if (quote.AddInfo.Element("ReturnDiscount").Value.ToLower().Equals("ccc"))
                        {
                            if (IsQualifyReturnAndSaveDiscount(quote, ReturnAndSaveDiscount.ComeBackandSave))
                            {
                                quote.AiisQuoteMaster.getPolicyInfo().setComeBackDis(1);
                                quote.AddInfo.Element("Discounts").Add(new XElement("ComeBackDis", 1));
                            }
                        }
                        if (quote.AddInfo.Element("ReturnDiscount").Value.ToLower().Equals("www"))
                        {
                            if (IsQualifyReturnAndSaveDiscount(quote, ReturnAndSaveDiscount.WelcomeBack))
                            {
                                quote.AiisQuoteMaster.getPolicyInfo().setWelcomeBackDis(1);
                                quote.AddInfo.Element("Discounts").Add(new XElement("WelcomeBackDis", 1));
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogUtility.LogError(ex.Message, "AutoQuoteFlow", "BL>Sessionservices", "SetDiscounts");
            }
        }
Exemple #2
0
        public void ResetQuoteEffectiveDates(Quote quote)
        {
            DateTime date = DateTime.Now;
            //String dateKey = "LookupDefaults_DRCDate";
            //DateTime? date = (DateTime?)CacheManager.GetData(dateKey);
            //if (date == null)
            //{
            //    date = _lookupDAO.LookupDRCDate();
            //    CacheManager.Add(dateKey, date, CacheManager.ExpireEverySixtySecond);
            //}

            DateTime effectiveBegin = quote.AiisQuoteMaster.getPolicyInfo().getEffDate();
            DateTime effectiveEnd   = quote.AiisQuoteMaster.getPolicyInfo().getExpDate();
            DateTime PolQtEffDt     = quote.AiisQuoteMaster.getPolicyInfo().getQuoteEffDate();


            DateTime today    = (DateTime)date;
            DateTime tomorrow = today.AddDays(1);
            //ysang  5/26/2011 tst10057 for ssr6845
            int status = quote.AiisQuoteMaster.getQuoteInfo().getQuoteTransType();

            if (status == 2 || quote.AiisQuoteMaster.getCustomer().getQuasiBindTest() != 0) // bound
            {
                // Don't mess with the dates
                //CustomerNetworkPlugin.LogError.Write("QuoteFlowPlugin", "LookupServices.ResetQuoteEffectiveDates:", quote.AiisQuoteMaster.getQuoteInfo().getQuoteNo0() + ": bound quote ", 2);
                //jrenz SSR8391 3/19/2012
                string quoteNo    = quote.AiisQuoteMaster.getQuoteInfo().getQuoteNo0();
                string guidString = "";
                if (quote.AddInfo != null)
                {
                    guidString = quote.AddInfo.Element("Guid").Value;
                }
                LogUtility.LogError(quote.AiisQuoteMaster.getQuoteInfo().getQuoteNo0() + ": bound quote ", "AutoQuoteFlow", "BL.Sessionservices", "ResetQuoteEffectiveDates");
            }
            else
            {
                if (effectiveBegin < tomorrow)
                {
                    effectiveBegin = today;
                    effectiveEnd   = tomorrow;
                    PolQtEffDt     = tomorrow;
                }
                else
                {
                    effectiveEnd = effectiveBegin.AddDays(1);
                    PolQtEffDt   = effectiveEnd;
                }
            }


            DateTime policyEffDt      = quote.AiisQuoteMaster.getQuoteInfo().getPolicyEffDate();
            DateTime effBeginPlusADay = effectiveBegin.AddDays(1);

            if (policyEffDt < effBeginPlusADay)
            {
                quote.AiisQuoteMaster.getQuoteInfo().setPolicyEffDate(effBeginPlusADay); //effectiveBegin
            }


            quote.AiisQuoteMaster.getPolicyInfo().setEffDate(effectiveBegin);
            quote.AiisQuoteMaster.getPolicyInfo().setExpDate(effectiveEnd);
            quote.AiisQuoteMaster.getPolicyInfo().setQuoteEffDate(PolQtEffDt);

            // while we are at it - set the version date
            //MD: policy date to determine which version of ratemaker
            string state = quote.AiisQuoteMaster.getCustomer().getAddressStateCode();

            if (state == "MD")
            {
                quote.AiisQuoteMaster.getPolicyInfo().setVersionDate(PolQtEffDt);
            }
            else
            {
                quote.AiisQuoteMaster.getPolicyInfo().setVersionDate(today);
            }
            //I am not sure we need to se these???
            if (quote.AiisQuoteMaster.getQuoteInfo().getQuoteNo0() != "") //1/4/2012wsun ssr7409 for www, recall =true but no quote#
            {
                quote.AiisQuoteMaster.getQuoteInfo().setQuoteTransType(1);
            }
            else
            {
                quote.AiisQuoteMaster.getQuoteInfo().setQuoteTransType(0);
            }

            if (state == "CA")
            {
                quote.AiisQuoteMaster.getCustomer().setProductVersion(2);
            }
            else
            {
                quote.AiisQuoteMaster.getCustomer().setProductVersion(4);
            }
        }