/// <summary> /// Calculate Loan. /// </summary> /// <returns>Calculated LoanEntity Object.</returns> public LoanEntity Calculate() { var IDate = this.loanEntity.CValueDate; for (int i = 0; i < this.loanEntity.CInstallmentCount; i++) { this.loanEntity.AmortizationSchedule.Add(new AmortizationScheduleRow { IRowNumber = i + 1, IValueDate = i == 0 ? this.loanEntity.CValueDate : DateUtilities.AddMonth(this.loanEntity.CFirstInstallmentDate, i - 1), IMaturityDate = DateUtilities.AddMonth(this.loanEntity.CFirstInstallmentDate, i), IProfitRate = this.loanEntity.CProfitRate, IBsmvRate = this.loanEntity.CBsmvRate, IKkdfRate = this.loanEntity.CKkdfRate, IKdvRate = this.loanEntity.CKdvRate }); } //this.loanEntity.AmortizationSchedule.FirstOrDefault(s => s.IRowNumber == 1).IFixity = FixityTypes.InstallmentAmount; //this.loanEntity.AmortizationSchedule.FirstOrDefault(s => s.IRowNumber == 1).IAmount = 500000; //Taksit Tarihlerini iş gününe geliyorsa ötele foreach (var row in this.loanEntity.AmortizationSchedule) { if (row.IRowNumber > 1) { row.IValueDate = DateUtilities.GetBusinessDay(row.IValueDate, culture); } row.IMaturityDate = DateUtilities.GetBusinessDay(row.IMaturityDate, culture); } var installment = new Installment(); return(installment.CalculateInstallments(this.loanEntity)); }