public Domain.Entities.Apprenticeship Map(Apprenticeship apprenticeship, CallerType callerType)
        {
            var domainApprenticeship = new Domain.Entities.Apprenticeship
            {
                Id              = apprenticeship.Id,
                FirstName       = apprenticeship.FirstName,
                LastName        = apprenticeship.LastName,
                DateOfBirth     = apprenticeship.DateOfBirth,
                NINumber        = apprenticeship.NINumber,
                ULN             = apprenticeship.ULN,
                CommitmentId    = apprenticeship.CommitmentId,
                PaymentStatus   = (PaymentStatus)apprenticeship.PaymentStatus,
                AgreementStatus = (AgreementStatus)apprenticeship.AgreementStatus,
                TrainingType    = (TrainingType)apprenticeship.TrainingType,
                TrainingCode    = apprenticeship.TrainingCode,
                TrainingName    = apprenticeship.TrainingName,
                Cost            = apprenticeship.Cost,
                StartDate       = apprenticeship.StartDate,
                EndDate         = apprenticeship.EndDate,
                PauseDate       = apprenticeship.PauseDate
                                  // We do not want to map reservation id as the reservation is not set in V1
            };

            if (callerType.IsEmployer())
            {
                domainApprenticeship.EmployerRef = apprenticeship.EmployerRef;
            }
            else
            {
                domainApprenticeship.ProviderRef = apprenticeship.ProviderRef;
            }

            return(domainApprenticeship);
        }
 public Apprenticeship MapFrom(Domain.Entities.Apprenticeship source, CallerType callerType)
 {
     return(new Apprenticeship
     {
         Id = source.Id,
         CommitmentId = source.CommitmentId,
         EmployerAccountId = source.EmployerAccountId,
         ProviderId = source.ProviderId,
         TransferSenderId = source.TransferSenderId,
         Reference = source.Reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         ULN = source.ULN,
         TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType,
         TrainingCode = source.TrainingCode,
         TrainingName = source.TrainingName,
         Cost = source.Cost,
         StartDate = source.StartDate,
         EndDate = source.EndDate,
         PauseDate = source.PauseDate,
         CompletionDate = source.CompletionDate,
         StopDate = source.StopDate,
         PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus,
         AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus,
         DateOfBirth = source.DateOfBirth,
         NINumber = source.NINumber,
         EmployerRef = source.EmployerRef,
         ProviderRef = source.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer
                 ? source.EmployerCanApproveApprenticeship
                 : source.ProviderCanApproveApprenticeship,
         PendingUpdateOriginator = (Api.Types.Apprenticeship.Types.Originator?)source.UpdateOriginator,
         ProviderName = source.ProviderName,
         LegalEntityId = source.LegalEntityId,
         LegalEntityName = source.LegalEntityName,
         AccountLegalEntityPublicHashedId = source.AccountLegalEntityPublicHashedId,
         DataLockCourse = source.DataLockCourse,
         DataLockPrice = source.DataLockPrice,
         DataLockCourseTriaged = source.DataLockCourseTriaged,
         DataLockCourseChangeTriaged = source.DataLockCourseChangeTriaged,
         DataLockPriceTriaged = source.DataLockPriceTriaged,
         HasHadDataLockSuccess = source.HasHadDataLockSuccess,
         EndpointAssessorName = source.EndpointAssessorName,
         ReservationId = source.ReservationId,
         ContinuationOfId = source.ContinuationOfId,
         MadeRedundant = source.MadeRedundant,
         ChangeOfPartyRequests = MapChangeOfParty(source.ChangeOfPartyRequests),
         IsChangeOfProviderContinuation = source.IsChangeOfProviderContinuation
     });
 }
 public Apprenticeship MapFromV2(Domain.Entities.Apprenticeship source, CallerType callerType)
 {
     return(new Apprenticeship
     {
         Id = source.Id,
         CommitmentId = source.CommitmentId,
         EmployerAccountId = source.EmployerAccountId,
         ProviderId = source.ProviderId,
         TransferSenderId = source.TransferSenderId,
         Reference = source.Reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         ULN = source.ULN,
         TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType,
         TrainingCode = source.TrainingCode,
         TrainingName = source.TrainingName,
         Cost = source.Cost,
         StartDate = source.StartDate,
         EndDate = source.EndDate,
         PauseDate = source.PauseDate,
         StopDate = source.StopDate,
         PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus,
         AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus,
         DateOfBirth = source.DateOfBirth,
         NINumber = source.NINumber,
         EmployerRef = source.EmployerRef,
         ProviderRef = source.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer
                 ? source.EmployerCanApproveApprenticeship
                 : source.ProviderCanApproveApprenticeship,
         PendingUpdateOriginator = (Api.Types.Apprenticeship.Types.Originator?)source.UpdateOriginator,
         ProviderName = source.ProviderName,
         LegalEntityId = source.LegalEntityId,
         LegalEntityName = source.LegalEntityName,
         AccountLegalEntityPublicHashedId = source.AccountLegalEntityPublicHashedId,
         DataLockCourse = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Unknown),
         DataLockPrice = source.DataLocks.Any(x => x.IsPriceOnly() && x.TriageStatus == TriageStatus.Unknown),
         DataLockCourseTriaged = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Restart),
         DataLockCourseChangeTriaged = source.DataLocks.Any(x => x.WithCourseError() && x.TriageStatus == TriageStatus.Change),
         DataLockPriceTriaged = source.DataLocks.Any(x => x.IsPriceOnly() && x.TriageStatus == TriageStatus.Change),
         HasHadDataLockSuccess = source.HasHadDataLockSuccess,
         EndpointAssessorName = source.EndpointAssessorName,
         ReservationId = source.ReservationId
     });
 }
 public Apprenticeship MapFrom(Domain.Entities.Apprenticeship source, CallerType callerType)
 {
     return(new Apprenticeship
     {
         Id = source.Id,
         CommitmentId = source.CommitmentId,
         EmployerAccountId = source.EmployerAccountId,
         ProviderId = source.ProviderId,
         Reference = source.Reference,
         FirstName = source.FirstName,
         LastName = source.LastName,
         ULN = source.ULN,
         TrainingType = (Api.Types.Apprenticeship.Types.TrainingType)source.TrainingType,
         TrainingCode = source.TrainingCode,
         TrainingName = source.TrainingName,
         Cost = source.Cost,
         StartDate = source.StartDate,
         EndDate = source.EndDate,
         PauseDate = source.PauseDate,
         PaymentStatus = (Api.Types.Apprenticeship.Types.PaymentStatus)source.PaymentStatus,
         AgreementStatus = (Api.Types.AgreementStatus)source.AgreementStatus,
         DateOfBirth = source.DateOfBirth,
         NINumber = source.NINumber,
         EmployerRef = source.EmployerRef,
         ProviderRef = source.ProviderRef,
         CanBeApproved = callerType == CallerType.Employer
                 ? source.EmployerCanApproveApprenticeship
                 : source.ProviderCanApproveApprenticeship,
         PendingUpdateOriginator = (Api.Types.Apprenticeship.Types.Originator?)source.UpdateOriginator,
         ProviderName = source.ProviderName,
         LegalEntityId = source.LegalEntityId,
         LegalEntityName = source.LegalEntityName,
         DataLockCourse = source.DataLockCourse,
         DataLockPrice = source.DataLockPrice,
         DataLockCourseTriaged = source.DataLockCourseTriaged,
         DataLockCourseChangeTriaged = source.DataLockCourseChangeTriaged,
         DataLockPriceTriaged = source.DataLockPriceTriaged,
         HasHadDataLockSuccess = source.HasHadDataLockSuccess
     });
 }