//private void GetUpdatedTUInfoOnRetrieve()
        //{
        //    //Check to see if TU record available in the rating DB,
        //    Homesite.IQuote.ISOBroker.ISOProvider ISORating = new Homesite.IQuote.ISOBroker.ISOProvider();
        //    int RequestSeqNumber = 0;
        //    string CreditScore = "";
        //    int Noofmatches = 0;
        //    int requestId = this.IQuote().PrimaryPerson.TransUnionRequestID == null ? 0 : (int)this.IQuote().PrimaryPerson.TransUnionRequestID;
        //    //try
        //    //{
        //        // ITR#3855 Product Template 2010 change of signature
        //        // All calls to StoreTUScoreInRatingDB and GetLatestTUInfo are being commented out
        //        // as per Gaurav's directive because the logic has been moved elsewhere
        //        //string reasonCode1 = String.Empty;
        //        //string reasonCode2 = String.Empty;
        //        //string reasonCode3 = String.Empty;
        //        //string reasonCode4 = String.Empty;
        //        //ISORating.GetLatestTUInfo(requestId, out RequestSeqNumber, out CreditScore, out Noofmatches, out reasonCode1, out reasonCode2, out reasonCode3, out reasonCode4);
        //    //}
        //    //catch (Exception ex)
        //    //{
        //    //    this.ErrorMessage = "There was a problem processing your request.  Please try again later.";
        //    //}
        //    if (CreditScore.Trim().Equals(""))
        //        CreditScore = "0";
        //    //try
        //    //{
        //        // ITR#3855 Product Template 2010 change of signature
        //        // All calls to StoreTUScoreInRatingDB and GetLatestTUInfo are being commented out
        //        // as per Gaurav's directive because the logic has been moved elsewhere
        //    //    string reasoncode1 = String.Empty;
        //    //    string reasoncode2 = String.Empty;
        //    //    string reasoncode3 = String.Empty;
        //    //    string reasoncode4 = String.Empty;
        //    //    ISORating.StoreTUScoreInRatingDB(requestId, int.Parse(CreditScore), Noofmatches, reasoncode1, reasoncode2, reasoncode3, reasoncode4);
        //    //}
        //    //catch (Exception ex)
        //    //{
        //    //    this.ErrorMessage = "There was a problem processing your request.  Please try again later.";
        //    //}
        //}
        private static System.Nullable<short> GetCompanysPolicyNumber(QuoteHeader qHeader)
        {
            System.Nullable<short> intQuoteStatus = 0;
            Homesite.IQuote.Data.LookupDataProviderTableAdapters.QueriesTableAdapter qtd =
                new Homesite.IQuote.Data.LookupDataProviderTableAdapters.QueriesTableAdapter();

            qtd.GetCompanysPolicyNumber(qHeader.QuoteNumber, ref intQuoteStatus);
            return intQuoteStatus;
        }
        public DNQReferralStatus GetDNQReferralStatus()
        {
            var visitable = this as IBusinessLogicVisitable;
            DNQReferralStatus.DNQReason reason = DNQReferralStatus.DNQReason.None;
            if (string.Compare(visitable.Quote.DNQReasons, "The Property is not owner occupied.", true) == 0)
                reason = DNQReferralStatus.DNQReason.NonOwnerOccupied;
            if (string.Compare(visitable.Quote.DNQReasons, "Mobile and Manufactured homes are ineligible for coverage.", true) == 0)
                reason = DNQReferralStatus.DNQReason.MobileManufactured;

            DNQReferralStatus status = new DNQReferralStatus()
            {
                CanRefer = false,
                ReferredPartnerName = null,
                Reason = reason
            };

            if (reason != DNQReferralStatus.DNQReason.None)
            {
                LookupProvider lookup = new LookupProvider();
                bool? exclude = true;
                string DNQMessage = "";

                // add Partner functionality lookup
                if (lookup.CheckPartnerFunction(lookup.GetPartnerInfoByPartnerID((int)visitable.Quote.PartnerId).ContactPartnerid, "DNQReferral"))
                {
                    // exclusion lookup
                    Homesite.IQuote.Data.LookupDataProviderTableAdapters.QueriesTableAdapter
                        adp = new Homesite.IQuote.Data.LookupDataProviderTableAdapters.QueriesTableAdapter();
                    adp.CheckDNQReferralExclusions(visitable.PropertyAddress.PostalCode, visitable.Quote.DNQReasons, ref exclude, ref DNQMessage);

                    if (((int)visitable.Quote.PartnerId == 1220) && ((bool)!exclude))
                    {
                        XElement partner = ConfigurationCache.StaticCollection.GetDNQReferralPartner("AMIG");
                        var query =
                            from el in partner.Descendants("ElephantStates").Elements()
                            where (string)el.Value.ToString() == (string)visitable.QHeader.State
                            select el.Value;
                        if (query.Count() > 0)
                            exclude = false;
                        else
                            exclude = true;
                    }
                }

                if (exclude == false)
                {
                    string groupName = GetABTestGroup("DNQ Referral");
                    if (groupName != "Do Not Refer")
                    {
                        status.CanRefer = true;
                        status.ReferredPartnerName = groupName;
                    }
                }
            }
            return status;
        }