public static Agreement Create(LoanApplication loanApplication, AgreementType loanAgreementType, DateTime today) { Agreement agreement = new Agreement(); agreement.AgreementType = loanAgreementType; agreement.Application = loanApplication.Application; agreement.AgreementDate = today; agreement.EffectiveDate = today; Context.Agreements.AddObject(agreement); //Context.SaveChanges(); return agreement; }
public static LoanDisbursementVcr CreateForAdditionalLoan(LoanApplication loanApplication, Agreement agreement, decimal additionalAmount, DateTime today) { LoanDisbursementVcr disbursement = new LoanDisbursementVcr(); disbursement.Agreement = agreement; disbursement.Date = today; disbursement.Amount = loanApplication.LoanAmount; disbursement.Balance = additionalAmount; Context.LoanDisbursementVcrs.AddObject(disbursement); return disbursement; }
public OutstandingLoansModel(FinancialAccount fa, Agreement ag, FinancialAccountProduct fap, AgreementItem agreementItem, decimal totalPayments, DateTime date) { if (agreementItem == null) this.InterestRate = agreementItem.InterestRate; var loanAccount = fa.LoanAccount; this.LoanId = loanAccount.FinancialAccountId; this.LoanProduct = fap.FinancialProduct.Name; this.LoanAmount = loanAccount.LoanAmount; this.LoanTerm = agreementItem.LoanTermLength; this.LoanReleaseDate = loanAccount.LoanReleaseDate; this.LoanBalance = loanAccount.LoanBalance + totalPayments; this.MaturityDate = fa.LoanAccount.MaturityDate; this.LoanTerm = agreementItem.LoanTermLength; this.InterestRate = agreementItem.InterestRate; var status = loanAccount.LoanAccountStatus.OrderByDescending(entity => entity.TransitionDateTime <= date).FirstOrDefault(); this.Status = status.LoanAccountStatusType.Name; var partyRole = fa.FinancialAccountRoles.SingleOrDefault(entity => entity.FinancialAccountId == fa.Id && entity.PartyRole.RoleTypeId == RoleType.OwnerFinancialType.Id).PartyRole; var party = partyRole.Party; if (party.PartyTypeId == PartyType.PersonType.Id) { Person personAsCustomer = party.Person; this.Name = StringConcatUtility.Build(" ", personAsCustomer.LastNameString + "," , personAsCustomer.FirstNameString, personAsCustomer.MiddleInitialString, personAsCustomer.NameSuffixString); } }