public InvestorLoanCashRequest GetInvestorLoanCashRequest(long cashRequestID) { var cashRequestData = Library.Instance.DB.FillFirst <I_CashRequestData>("I_GetInvestorLoanCashRequest", CommandSpecies.StoredProcedure, new QueryParameter("CashRequestsId", cashRequestID)); if (cashRequestData == null) { throw new Exception(string.Format("Couldn't resolve data for cash request ID: {0}", cashRequestID)); } GetLatestKnownInference strategy = new GetLatestKnownInference(cashRequestData.CustomerID, DateTime.Now, false); strategy.Execute(); int grade = 0; if (strategy.Inference != null && strategy.Inference.Bucket != null) { grade = strategy.Inference.Bucket; } var investorPrecentage = GetPrecentage((I_FundingTypeEnum)cashRequestData.FundingTypeID); if (investorPrecentage < 0) { throw new Exception("Couldn't calc investor precentage"); } return(new InvestorLoanCashRequest() { CashRequestID = cashRequestID, ManagerApprovedSum = cashRequestData.ManagerApprovedSum * (decimal)investorPrecentage, GradeID = grade, FundingType = investorPrecentage }); }
} // Execute private void BuildLogicalGlue() { var lg = new GetLatestKnownInference(this.customerID, this.now, false); lg.Execute(); if (lg.Inference == null) { return; } Result.LogicalGlueScore = lg.Inference.Score; Result.GradeID = lg.Inference.Bucket; if (Result.LogicalGlueScore.HasValue) { var subGrade = Result.SubGrades.FirstOrDefault( x => x.MaxScore > Result.LogicalGlueScore.Value && x.MinScore <= Result.LogicalGlueScore.Value ); if (subGrade != null) { Result.SubGradeID = subGrade.SubGradeID; } } // if } // BuildLogicalGlue
public void TestGetLatestKnownLogicalGlue() { var lgEngine = InjectorStub.GetEngine(); lgEngine.GetInference(1417, 0, false, GetInferenceMode.DownloadIfOld); var stra = new GetLatestKnownInference(1417, null, false); stra.Execute(); m_oLog.Debug("Inference is: {0}", stra.Inference); } // TestGetLatestKnownLogicalGlue
public void TestLogicalGlueCache() { GetLatestKnownInference inference = new GetLatestKnownInference(3406, DateTime.UtcNow, false); inference.Execute(); if (inference.Inference != null) { var bucket = inference.Inference.Bucket; Assert.IsNotNull(bucket); } }
public override void Execute() { IsForOpenPlatform = DB.ExecuteScalar <bool>("I_LoanForOpenPlatform", CommandSpecies.StoredProcedure, new QueryParameter("LoanID", this.loanID)); if (IsForOpenPlatform) { GetLatestKnownInference inference = new GetLatestKnownInference(this.customerID, this.now, false); inference.Execute(); if (inference.Inference != null) { this.bucket = inference.Inference.Bucket; } DB.ForEachRowSafe(HandleOneAssignedToLoanInvestor, "I_LoadAssigedToLoanInvestors", CommandSpecies.StoredProcedure, new QueryParameter("LoanID", this.loanID)); } //if } //Execute