Esempio n. 1
0
        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
            });
        }
Esempio n. 2
0
        }         // 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
Esempio n. 3
0
		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
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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