Ejemplo n.º 1
0
        public override void Execute()
        {
            try {
                if (this.bankAccountTypeID == (int)I_InvestorAccountTypeEnum.Funding)
                {
                    this.systemBalanceTransactionSign = 1;
                    this.bankAccountType = I_InvestorAccountTypeEnum.Funding;
                }


                if (this.bankAccountTypeID == (int)I_InvestorAccountTypeEnum.Repayments)
                {
                    this.systemBalanceTransactionSign = -1;
                    this.bankAccountType = I_InvestorAccountTypeEnum.Repayments;
                }

                AddInvestorSystemBalance changeSystemBalance = new AddInvestorSystemBalance(this.investorAccountID,
                                                                                            this.now,
                                                                                            this.transactionAmount * this.systemBalanceTransactionSign,
                                                                                            null,
                                                                                            null,
                                                                                            null,
                                                                                            null,
                                                                                            this.transactionComment,
                                                                                            this.underwriterID,
                                                                                            this.transactionDate);
                changeSystemBalance.Execute();

                AddInvestorBankAccountBalance addBankAccountBalance = new AddInvestorBankAccountBalance(this.investorAccountID,
                                                                                                        this.now,
                                                                                                        this.transactionAmount,
                                                                                                        this.underwriterID,
                                                                                                        this.transactionComment,
                                                                                                        this.transactionDate,
                                                                                                        this.bankTransactionRef);
                addBankAccountBalance.Execute();
            } catch (Exception ex) {
                Log.Warn(ex, "Failed to execute {0} transfer of £{1} for investor bank account {2} into DB", this.bankAccountType, this.transactionAmount, this.investorAccountID);
                Result = false;
                throw;
            }

            Result = true;
            Log.Info("Executing {0} transfer of £{1} for investor bank account {2} into DB complete.", this.bankAccountType, this.transactionAmount, this.investorAccountID);
        }        //Execute
Ejemplo n.º 2
0
        }        //Execute

        private ActionResult HandleOneAssignedToLoanInvestor(SafeReader sr, bool bRowSetStart)
        {
            try {
                int     fundingBankAccountID = sr["FundingBankAccountID"];
                decimal investmentPercent    = sr["InvestmentPercent"];
                int     investorID           = sr["InvestorID"];
                int     loanTerm             = sr["RepaymentPeriod"];
                decimal loanAmount           = sr["LoanAmount"];
                int?    productTypeID        = sr["ProductTypeID"];

                I_Portfolio portfolio = new I_Portfolio {
                    InitialTerm    = loanTerm,
                    InvestorID     = investorID,
                    ProductTypeID  = productTypeID,
                    LoanID         = this.loanID,
                    LoanPercentage = investmentPercent,
                    Timestamp      = this.now,
                    GradeID        = this.bucket,
                };

                DB.ExecuteNonQuery("I_PortfolioSave", CommandSpecies.StoredProcedure, DB.CreateTableParameter("Tbl", portfolio));

                const int negative = -1;
                AddInvestorBankAccountBalance addBankAccountBalance = new AddInvestorBankAccountBalance(
                    fundingBankAccountID,
                    this.now,
                    loanAmount * investmentPercent * negative,
                    this.customerID,
                    "Loan was taken",
                    this.now,
                    ""
                    );
                addBankAccountBalance.Execute();
            } catch (Exception ex) {
                Log.Error(ex, "failed to link loan {0} to investor {1}",
                          this.loanID, sr["InvestorID"]);
            }
            return(ActionResult.Continue);
        }        //HandleOneAssignedToLoanInvestor