Exemple #1
0
        public RescheduleLoanEvent Reschedule(ReschedulingOptions ro, Loan contract, NonWorkingDateSingleton nwdS, ApplicationSettings applicationSettings)
        {
            _contract        = contract;
            _nwdS            = nwdS;
            _generalSettings = applicationSettings;

            switch (contract.Product.LoanType)
            {
            case OLoanTypes.Flat:
                _Reschedule_Flat(ro);
                break;

            case OLoanTypes.DecliningFixedPrincipal:
                _Reschedule_FixedPrincipal(ro);
                break;

            case OLoanTypes.DecliningFixedInstallments:
                _Reschedule_DecliningFixedInstallments(ro);
                break;
            }

            _Reschedule_AdjustOverpaid();

            RescheduleLoanEvent rSe = new RescheduleLoanEvent
            {
                Date         = ro.ReschedulingDate,
                Amount       = contract.CalculateActualOlb(),
                Interest     = contract.GetTotalInterestDue(),
                ClientType   = contract.ClientType,
                BadLoan      = contract.BadLoan,
                NbOfMaturity = ro.NewInstallments,
                DateOffset   = ro.RepaymentDateOffset,
                GracePeriod  = ro.GracePeriod,
                ChargeInterestDuringShift       = ro.ChargeInterestDuringShift,
                ChargeInterestDuringGracePeriod = ro.ChargeInterestDuringGracePeriod,
                InstallmentNumber =
                    contract.GetLastFullyRepaidInstallment() == null
                                                      ? 1
                                                      : contract.GetLastFullyRepaidInstallment().Number + 1
            };

            _contract.CalculateStartDates();
            return(rSe);
        }
Exemple #2
0
        public TrancheEvent AddTranche(TrancheOptions trancheOptions)
        {
            _trancheEvent = new TrancheEvent
            {
                Date         = trancheOptions.TrancheDate,
                InterestRate = trancheOptions.InterestRate,
                Amount       = trancheOptions.TrancheAmount,
                Maturity     = trancheOptions.CountOfNewInstallments,
                StartDate    = trancheOptions.TrancheDate,
                Number       = _currentLoan.GivenTranches.Count
            };

            trancheOptions.Number = _trancheEvent.Number;

            switch (_currentLoan.Product.LoanType)
            {
            case OLoanTypes.Flat:
            {
                AddFlatTranche(trancheOptions);
            }
            break;

            case OLoanTypes.DecliningFixedPrincipal:
            {
                AddFixedPrincipalTranche(trancheOptions);
            }
            break;

            case OLoanTypes.DecliningFixedInstallments:
            {
                AddFixedInstallmentTranche(trancheOptions);
            }
            break;
            }

            _currentLoan.CalculateStartDates();
            return(_trancheEvent);
        }