private void Update(Account account) { this.AccountLimit = account.AccountLimit; this.AccountTypeId = account.AccountTypeId; this.Available = account.Available; this.CreditRate = account.CreditRate; this.DebitRate = account.DebitRate; this.Floating = account.Floating; this.FloatingType = account.FloatingType; this.InstitutionId = account.InstitutionId; this.MonthlyFee = account.MonthlyFee; this.Name = account.Name; this.NetAmount = account.NetAmount; this.AccountIdentifier = account.AccountIdentifier; this.Maturity = account.Maturity; this.MonthlyPayment = account.MonthlyPayment; this.isDummy = account.isDummy; if (account.Floating) { RateInformation information = new RateInformation(); this.Spread = information.GetSpread(account); } else { this.Spread = 0; } AccountType type = new AccountType(); if (type.isAmortised(account.AccountTypeId) && account.Maturity != DateTime.MinValue && account.MonthlyPayment != 0) { AccountAmortisation amortisation = new AccountAmortisation(); amortisation.Update(account); } }
public double GetSpread(Account account) { using (FinPlannerContext _context = new FinPlannerContext()) { RateInformation information = _context.RateInformation.OrderByDescending(x => x.DateEffective).FirstOrDefault(); switch (account.FloatingType) { case "Prime": return(account.CreditRate - information.PrimeRate); } } return(0); }