public ApplicationSelectionViewModel SetTraineeshipStateSubmitted(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var applicationId = applicationSelectionViewModel.ApplicationId;

            _traineeshipApplicationService.SetStateSubmitted(applicationId);
            return(applicationSelectionViewModel);
        }
        public TraineeshipApplicationViewModel GetTraineeshipApplicationViewModel(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var application = _traineeshipApplicationService.GetApplication(applicationSelectionViewModel.ApplicationId);
            var viewModel   = ConvertToTraineeshipApplicationViewModel(application, applicationSelectionViewModel);

            return(viewModel);
        }
        public ApplicationSelectionViewModel SendUnsuccessfulDecision(ApplicationSelectionViewModel applicationSelectionViewModel, string candidateApplicationFeedback)
        {
            var applicationId = applicationSelectionViewModel.ApplicationId;

            _apprenticeshipApplicationService.SetUnsuccessfulDecision(applicationId, candidateApplicationFeedback);
            return(applicationSelectionViewModel);
        }
        public ApplicationSelectionViewModel SetTraineeshipStateInProgress(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var applicationId = applicationSelectionViewModel.ApplicationId;

            _traineeshipApplicationService.SetStateInProgress(applicationId);
            return(applicationSelectionViewModel);
        }
        public ApplicationSelectionViewModel SendSuccessfulDecision(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var applicationId = applicationSelectionViewModel.ApplicationId;

            _apprenticeshipApplicationService.SetSuccessfulDecision(applicationId);
            return(applicationSelectionViewModel);
        }
Пример #6
0
        public MediatorResponse <ApplicationSelectionViewModel> RevertToInProgress(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var applicationViewModel = _applicationProvider.GetApprenticeshipApplicationViewModel(applicationSelectionViewModel);
            var viewModel            = _applicationProvider.SetStateInProgress(applicationSelectionViewModel);

            var candidateName = applicationViewModel.ApplicantDetails.Name;
            var message       = string.Format(ApplicationViewModelMessages.RevertToInProgressFormat, candidateName);

            return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.RevertToInProgress.Ok, viewModel, message, UserMessageLevel.Info));
        }
        public MediatorResponse <TraineeshipApplicationViewModel> Review(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            if (applicationSelectionViewModel.ApplicationId == Guid.Empty)
            {
                _logService.Info("Review vacancy failed: VacancyGuid is empty.");
                return(GetMediatorResponse(TraineeshipApplicationMediatorCodes.Review.NoApplicationId, new TraineeshipApplicationViewModel(), ApplicationPageMessages.ApplicationNotFound, UserMessageLevel.Info));
            }
            var viewModel = _applicationProvider.GetTraineeshipApplicationViewModel(applicationSelectionViewModel);

            return(GetMediatorResponse(TraineeshipApplicationMediatorCodes.Review.Ok, viewModel));
        }
Пример #8
0
        public void ShouldReturnNoVacancyIdIfNoVacancyGuidIsSuppliedOnConfirmUnsuccessfulDecision()
        {
            var logService = new Mock <ILogService>();
            var mediator   = new ApprenticeshipApplicationMediator(null, null, null, null, logService.Object);

            var viewModel = new ApplicationSelectionViewModel(new VacancyApplicationsSearchViewModel(), Guid.Empty);

            var respone = mediator.ConfirmUnsuccessfulDecision(viewModel);

            respone.AssertCodeAndMessage(ApprenticeshipApplicationMediatorCodes.ConfirmUnsuccessfulDecision.NoApplicationId, false, false);
            logService.Verify(l => l.Error("Confirm unsuccessful decision failed: VacancyGuid is empty."));
        }
Пример #9
0
        public ActionResult ApplicationSelection()
        {
            var model = new ApplicationSelectionViewModel()
            {
                CurrentCulture     = CurrentCulture,
                CurrentUser        = CurrentUser,
                CurrentTenant      = CurrentTenant,
                CurrentApplication = CurrentApplication,
            };

            return(PartialView(model));
        }
        public void ShouldReturnNoVacancyIdIfNoVacancyGuidIsSuppliedOnReview()
        {
            var logService = new Mock <ILogService>();
            var mediator   = new TraineeshipApplicationMediator(null, null, null, null, logService.Object);

            var viewModel = new ApplicationSelectionViewModel(new VacancyApplicationsSearchViewModel(), Guid.Empty);

            var respone = mediator.Review(viewModel);

            respone.AssertCodeAndMessage(TraineeshipApplicationMediatorCodes.Review.NoApplicationId, false, false);
            logService.Verify(l => l.Info("Review vacancy failed: VacancyGuid is empty."));
        }
        public ActionResult Review(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var response = _traineeshipApplicationMediator.Review(applicationSelectionViewModel);

            switch (response.Code)
            {
            case TraineeshipApplicationMediatorCodes.Review.Ok:
                return(View(response.ViewModel));

            default:
                throw new InvalidMediatorCodeException(response.Code);
            }
        }
        public ActionResult ConfirmRevertToInProgress(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var response = _apprenticeshipApplicationMediator.ConfirmRevertToInProgress(applicationSelectionViewModel);

            switch (response.Code)
            {
            case ApprenticeshipApplicationMediatorCodes.ConfirmRevertToInProgress.Ok:
                return(View(response.ViewModel));

            case ApprenticeshipApplicationMediatorCodes.ConfirmRevertToInProgress.NoApplicationId:
                SetUserMessage(response.Message);
                return(RedirectToRoute(RecruitmentRouteNames.RecruitmentHome));

            default:
                throw new InvalidMediatorCodeException(response.Code);
            }
        }
Пример #13
0
        public MediatorResponse <ApprenticeshipApplicationViewModel> View(string applicationCipherText)
        {
            applicationCipherText = HttpUtility.UrlDecode(applicationCipherText);
            applicationCipherText = applicationCipherText?.Replace(' ', '+');

            var anomymisedApplicationLink = _decryptionService.Decrypt(applicationCipherText);

            var applicationSelectionViewModel = new ApplicationSelectionViewModel
            {
                ApplicationId = anomymisedApplicationLink.ApplicationId
            };

            var viewModel = _applicationProvider.GetApprenticeshipApplicationViewModel(applicationSelectionViewModel);

            if (_dateTimeService.UtcNow > anomymisedApplicationLink.ExpirationDateTime)
            {
                return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.View.LinkExpired, viewModel));
            }

            return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.View.Ok, viewModel));
        }
        private TraineeshipApplicationViewModel ConvertToTraineeshipApplicationViewModel(TraineeshipApplicationDetail application, ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var vacancy = _vacancyPostingService.GetVacancy(application.Vacancy.Id);
            var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationship(vacancy.VacancyOwnerRelationshipId, false);  // Closed vacancies can certainly have non-current vacancy parties
            var employer  = _employerService.GetEmployer(vacancyOwnerRelationship.EmployerId, false);
            var viewModel = _mapper.Map <TraineeshipApplicationDetail, TraineeshipApplicationViewModel>(application);

            viewModel.ApplicationSelection = applicationSelectionViewModel;
            viewModel.Vacancy = _mapper.Map <Vacancy, ApplicationVacancyViewModel>(vacancy);
            viewModel.Vacancy.EmployerName = employer.FullName;
            return(viewModel);
        }
        public ApprenticeshipApplicationViewModel GetApprenticeshipApplicationViewModel(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var application = _apprenticeshipApplicationService.GetApplication(applicationSelectionViewModel.ApplicationId);
            var viewModel   = ConvertToApprenticeshipApplicationViewModel(application, applicationSelectionViewModel);

            return(viewModel);
        }
Пример #16
0
        private ApprenticeshipApplicationViewModel GetFailedUpdateApprenticeshipApplicationViewModel(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var viewModel = _applicationProvider.GetApprenticeshipApplicationViewModel(applicationSelectionViewModel);

            viewModel.Notes = viewModel.Notes;
            return(viewModel);
        }
Пример #17
0
        public MediatorResponse <ApprenticeshipApplicationViewModel> ConfirmRevertToInProgress(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            if (applicationSelectionViewModel.ApplicationId == Guid.Empty)
            {
                _logService.Error("Confirm revert to viewed failed: VacancyGuid is empty.");
                return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.ConfirmRevertToInProgress.NoApplicationId, new ApprenticeshipApplicationViewModel(), ApplicationPageMessages.ApplicationNotFound, UserMessageLevel.Info));
            }

            var viewModel = _applicationProvider.GetApprenticeshipApplicationViewModel(applicationSelectionViewModel);

            return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.ConfirmRevertToInProgress.Ok, viewModel));
        }
Пример #18
0
        public MediatorResponse <ApprenticeshipApplicationViewModel> SendSuccessfulDecision(ApplicationSelectionViewModel applicationSelectionViewModel)
        {
            var viewModel            = _applicationProvider.SendSuccessfulDecision(applicationSelectionViewModel);
            var applicationViewModel = _applicationProvider.GetApprenticeshipApplicationViewModel(viewModel);

            applicationViewModel.ConfirmationStatusSentMessage = ApplicationViewModelMessages.SuccessfulDecisionFormat;
            return(GetMediatorResponse(ApprenticeshipApplicationMediatorCodes.SendSuccessfulDecision.Ok, applicationViewModel));
        }