public List <ApprenticeshipContractTypeEarningsEvent> OriginalAndRedundancyEarningEventIfRequired(ApprenticeshipContractTypeEarningsEvent earningEvent,
                                                                                                          List <byte> redundancyPeriods)
        {
            var splitResults = new List <ApprenticeshipContractTypeEarningsEvent> {
                earningEvent
            };

            if (!redundancyPeriods.Any())
            {
                return(splitResults);
            }

            var redundancyEarningEvent = redundancyEarningEventFactory.CreateRedundancyContractTypeEarningsEvent(earningEvent);

            splitResults.Add(redundancyEarningEvent);

            earningEvent.OnProgrammeEarnings.ForEach(ope => { ope.Periods = RemoveRedundancyPeriods(ope.Periods, redundancyPeriods); });
            earningEvent.IncentiveEarnings.ForEach(ie => { ie.Periods = RemoveRedundancyPeriods(ie.Periods, redundancyPeriods); });

            redundancyEarningEvent.OnProgrammeEarnings.ForEach(ope =>
            {
                ope.Periods = RemoveNonRedundancyPeriods(ope.Periods, redundancyPeriods);
                SetPeriodsToFullContribution(ope.Periods);
            });
            redundancyEarningEvent.IncentiveEarnings.ForEach(ie =>
            {
                ie.Periods = RemoveNonRedundancyPeriods(ie.Periods, redundancyPeriods);
                SetPeriodsToFullContribution(ie.Periods);
            });

            return(splitResults);
        }
コード例 #2
0
        public List <ApprenticeshipContractTypeEarningsEvent> SplitContractEarningByRedundancyDate(ApprenticeshipContractTypeEarningsEvent earningEvent, DateTime redundancyDate)
        {
            var splitResults = new List <ApprenticeshipContractTypeEarningsEvent>();

            var redundancyPeriod = redundancyDate.GetPeriodFromDate();

            var redundancyEarningEvent = redundancyEarningEventFactory.CreateRedundancyContractTypeEarningsEvent(earningEvent);

            earningEvent.OnProgrammeEarnings.ForEach(ope => { ope.Periods = RemoveRedundancyPeriods(ope.Periods, redundancyPeriod); });
            earningEvent.IncentiveEarnings.ForEach(ie => { ie.Periods = RemoveRedundancyPeriods(ie.Periods, redundancyPeriod); });

            redundancyEarningEvent.OnProgrammeEarnings.ForEach(ope =>
            {
                ope.Periods = RemovePreRedundancyPeriods(ope.Periods, redundancyPeriod);
                SetPeriodsToFullContribution(ope.Periods);
            });
            redundancyEarningEvent.IncentiveEarnings.ForEach(ie =>
            {
                ie.Periods = RemovePreRedundancyPeriods(ie.Periods, redundancyPeriod);
                SetPeriodsToFullContribution(ie.Periods);
            });

            splitResults.Add(earningEvent);
            splitResults.Add(redundancyEarningEvent);

            return(splitResults);
        }