Beispiel #1
0
 public CommitmentView MapFrom(Commitment commitment, CallerType callerType)
 {
     return(new CommitmentView
     {
         Id = commitment.Id,
         Reference = commitment.Reference,
         ProviderId = commitment.ProviderId,
         ProviderName = commitment.ProviderName,
         EmployerAccountId = commitment.EmployerAccountId,
         LegalEntityId = commitment.LegalEntityId,
         LegalEntityName = commitment.LegalEntityName,
         EditStatus = (Types.Commitment.Types.EditStatus)commitment.EditStatus,
         AgreementStatus = (AgreementStatus)_commitmentRules.DetermineAgreementStatus(commitment.Apprenticeships),
         LastAction = (Types.Commitment.Types.LastAction)commitment.LastAction,
         CanBeApproved = callerType == CallerType.Employer ? commitment.EmployerCanApproveCommitment : commitment.ProviderCanApproveCommitment,
         EmployerLastUpdateInfo = new LastUpdateInfo {
             Name = commitment.LastUpdatedByEmployerName, EmailAddress = commitment.LastUpdatedByEmployerEmail
         },
         ProviderLastUpdateInfo = new LastUpdateInfo {
             Name = commitment.LastUpdatedByProviderName, EmailAddress = commitment.LastUpdatedByProviderEmail
         },
         Apprenticeships = MapApprenticeshipsFrom(commitment.Apprenticeships, callerType),
         Messages = MapMessagesFrom(commitment.Messages)
     });
 }
Beispiel #2
0
 public CommitmentView MapFrom(Commitment commitment, CallerType callerType)
 {
     return(commitment == null
         ? null
         : new CommitmentView
     {
         Id = commitment.Id,
         Reference = commitment.Reference,
         ProviderId = commitment.ProviderId,
         ProviderName = commitment.ProviderName,
         EmployerAccountId = commitment.EmployerAccountId,
         LegalEntityId = commitment.LegalEntityId,
         LegalEntityName = commitment.LegalEntityName,
         LegalEntityAddress = commitment.LegalEntityAddress,
         AccountLegalEntityPublicHashedId = commitment.AccountLegalEntityPublicHashedId,
         EditStatus = (Types.Commitment.Types.EditStatus)commitment.EditStatus,
         AgreementStatus = (AgreementStatus)_commitmentRules.DetermineAgreementStatus(commitment.Apprenticeships),
         LastAction = (Types.Commitment.Types.LastAction)commitment.LastAction,
         CanBeApproved = CommitmentCanBeApproved(callerType, commitment),
         EmployerLastUpdateInfo = new LastUpdateInfo {
             Name = commitment.LastUpdatedByEmployerName, EmailAddress = commitment.LastUpdatedByEmployerEmail
         },
         ProviderLastUpdateInfo = new LastUpdateInfo {
             Name = commitment.LastUpdatedByProviderName, EmailAddress = commitment.LastUpdatedByProviderEmail
         },
         Apprenticeships = MapApprenticeshipsFrom(commitment.Apprenticeships, callerType),
         Messages = MapMessagesFrom(commitment.Messages),
         TransferSender = MapTransferSenderInfo(commitment),
         ApprenticeshipEmployerTypeOnApproval = (ApprenticeshipEmployerTypeOnApproval?)commitment.ApprenticeshipEmployerTypeOnApproval,
         ChangeOfPartyRequestId = commitment.ChangeOfPartyRequestId
     });
 }
        public CommitmentSummaryViewModel MapToCommitmentSummaryViewModel(Commitment commitment)
        {
            var agremmentStatus = _commitmentRules.DetermineAgreementStatus(commitment.Apprenticeships);
            var status          = _statusCalculator.GetStatus(commitment.EditStatus,
                                                              commitment.Apprenticeships.Count,
                                                              commitment.LastAction,
                                                              agremmentStatus,
                                                              commitment.TransferSenderId,
                                                              commitment.TransferApprovalStatus);

            return(new CommitmentSummaryViewModel
            {
                CohortReference = _hashingService.HashValue(commitment.Id),
                HashedAccountId = _hashingService.HashValue(commitment.EmployerAccountId),
                EmployerName = commitment.LegalEntityName,
                ProviderName = commitment.ProviderName,
                ProviderUkprn = commitment.ProviderId,
                CohortStatusText = status.GetEnumDescription()
            });
        }