public CalculateInstallmentsStrategy(CalculateInstallmentsOptions pCio, int pStartInstallment, OCurrency pStartAmount, int pNumberOfInstallments, ApplicationSettings pGeneralSettings) { _generalSettings = pGeneralSettings; OCurrency initialOLBOfContractBeforeRescheduling = Loan.InitialOlbOfContractBeforeRescheduling; if (pCio.IsExotic) { if (pCio.LoanType == OLoanTypes.Flat) _iCi = new Flat.ExoticStrategy(pCio.StartDate, pCio.Contract, _generalSettings); else _iCi = new Declining.ExoticStrategy(pCio.StartDate, pCio.Contract, _generalSettings); } else { if (pCio.LoanType == OLoanTypes.Flat) _iCi = new FlatStrategy(pCio.StartDate, pCio.Contract, _generalSettings, initialOLBOfContractBeforeRescheduling); else if (pCio.LoanType == OLoanTypes.DecliningFixedInstallments) { if (pCio.Contract.InterestRate == 0) _iCi = new FlatStrategy(pCio.StartDate, pCio.Contract, _generalSettings, initialOLBOfContractBeforeRescheduling); else _iCi = new FixedInstallmentStrategy(pCio.StartDate, pCio.Contract, pStartInstallment, pStartAmount, pNumberOfInstallments, _generalSettings); } else { if (pCio.Contract.InterestRate == 0) _iCi = new FlatStrategy(pCio.StartDate, pCio.Contract, _generalSettings, initialOLBOfContractBeforeRescheduling); else _iCi = new FixedPrincipalStrategy(pCio.StartDate, pCio.Contract, _generalSettings); } } }
/// <summary> /// This method calculates the correct set of installments for a contract. /// 4 cases are treated : /// - Flat rate non exotic /// - Flat rate exotic /// - Declining rate non exotic /// - Declining rate exotic /// </summary> /// <param name="pChangeDate">must be set to true when creation of the contract (here in constructor), must be false in all others cases</param> public List<Installment> CalculateInstallments(bool pChangeDate) { CalculateInstallmentsOptions cIo = new CalculateInstallmentsOptions(_startDate, Product.LoanType, Product.IsExotic, this, pChangeDate); CalculateInstallmentsStrategy cIs = new CalculateInstallmentsStrategy(cIo, 1, _amount, _nbOfInstallments, _generalSettings); return cIs.CalculateInstallments(pChangeDate); }