protected CourseValidationResult CreateValidationResult(
            DataLockValidationModel dataLockValidationModel,
            List <DataLockFailure> dataLockFailures,
            List <long> invalidApprenticeshipPriceEpisodeIds)
        {
            var result = new CourseValidationResult();

            if (dataLockFailures.Any())
            {
                result.DataLockFailures = dataLockFailures;
            }
            else
            {
                result.MatchedPriceEpisode = dataLockValidationModel.Apprenticeship
                                             .ApprenticeshipPriceEpisodes
                                             .FirstOrDefault(x => !x.Removed && !invalidApprenticeshipPriceEpisodeIds.Contains(x.Id));
            }

            return(result);
        }
Esempio n. 2
0
        private EarningPeriod BuildEarningPeriodWithApprenticeship(EarningPeriod period, ApprenticeshipModel apprenticeship, CourseValidationResult validationResult)
        {
            var newEarningPeriod = CreateEarningPeriod(period);

            newEarningPeriod.AccountId                    = apprenticeship.AccountId;
            newEarningPeriod.ApprenticeshipId             = apprenticeship.Id;
            newEarningPeriod.ApprenticeshipPriceEpisodeId = validationResult.MatchedPriceEpisode.Id;
            newEarningPeriod.TransferSenderAccountId      = apprenticeship.TransferSendingEmployerAccountId;
            newEarningPeriod.Priority     = apprenticeship.Priority;
            newEarningPeriod.AgreedOnDate = apprenticeship.AgreedOnDate;
            newEarningPeriod.ApprenticeshipEmployerType = apprenticeship.ApprenticeshipEmployerType;

            return(newEarningPeriod);
        }