private IEnumerable <UploadError> GetOverlappingErrors(OverlappingApprenticeship overlappingResult, int i, ApprenticeshipUploadModel record) { const string textStartDate = "The <strong>start date</strong> overlaps with existing training dates for the same apprentice"; const string textEndDate = "The <strong>finish date</strong> overlaps with existing training dates for the same apprentice"; switch (overlappingResult.ValidationFailReason) { case ValidationFailReason.OverlappingStartDate: return(new List <UploadError> { new UploadError(textStartDate, "OverlappingError", i, record) }); case ValidationFailReason.OverlappingEndDate: return(new List <UploadError> { new UploadError(textEndDate, "OverlappingError", i, record) }); case ValidationFailReason.DateEmbrace: case ValidationFailReason.DateWithin: return(new List <UploadError> { new UploadError(textStartDate, "OverlappingError", i, record), new UploadError(textEndDate, "OverlappingError", i, record) }); } return(Enumerable.Empty <UploadError>()); }
private OverlappingApprenticeship MapFrom(ApprenticeshipResult source) { var result = new OverlappingApprenticeship { Apprenticeship = new Api.Types.Apprenticeship.Apprenticeship { Id = source.Id, CommitmentId = source.CommitmentId, StartDate = source.StartDate, EndDate = source.EndDate, ULN = source.Uln, EmployerAccountId = source.EmployerAccountId, ProviderId = source.ProviderId, TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType, TrainingCode = source.TrainingCode, TrainingName = source.TrainingName, Cost = source.Cost, PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus, AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus, DateOfBirth = source.DateOfBirth, EmployerRef = source.EmployerRef, ProviderRef = source.ProviderRef, FirstName = source.FirstName, LastName = source.LastName }, RequestApprenticeshipId = source.RequestApprenticeshipId, EmployerAccountId = source.EmployerAccountId, LegalEntityName = source.LegalEntityName, ProviderId = source.ProviderId, ProviderName = source.ProviderName, ValidationFailReason = (ValidationFailReason)source.ValidationFailReason, }; return(result); }