コード例 #1
0
 public CreditBureauController(
     CustomerRepository customers,
     CreditBureauModelBuilder creditBureauModelBuilder,
     IWorkplaceContext context)
 {
     _customers                = customers;
     m_oServiceClient          = new ServiceClient();
     _creditBureauModelBuilder = creditBureauModelBuilder;
     _context = context;
     _concentAgreementHelper = new ConcentAgreementHelper();
 }
コード例 #2
0
        }        //BuildDetails

        public ComapanyDashboardModel BuildNonLimitedDashboardModel(CompanyData data, string refNumber)
        {
            var model = new ComapanyDashboardModel();

            model.IsLimited = false;

            model.CompanyName   = data.BusinessName;
            model.CompanyRefNum = refNumber;
            if (string.IsNullOrEmpty(refNumber))
            {
                model.Error = "No data found.";
            }

            if (refNumber == "NotFound")
            {
                model.Error = "Customer selected company not found.";
            }

            model.Score      = data.RiskScore ?? 0;
            model.ScoreColor = CreditBureauModelBuilder.GetScorePositionAndColor(model.Score, CompanyScoreMax, CompanyScoreMin).Color;

            model.CcjMonths        = data.AgeOfMostRecentJudgmentDuringOwnershipMonths ?? -1;
            model.CcjValue         = data.TotalJudgmentValueLast24Months ?? 0 + data.TotalAssociatedJudgmentValueLast24Months ?? 0;
            model.Ccjs             = data.TotalJudgmentCountLast24Months ?? 0 + data.TotalAssociatedJudgmentCountLast24Months ?? 0;
            model.CompanyHistories = new List <CompanyHistory>();
            model.OriginationDate  = data.IncorporationDate;
            if (data.ScoreHistory != null)
            {
                foreach (ScoreAtDate scoreAtDate in data.ScoreHistory)
                {
                    model.CompanyHistories.Add(new CompanyHistory {
                        Score = scoreAtDate.Score, Date = scoreAtDate.Date, ServiceLogId = scoreAtDate.ServiceLogId
                    });
                }
            }

            return(model);
        }
コード例 #3
0
 public FullCustomerController(
     ICustomerRepository customerRepo,
     ISession session,
     CreditBureauModelBuilder creditBureauModelBuilder,
     ProfileSummaryModelBuilder summaryModelBuilder,
     CustomerRelationsRepository customerRelationsRepo,
     IBugRepository bugRepo,
     LoanRepository loanRepo,
     PropertiesModelBuilder propertiesModelBuilder,
     IEzbobWorkplaceContext context,
     ServiceClient serviceClient)
 {
     this.customerRepo             = customerRepo;
     this.session                  = session;
     this.creditBureauModelBuilder = creditBureauModelBuilder;
     this.summaryModelBuilder      = summaryModelBuilder;
     this.customerRelationsRepo    = customerRelationsRepo;
     this.bugRepo                  = bugRepo;
     this.loanRepo                 = loanRepo;
     this.propertiesModelBuilder   = propertiesModelBuilder;
     this.context                  = context;
     this.serviceClient            = serviceClient;
 }         // constructor
コード例 #4
0
 public ProfileSummaryModelBuilder(CreditBureauModelBuilder creditBureauModelBuilder, IEzbobWorkplaceContext context, ServiceClient serviceClient)
 {
     this.creditBureauModelBuilder = creditBureauModelBuilder;
     this.serviceClient            = serviceClient;
     this.context = context;
 }
コード例 #5
0
        public ComapanyDashboardModel BuildLimitedDashboardModel(ExperianLtdActionResult data, ComapanyDashboardModel oModel = null)
        {
            if (oModel == null)
            {
                oModel = new ComapanyDashboardModel {
                    FinDataHistories = new List <FinDataModel>(),
                    LastFinData      = new FinDataModel(),
                    IsLimited        = true,
                    CompanyHistories = new List <CompanyHistory>()
                };
            }             // if
            var oExperianLtd = data.Value;

            oModel.CompanyName   = oExperianLtd.CompanyName;
            oModel.CompanyRefNum = oExperianLtd.RegisteredNumber;

            oModel.Score      = oExperianLtd.GetCommercialDelphiScore();
            oModel.ScoreColor = CreditBureauModelBuilder.GetScorePositionAndColor(oModel.Score, 100, 0).Color;

            oModel.CcjMonths = oExperianLtd.GetAgeOfMostRecentCCJDecreeMonths();

            oModel.Ccjs            = oExperianLtd.GetNumberOfCcjsInLast24Months();
            oModel.CcjValue        = oExperianLtd.GetSumOfCcjsInLast24Months();
            oModel.OriginationDate = oExperianLtd.GetOriginationDate();
            if (data.History != null)
            {
                foreach (ScoreAtDate scoreAtDate in data.History)
                {
                    oModel.CompanyHistories.Add(new CompanyHistory {
                        Score        = scoreAtDate.Score,
                        Date         = scoreAtDate.Date,
                        ServiceLogId = scoreAtDate.ServiceLogId,
                        Balance      = scoreAtDate.Balance
                    });
                }
            }

            List <ExperianLtdDL97> oDL97List = new List <ExperianLtdDL97>();
            List <ExperianLtdDL99> oDL99List = new List <ExperianLtdDL99>();

            foreach (var oKid in oExperianLtd.Children)
            {
                if (typeof(ExperianLtdDL97) == oKid.GetType())
                {
                    oDL97List.Add((ExperianLtdDL97)oKid);
                }
                else if (typeof(ExperianLtdDL99) == oKid.GetType())
                {
                    ExperianLtdDL99 dl99 = (ExperianLtdDL99)oKid;

                    if (dl99.Date.HasValue)
                    {
                        oDL99List.Add(dl99);
                    }
                }         // if
            }             // for each

            string worstStatusAll = "0";

            //Calc and add Cais Balance

            oModel.CaisBalance = 0;

            foreach (var cais in oDL97List)
            {
                var state   = cais.AccountState;
                var balance = cais.CurrentBalance ?? 0;

                // Sum all accounts balance that are not settled
                if (!string.IsNullOrEmpty(state) && state[0] != 'S')
                {
                    oModel.CaisBalance += balance;
                    oModel.CaisAccounts++;
                }                 // if

                if (!string.IsNullOrEmpty(state) && state[0] == 'D')
                {
                    oModel.DefaultAccounts++;
                    oModel.DefaultAmount += cais.DefaultBalance ?? 0;
                }
                else
                {
                    var status      = cais.AccountStatusLast12AccountStatuses ?? string.Empty;
                    var worstStatus = CreditBureauModelBuilder.GetWorstStatus(Regex.Split(status, string.Empty));
                    if (worstStatus != "0")
                    {
                        oModel.LateAccounts++;
                        worstStatusAll = CreditBureauModelBuilder.GetWorstStatus(worstStatusAll, worstStatus);
                    }     // if
                }         // if
            }             // for each

            string date;

            oModel.LateStatus = CreditBureauModelBuilder.GetAccountStatusString(worstStatusAll, out date, true);

            // Calc and add tangible equity and adjusted profit

            if (oDL99List.Count > 0)
            {
                // ReSharper disable PossibleInvalidOperationException
                oDL99List.Sort((a, b) => b.Date.Value.CompareTo(a.Date.Value));
                // ReSharper restore PossibleInvalidOperationException

                for (var i = 0; i < oDL99List.Count - 1; i++)
                {
                    ExperianLtdDL99 oCurItem = oDL99List[i];

                    decimal totalShareFund  = oCurItem.TotalShareFund ?? 0;
                    decimal inTngblAssets   = oCurItem.InTngblAssets ?? 0;
                    decimal debtorsDirLoans = oCurItem.DebtorsDirLoans ?? 0;
                    decimal credDirLoans    = oCurItem.CredDirLoans ?? 0;
                    decimal onClDirLoans    = oCurItem.OnClDirLoans ?? 0;

                    decimal tangibleEquity = totalShareFund - inTngblAssets - debtorsDirLoans + credDirLoans + onClDirLoans;

                    if (oDL99List.Count > 1)
                    {
                        var oNextItem = oDL99List[i + 1];

                        decimal retainedEarnings     = oCurItem.RetainedEarnings ?? 0;
                        decimal retainedEarningsPrev = oNextItem.RetainedEarnings ?? 0;
                        decimal fixedAssetsPrev      = oNextItem.TngblAssets ?? 0;

                        decimal adjustedProfit = retainedEarnings - retainedEarningsPrev + fixedAssetsPrev / 5;

                        var fin = new FinDataModel {
                            TangibleEquity = tangibleEquity,
                            AdjustedProfit = adjustedProfit,
                        };
                        oModel.FinDataHistories.Add(fin);

                        if (i == 0)
                        {
                            oModel.LastFinData = fin;
                        }
                    }     // if
                }         // for each
            }             // if DL99 has data

            return(oModel);
        }         // BuildLimitedDashboardModel