コード例 #1
0
        public async Task <VacancySubmittedConfirmationViewModel> GetVacancySubmittedConfirmationViewModelAsync(VacancyRouteModel vrm, VacancyUser vacancyUser)
        {
            var vacancy = await _utility.GetAuthorisedVacancyAsync(vrm, RouteNames.Submitted_Index_Get);

            if (vacancy.Status != VacancyStatus.Submitted)
            {
                throw new InvalidStateException(string.Format(ErrorMessages.VacancyNotSubmittedSuccessfully, vacancy.Title));
            }

            var isResubmit = false;

            if (vacancy.VacancyReference.HasValue)
            {
                var review = await _vacancyClient.GetCurrentReferredVacancyReviewAsync(vacancy.VacancyReference.Value);

                isResubmit = review != null;
            }

            var preferences = await _vacancyClient.GetUserNotificationPreferencesAsync(vacancyUser.UserId);

            var vm = new VacancySubmittedConfirmationViewModel
            {
                Title               = vacancy.Title,
                VacancyReference    = vacancy.VacancyReference?.ToString(),
                IsResubmit          = isResubmit,
                HasNotificationsSet = preferences != null && preferences.NotificationTypes > NotificationTypes.None
            };

            return(vm);
        }
コード例 #2
0
        public async Task <VacancyReviewedConfirmationViewModel> GetVacancyReviewedOrchestratorConfirmationViewModelAsync(VacancyRouteModel vrm, VacancyUser vacancyUser)
        {
            var vacancy = await Utility.GetAuthorisedVacancyAsync(_client, _vacancyClient, vrm, RouteNames.Reviewed_Index_Get);

            var employer = await _client.GetProviderEmployerVacancyDataAsync(vrm.Ukprn, vacancy.EmployerAccountId);

            var preferences = await _vacancyClient.GetUserNotificationPreferencesAsync(vacancyUser.UserId);

            if (vacancy.Status != VacancyStatus.Review)
            {
                throw new InvalidStateException(string.Format(ErrorMessages.VacancyNotReviewedSuccessfully, vacancy.Title));
            }

            var vm = new VacancyReviewedConfirmationViewModel
            {
                Title            = vacancy.Title,
                VacancyReference = vacancy.VacancyReference?.ToString(),
                EmployerName     = employer.Name,
                IsResubmit       = vacancy.ReviewCount > 1,
                IsVacancyRejectedByEmployerNotificationSelected = preferences.NotificationTypes.HasFlag(NotificationTypes.VacancyRejectedByEmployer)
            };

            return(vm);
        }
コード例 #3
0
        public async Task <ManageNotificationsViewModel> GetManageNotificationsViewModelAsync(VacancyUser vacancyUser)
        {
            var preferences = await _recruitVacancyClient.GetUserNotificationPreferencesAsync(vacancyUser.UserId);

            return(GetViewModelFromDomainModel(preferences));
        }