コード例 #1
0
ファイル: LoanServices.cs プロジェクト: jay3126/opencbs
        public Loan SimulateRescheduling(Loan loan, ScheduleConfiguration rescheduleConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = Mapper.Map<IEnumerable<Installment>, IEnumerable<IInstallment>>(copyOfLoan.InstallmentList);
            var scheduleBuilder = new ScheduleBuilder();
            var rescheduleAssembler = new RescheduleAssembler();
            var copyOfRescheduleConfiguration = (IScheduleConfiguration) rescheduleConfiguration.Clone();
            copyOfRescheduleConfiguration.InterestRate *=
                (decimal) scheduleConfiguration.PeriodPolicy.GetNumberOfPeriodsInYear(
                    copyOfRescheduleConfiguration.StartDate,
                    scheduleConfiguration.YearPolicy);

            schedule = rescheduleAssembler.AssembleRescheduling(
                schedule,
                scheduleConfiguration,
                copyOfRescheduleConfiguration,
                scheduleBuilder,
                loan.CalculateActualOlb().Value);

            var newSchedule = Mapper.Map<IEnumerable<IInstallment>, List<Installment>>(schedule);

            copyOfLoan.InstallmentList = newSchedule;
            copyOfLoan.NbOfInstallments = newSchedule.Count();
            return copyOfLoan;
        }
コード例 #2
0
        public Loan SimulateRescheduling(Loan loan, ScheduleConfiguration rescheduleConfiguration)
        {
            var copyOfLoan = loan.Copy();
            var scheduleConfiguration = _configurationFactory
                .Init()
                .WithLoan(copyOfLoan)
                .Finish()
                .GetConfiguration();

            var schedule = copyOfLoan.InstallmentList;
            var scheduleBuilder = new ScheduleBuilder();
            var rescheduleAssembler = new RescheduleAssembler();
            var copyOfRescheduleConfiguration = (IScheduleConfiguration)rescheduleConfiguration.Clone();
            if (loan.Product.ScriptName == null)
                schedule = rescheduleAssembler.AssembleRescheduling(
                    schedule,
                    scheduleConfiguration,
                    copyOfRescheduleConfiguration,
                    scheduleBuilder,
                    loan.CalculateActualOlb().Value).ToList();
            else
                schedule = AssembleRescheduling(loan, rescheduleConfiguration, scheduleConfiguration);

            copyOfLoan.InstallmentList = schedule;
            copyOfLoan.NbOfInstallments = schedule.Count();
            return copyOfLoan;
        }