Beispiel #1
0
        }         // SaveToDb

        public override string ToString()
        {
            var sb = new StringBuilder();

            sb.AppendFormat(
                "Calculation Num 1 .........Medal Type {2} Medal: {0} " +
                "NormalizedScore: {1}% Score: {3} Offered amount: {4}\n",
                MedalClassification,
                StringBuilderExtention.ToPercent(TotalScoreNormalized),
                MedalType,
                TotalScore,
                OfferedLoanAmount
                );

            sb.AppendFormat(
                "{0}| {1}| {2}| {3}| {4}| {5}| {6}| {7}| {8} \n",
                "Parameter".PadRight(25),
                "Weight".PadRight(10),
                "MinScore".PadRight(10),
                "MaxScore".PadRight(10),
                "MinGrade".PadRight(10),
                "MaxGrade".PadRight(10),
                "Grade".PadRight(10),
                "Score".PadRight(10),
                "Value"
                );

            var summary = new Weight();

            Weight weight;

            if (MedalType != MedalType.SoleTrader)
            {
                weight = new Weight {
                    Value       = BusinessScore.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = BusinessScoreWeight,
                    Grade       = (int)BusinessScoreGrade,
                    Score       = BusinessScoreScore
                };
                sb.AddWeight(weight, "BusinessScore", ref summary);
            }             // if

            if (MedalType == MedalType.Limited || MedalType == MedalType.OnlineLimited)
            {
                weight = new Weight {
                    Value       = TangibleEquity.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = TangibleEquityWeight,
                    Grade       = (int)TangibleEquityGrade,
                    Score       = TangibleEquityScore
                };
                sb.AddWeight(weight, "TangibleEquity", ref summary);
            }             // if

            DateTime calcTime = CalculationTime;
            int      businessSeniorityYears = 0;
            decimal  ezbobSeniorityMonth    = 0;

            if (BusinessSeniority.HasValue)
            {
                businessSeniorityYears = (int)(calcTime - BusinessSeniority.Value).TotalDays / 365;
            }

            if (EzbobSeniority.HasValue)
            {
                ezbobSeniorityMonth = (decimal)(calcTime - EzbobSeniority.Value).TotalDays / (365.0M / 12.0M);
            }

            weight = new Weight {
                Value       = businessSeniorityYears.ToString(CultureInfo.InvariantCulture),
                FinalWeight = BusinessSeniorityWeight,
                Grade       = (int)BusinessSeniorityGrade,
                Score       = BusinessSeniorityScore
            };
            sb.AddWeight(weight, "BusinessSeniority", ref summary);

            weight = new Weight {
                Value       = ConsumerScore.ToString(CultureInfo.InvariantCulture),
                FinalWeight = ConsumerScoreWeight,
                Grade       = (int)ConsumerScoreGrade,
                Score       = ConsumerScoreScore
            };
            sb.AddWeight(weight, "ConsumerScore", ref summary);

            weight = new Weight {
                Value       = ezbobSeniorityMonth.ToString(CultureInfo.InvariantCulture),
                FinalWeight = EzbobSeniorityWeight,
                Grade       = (int)EzbobSeniorityGrade,
                Score       = EzbobSeniorityScore
            };
            sb.AddWeight(weight, "EzbobSeniority", ref summary);

            weight = new Weight {
                Value       = MaritalStatus.ToString(),
                FinalWeight = MaritalStatusWeight,
                Grade       = (int)MaritalStatusGrade,
                Score       = MaritalStatusScore
            };
            sb.AddWeight(weight, "MaritalStatus", ref summary);

            weight = new Weight {
                Value       = NumOfLoans.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfLoansWeight,
                Grade       = (int)NumOfLoansGrade,
                Score       = NumOfLoansScore
            };
            sb.AddWeight(weight, "NumOfLoans", ref summary);

            weight = new Weight {
                Value       = NumOfLateRepayments.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfLateRepaymentsWeight,
                Grade       = (int)NumOfLateRepaymentsGrade,
                Score       = NumOfLateRepaymentsScore
            };
            sb.AddWeight(weight, "NumOfLateRepayments", ref summary);

            weight = new Weight {
                Value       = NumOfEarlyRepayments.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NumOfEarlyRepaymentsWeight,
                Grade       = (int)NumOfEarlyRepaymentsGrade,
                Score       = NumOfEarlyRepaymentsScore
            };
            sb.AddWeight(weight, "NumOfEarlyRepayments", ref summary);

            weight = new Weight {
                Value       = AnnualTurnover.ToString(CultureInfo.InvariantCulture),
                FinalWeight = AnnualTurnoverWeight,
                Grade       = (int)AnnualTurnoverGrade,
                Score       = AnnualTurnoverScore
            };
            sb.AddWeight(weight, "AnnualTurnover", ref summary);

            weight = new Weight {
                Value       = FreeCashFlow.ToString(CultureInfo.InvariantCulture),
                FinalWeight = FreeCashFlowWeight,
                Grade       = (int)FreeCashFlowGrade,
                Score       = FreeCashFlowScore
            };
            sb.AddWeight(weight, "FreeCashFlow", ref summary);

            weight = new Weight {
                Value       = NetWorth.ToString(CultureInfo.InvariantCulture),
                FinalWeight = NetWorthWeight,
                Grade       = (int)NetWorthGrade,
                Score       = NetWorthScore
            };
            sb.AddWeight(weight, "NetWorth", ref summary);

            bool isOnline =
                MedalType == MedalType.OnlineLimited ||
                MedalType == MedalType.OnlineNonLimitedNoBusinessScore ||
                MedalType == MedalType.OnlineNonLimitedWithBusinessScore;

            if (isOnline)
            {
                weight = new Weight {
                    Value       = NumberOfStores.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = NumberOfStoresWeight,
                    Grade       = (int)NumberOfStoresGrade,
                    Score       = NumberOfStoresScore
                };
                sb.AddWeight(weight, "NumOfStores", ref summary);

                weight = new Weight {
                    Value       = PositiveFeedbacks.ToString(CultureInfo.InvariantCulture),
                    FinalWeight = PositiveFeedbacksWeight,
                    Grade       = (int)PositiveFeedbacksGrade,
                    Score       = PositiveFeedbacksScore
                };
                sb.AddWeight(weight, "PositiveFeedbacks", ref summary);
            }             // if

            sb.AppendLine("----------------------------------------------------------------------------------------------------------------------------------------");

            sb.AppendFormat("{0}| {1}| {2}| {3}| {4}| {5}| {6}| {7}| {8}\n",
                            "Sum".PadRight(25),
                            StringBuilderExtention.ToShort(summary.FinalWeight)
                            .PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            "-".PadRight(10),
                            summary.Grade.ToString(CultureInfo.InvariantCulture)
                            .PadRight(10),
                            StringBuilderExtention.ToShort(summary.Score)
                            .PadRight(10), summary.Value);

            return(sb.ToString());
        }         // ToString
Beispiel #2
0
        }                                                                    // CheckForMatch

        public void SaveToDb(long?cashRequestID, long?nlCashRequestID, string tag, AConnection db)
        {
            db.ExecuteNonQuery("StoreMedal", CommandSpecies.StoredProcedure,
                               new QueryParameter("CustomerId", CustomerId),
                               new QueryParameter("CalculationTime", CalculationTime),
                               new QueryParameter("MedalType", MedalType.ToString()),
                               new QueryParameter("FirstRepaymentDatePassed", FirstRepaymentDatePassed),
                               new QueryParameter("BusinessScore", BusinessScore),
                               new QueryParameter("BusinessScoreWeight", BusinessScoreWeight),
                               new QueryParameter("BusinessScoreGrade", BusinessScoreGrade),
                               new QueryParameter("BusinessScoreScore", BusinessScoreScore),
                               new QueryParameter("FreeCashFlowValue", FreeCashFlowValue),
                               new QueryParameter("FreeCashFlow", FreeCashFlow),
                               new QueryParameter("FreeCashFlowWeight", FreeCashFlowWeight),
                               new QueryParameter("FreeCashFlowGrade", FreeCashFlowGrade),
                               new QueryParameter("FreeCashFlowScore", FreeCashFlowScore),
                               new QueryParameter("HmrcAnnualTurnover", HmrcAnnualTurnover),
                               new QueryParameter("BankAnnualTurnover", BankAnnualTurnover),
                               new QueryParameter("OnlineAnnualTurnover", OnlineAnnualTurnover),
                               new QueryParameter("AnnualTurnover", AnnualTurnover),
                               new QueryParameter("AnnualTurnoverWeight", AnnualTurnoverWeight),
                               new QueryParameter("AnnualTurnoverGrade", AnnualTurnoverGrade),
                               new QueryParameter("AnnualTurnoverScore", AnnualTurnoverScore),
                               new QueryParameter("TangibleEquityValue", TangibleEquityValue),
                               new QueryParameter("TangibleEquity", TangibleEquity),
                               new QueryParameter("TangibleEquityWeight", TangibleEquityWeight),
                               new QueryParameter("TangibleEquityGrade", TangibleEquityGrade),
                               new QueryParameter("TangibleEquityScore", TangibleEquityScore),
                               new QueryParameter(
                                   "BusinessSeniority",
                                   BusinessSeniority.HasValue && BusinessSeniority.Value.Year > 1800 ? BusinessSeniority : null
                                   ),
                               new QueryParameter("BusinessSeniorityWeight", BusinessSeniorityWeight),
                               new QueryParameter("BusinessSeniorityGrade", BusinessSeniorityGrade),
                               new QueryParameter("BusinessSeniorityScore", BusinessSeniorityScore),
                               new QueryParameter("ConsumerScore", ConsumerScore),
                               new QueryParameter("ConsumerScoreWeight", ConsumerScoreWeight),
                               new QueryParameter("ConsumerScoreGrade", ConsumerScoreGrade),
                               new QueryParameter("ConsumerScoreScore", ConsumerScoreScore),
                               new QueryParameter("NetWorth", NetWorth),
                               new QueryParameter("NetWorthWeight", NetWorthWeight),
                               new QueryParameter("NetWorthGrade", NetWorthGrade),
                               new QueryParameter("NetWorthScore", NetWorthScore),
                               new QueryParameter("MaritalStatus", MaritalStatus.ToString()),
                               new QueryParameter("MaritalStatusWeight", MaritalStatusWeight),
                               new QueryParameter("MaritalStatusGrade", MaritalStatusGrade),
                               new QueryParameter("MaritalStatusScore", MaritalStatusScore),
                               new QueryParameter("NumberOfStores", NumberOfStores),
                               new QueryParameter("NumberOfStoresWeight", NumberOfStoresWeight),
                               new QueryParameter("NumberOfStoresGrade", NumberOfStoresGrade),
                               new QueryParameter("NumberOfStoresScore", NumberOfStoresScore),
                               new QueryParameter("PositiveFeedbacks", PositiveFeedbacks),
                               new QueryParameter("PositiveFeedbacksWeight", PositiveFeedbacksWeight),
                               new QueryParameter("PositiveFeedbacksGrade", PositiveFeedbacksGrade),
                               new QueryParameter("PositiveFeedbacksScore", PositiveFeedbacksScore),
                               new QueryParameter("EzbobSeniority", EzbobSeniority),
                               new QueryParameter("EzbobSeniorityWeight", EzbobSeniorityWeight),
                               new QueryParameter("EzbobSeniorityGrade", EzbobSeniorityGrade),
                               new QueryParameter("EzbobSeniorityScore", EzbobSeniorityScore),
                               new QueryParameter("NumOfLoans", NumOfLoans),
                               new QueryParameter("NumOfLoansWeight", NumOfLoansWeight),
                               new QueryParameter("NumOfLoansGrade", NumOfLoansGrade),
                               new QueryParameter("NumOfLoansScore", NumOfLoansScore),
                               new QueryParameter("NumOfLateRepayments", NumOfLateRepayments),
                               new QueryParameter("NumOfLateRepaymentsWeight", NumOfLateRepaymentsWeight),
                               new QueryParameter("NumOfLateRepaymentsGrade", NumOfLateRepaymentsGrade),
                               new QueryParameter("NumOfLateRepaymentsScore", NumOfLateRepaymentsScore),
                               new QueryParameter("NumOfEarlyRepayments", NumOfEarlyRepayments),
                               new QueryParameter("NumOfEarlyRepaymentsWeight", NumOfEarlyRepaymentsWeight),
                               new QueryParameter("NumOfEarlyRepaymentsGrade", NumOfEarlyRepaymentsGrade),
                               new QueryParameter("NumOfEarlyRepaymentsScore", NumOfEarlyRepaymentsScore),
                               new QueryParameter("ValueAdded", ValueAdded),
                               new QueryParameter("InnerFlowName", TurnoverType == null ? null : TurnoverType.ToString()),
                               new QueryParameter("TotalScore", TotalScore),
                               new QueryParameter("TotalScoreNormalized", TotalScoreNormalized),
                               new QueryParameter("Medal", MedalClassification.ToString()),
                               new QueryParameter("Error", Error),
                               new QueryParameter("OfferedLoanAmount", OfferedLoanAmount),
                               new QueryParameter("NumOfHmrcMps", NumOfHmrcMps),
                               new QueryParameter("ZooplaValue", ZooplaValue),
                               new QueryParameter("EarliestHmrcLastUpdateDate", EarliestHmrcLastUpdateDate),
                               new QueryParameter("EarliestYodleeLastUpdateDate", EarliestYodleeLastUpdateDate),
                               new QueryParameter("AmazonPositiveFeedbacks", AmazonPositiveFeedbacks),
                               new QueryParameter("EbayPositiveFeedbacks", EbayPositiveFeedbacks),
                               new QueryParameter("NumberOfPaypalPositiveTransactions", NumberOfPaypalPositiveTransactions),
                               new QueryParameter("MortgageBalance", MortgageBalance),
                               new QueryParameter("CapOfferByCustomerScoresValue", CapOfferByCustomerScoresValue),
                               new QueryParameter(
                                   "CapOfferByCustomerScoresTable",
                                   CapOfferByCustomerScoresTable.SafeToFormattedString()
                                   ),
                               new QueryParameter("Tag", tag),
                               new QueryParameter("MaxOfferedLoanAmount", MaxOfferedLoanAmount),
                               new QueryParameter("CashRequestID", cashRequestID),
                               new QueryParameter("NLCashRequestID", nlCashRequestID)
                               );
        }         // SaveToDb