Ejemplo n.º 1
0
        } // LoadExperianLtd

        public ExperianLtd CheckLtdCompanyCache(int userId, string sCompanyRefNum)
        {
            var stra = new LoadExperianLtd(sCompanyRefNum, 0);

            stra.Execute();
            return(stra.Result);
        } // CheckLtdCompanyCache
Ejemplo n.º 2
0
        } // ParseExperianLtd

        public ExperianLtd LoadExperianLtd(long nServiceLogID)
        {
            var stra = new LoadExperianLtd(null, nServiceLogID);

            stra.Execute();
            return(stra.Result);
        } // LoadExperianLtd
Ejemplo n.º 3
0
        }         // LoadConsumerData

        protected virtual ExperianLtd LoadCompanyData()
        {
            var ltd = new LoadExperianLtd(MetaData.CompanyRefNum, 0);

            ltd.Execute();

            return(ltd.Result);
        }         // LoadCompanyData
Ejemplo n.º 4
0
        public void TestLoadExperianLtd()
        {
            var s = new LoadExperianLtd("06357516", 0);

            s.Execute();
            Console.WriteLine(s.Result.ToString());
            Assert.IsNotNull(s.Result);
            Assert.IsNotNull(s.History);
        }
Ejemplo n.º 5
0
        }         // constructor

        public Approval Init()
        {
            using (this.trail.AddCheckpoint(ProcessCheckpoints.Initializtion)) {
                var stra = new LoadExperianConsumerData(this.trail.CustomerID, null, null);
                stra.Execute();

                this.experianConsumerData = stra.Result;

                if (this.customer == null)
                {
                    this.isBrokerCustomer = false;
                }
                else
                {
                    this.isBrokerCustomer = this.customer.Broker != null;
                }

                bool hasLtd =
                    (this.customer != null) &&
                    (this.customer.Company != null) &&
                    (this.customer.Company.TypeOfBusiness.Reduce() == TypeOfBusinessReduced.Limited) &&
                    (this.customer.Company.ExperianRefNum != "NotFound");

                if (hasLtd)
                {
                    var limited = new LoadExperianLtd(this.customer.Company.ExperianRefNum, 0);
                    limited.Execute();

                    this.companyDissolutionDate = limited.Result.DissolutionDate;

                    this.directors = new List <Name>();

                    foreach (ExperianLtdDL72 dataRow in limited.Result.GetChildren <ExperianLtdDL72>())
                    {
                        this.directors.Add(new Name(dataRow.FirstName, dataRow.LastName));
                    }

                    foreach (ExperianLtdDLB5 dataRow in limited.Result.GetChildren <ExperianLtdDLB5>())
                    {
                        this.directors.Add(new Name(dataRow.FirstName, dataRow.LastName));
                    }
                }                 // if

                this.hmrcNames = new List <NameForComparison>();

                this.db.ForEachRowSafe(
                    names => {
                    if (!names["BelongsToCustomer"])
                    {
                        return;
                    }

                    var name = new NameForComparison(names["BusinessName"]);
                    if (name.AdjustedName != string.Empty)
                    {
                        this.hmrcNames.Add(name);
                    }
                },
                    "GetHmrcBusinessNames",
                    CommandSpecies.StoredProcedure,
                    new QueryParameter("CustomerId", this.trail.CustomerID)
                    );

                SafeReader sr = this.db.GetFirst(
                    "GetExperianMinMaxConsumerDirectorsScore",
                    CommandSpecies.StoredProcedure,
                    new QueryParameter("CustomerId", this.trail.CustomerID),
                    new QueryParameter("Now", Now)
                    );

                if (!sr.IsEmpty)
                {
                    this.minExperianScore = sr["MinExperianScore"];
                }

                var oScore = new QueryParameter("CompanyScore")
                {
                    Type      = DbType.Int32,
                    Direction = ParameterDirection.Output,
                };

                var oDate = new QueryParameter("IncorporationDate")
                {
                    Type      = DbType.DateTime2,
                    Direction = ParameterDirection.Output,
                };

                this.db.ExecuteNonQuery(
                    "GetCompanyScoreAndIncorporationDate",
                    CommandSpecies.StoredProcedure,
                    new QueryParameter("CustomerId", this.trail.CustomerID),
                    new QueryParameter("TakeMinScore", true),
                    oScore,
                    oDate
                    );

                int nScore;
                if (int.TryParse(oScore.SafeReturnedValue, out nScore))
                {
                    this.minCompanyScore = nScore;
                }

                this.m_oSecondaryImplementation.Init();
            }             // using timer step

            return(this);
        }         // Init
Ejemplo n.º 6
0
        }         // Calculate

        private void Validate()
        {
            if (!string.IsNullOrWhiteSpace(FatalMsg))
            {
                Log.Debug("QuickOffer.Validate: fatal (for quick offer calculation) error reported when selecting data from DB: {0}", FatalMsg);
                return;
            }             // if

            if (!AreLoadedValid())
            {
                return;
            }

            if (IsThinFile())
            {
                return;
            }

            var oLoader = new LoadExperianLtd(CompanyRefNum, 0);

            oLoader.Execute();

            if (oLoader.Result.RegisteredNumber != CompanyRefNum)
            {
                return;
            }

            if (!m_oExperianUtils.IsDirector(oLoader.Result, FirstName, LastName))
            {
                Log.Debug("QuickOffer.Validate: the customer is not director of this company.");
                return;
            }             // if

            BusinessScore = oLoader.Result.GetCommercialDelphiScore();
            if (BusinessScore < Cfg.BusinessScoreMin)
            {
                Log.Debug("QuickOffer.Validate: business score is too low.");
                return;
            }             // if

            IncorporationDate = oLoader.Result.IncorporationDate;
            if (!IncorporationDate.HasValue)
            {
                Log.Debug("QuickOffer.Validate: business age cannot be detected.");
                return;
            }             // if

            if (DateTime.UtcNow.Subtract(IncorporationDate.Value).TotalDays < 30.45 * Cfg.CompanySeniorityMonths)
            {
                Log.Debug("QuickOffer.Validate: business is too young.");
                return;
            }             // if

            decimal nTangibleEquity;
            decimal nTotalCurrentAssets;

            m_oExperianUtils.DetectTangibleEquity(oLoader.Result, out nTangibleEquity, out nTotalCurrentAssets);

            TangibleEquity     = nTangibleEquity;
            TotalCurrentAssets = nTotalCurrentAssets;

            if (TangibleEquity < 0)
            {
                Log.Debug("QuickOffer.Validate: tangible equity is to low.");
                return;
            }             // if

            IsValid = true;
        }         // Validate