public ShareApplicationsViewModel GetShareApplicationsViewModel(int vacancyReferenceNumber)
        {
            var vacancy = _vacancyPostingService.GetVacancyByReferenceNumber(vacancyReferenceNumber);
            var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationship(vacancy.VacancyOwnerRelationshipId, false);  // Closed vacancies can certainly have non-current vacancy parties
            var employer  = _employerService.GetEmployer(vacancyOwnerRelationship.EmployerId, false);
            var ukprn     = _currentUserService.GetClaimValue("ukprn");
            var provider  = _providerService.GetProvider(ukprn);
            var viewModel = new ShareApplicationsViewModel();

            viewModel.EmployerName           = employer.FullName;
            viewModel.ProviderName           = provider.TradingName;
            viewModel.VacancyType            = vacancy.VacancyType;
            viewModel.VacancyReferenceNumber = vacancyReferenceNumber;

            List <ApplicationSummary> applications = vacancy.VacancyType == VacancyType.Traineeship
                ? _traineeshipApplicationService.GetSubmittedApplicationSummaries(vacancy.VacancyId).Select(a => (ApplicationSummary)a).ToList()
                : _apprenticeshipApplicationService.GetSubmittedApplicationSummaries(vacancy.VacancyId).Select(a => (ApplicationSummary)a).ToList();

            var @new         = applications.Where(v => v.Status == ApplicationStatuses.Submitted).ToList();
            var viewed       = applications.Where(v => v.Status == ApplicationStatuses.InProgress).ToList();
            var successful   = applications.Where(v => v.Status == ApplicationStatuses.Successful).ToList();
            var unsuccessful = applications.Where(v => v.Status == ApplicationStatuses.Unsuccessful).ToList();

            viewModel.NewApplicationsCount          = @new.Count;
            viewModel.InProgressApplicationsCount   = viewed.Count;
            viewModel.SuccessfulApplicationsCount   = successful.Count;
            viewModel.UnsuccessfulApplicationsCount = unsuccessful.Count;
            viewModel.ApplicationSummaries          = _mapper.Map <List <ApplicationSummary>, List <ApplicationSummaryViewModel> >(applications.OrderBy(a => a.CandidateDetails.LastName).ToList());

            return(viewModel);
        }
        public VacancyOwnerRelationshipViewModel GetVacancyOwnerRelationshipViewModel(int vacancyOwnerRelationshipId)
        {
            var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationship(vacancyOwnerRelationshipId, true);
            var employer = _employerService.GetEmployer(vacancyOwnerRelationship.EmployerId, true);

            return(vacancyOwnerRelationship.Convert(employer));
        }
예제 #3
0
        public TraineeshipVacancyDetail GetVacancyDetails(int vacancyId, bool errorIfNotFound = false)
        {
            var vacancy = _vacancyReadRepository.Get(vacancyId);

            if (vacancy == null)
            {
                if (errorIfNotFound)
                {
                    throw new DomainException(ErrorCodes.VacancyNotFoundError, new { vacancyId });
                }
                return(null);
            }

            var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationship(vacancy.VacancyOwnerRelationshipId, false); // Some current vacancies have non-current vacancy parties
            var employer = _employerService.GetEmployer(vacancyOwnerRelationship.EmployerId, false);

            var providerSite = _providerService.GetProviderSite(vacancyOwnerRelationship.ProviderSiteId);

            if (providerSite == null)
            {
                throw new System.Exception($"Could not find VacancyOwnerRelationship for ProviderSiteId={vacancyOwnerRelationship.ProviderSiteId}");
            }

            var provider   = _providerService.GetProvider(vacancy.ContractOwnerId);
            var categories = _referenceDataProvider.GetCategories();

            return(TraineeshipVacancyDetailMapper.GetTraineeshipVacancyDetail(vacancy, employer, provider, providerSite, categories, _logService));
        }
예제 #4
0
        public IActionResult Get(string EmployerId)
        {
            var result = service.GetEmployer(EmployerId);

            return(Ok(new SuccessResponse <ResEmployerVM>
            {
                Code = 200,
                Data = result
            }));
        }
        private ApprenticeshipApplicationViewModel ConvertToApprenticeshipApplicationViewModel(ApprenticeshipApplicationDetail application, VacancyViewModel vacancyDetail)
        {
            var webSettings = _configurationService.Get <CommonWebConfiguration>();
            var domainUrl   = webSettings.SiteDomainName;
            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 <ApprenticeshipApplicationDetail, ApprenticeshipApplicationViewModel>(application);

            viewModel.Vacancy = _mapper.Map <Vacancy, ApplicationVacancyViewModel>(vacancy);
            viewModel.Vacancy.EmployerName = employer.FullName;
            viewModel.NextStepsUrl         = string.Format($"https://{domainUrl}/nextsteps");
            viewModel.UnSuccessfulReason   = application.UnsuccessfulReason;
            viewModel.UnsuccessfulDateTime = application.UnsuccessfulDateTime;
            viewModel.ProviderName         = vacancyDetail.Provider.TradingName;
            viewModel.Contact = vacancyDetail.Contact;

            return(viewModel);
        }
        public VacancyOwnerRelationship GetVacancyOwnerRelationship(int providerSiteId, string edsUrn)
        {
            Condition.Requires(providerSiteId);
            Condition.Requires(edsUrn).IsNotNullOrEmpty();

            _logService.Debug("Calling Employer Service to get employer with EDSURN='{0}'.", edsUrn);

            var employer = _employerService.GetEmployer(edsUrn);

            _logService.Debug(
                "Calling VacancyOwnerRelationshipReadRepository to get vacancy party for provider site with Id='{0}' and employer with Id='{1}'.",
                providerSiteId, employer.EmployerId);

            var vacancyOwnerRelationship =
                _vacancyOwnerRelationshipReadRepository.GetByProviderSiteAndEmployerId(providerSiteId, employer.EmployerId) ??
                new VacancyOwnerRelationship {
                ProviderSiteId = providerSiteId, EmployerId = employer.EmployerId
            };

            return(vacancyOwnerRelationship);
        }
예제 #7
0
        public GeoCodeAddressResult EmployerHasAValidAddress(int employerId)
        {
            var employer = _employerService.GetEmployer(employerId, true);

            if (NoGeoPoint(employer.Address) || InvalidGeopoint(employer.Address))
            {
                var geoPoint = _geoCodeLookupService.GetGeoPointFor(employer.Address);

                return(!geoPoint.IsSet() ? GeoCodeAddressResult.InvalidAddress : GeoCodeAddressResult.Ok);
            }

            return(GeoCodeAddressResult.Ok);
        }
        public IActionResult Detail(int id)
        {
            EmployerDetailViewModel model;

            /*var ads = new List<AdvertSingleViewModel>();
             * for (int i = 0; i < 20; i++) {
             *  ads.Add(new AdvertSingleViewModel()
             *  {
             *      Id = (i+1),
             *      Position = "Any pos pos pos",
             *      Description = "Any Description"
             *  });
             * }
             *
             * model = new EmployerDetailViewModel()
             * {
             *  FirstName = "Veselin" + id,
             *  MiddleName = "Hristov",
             *  LastName = "Penev",
             *  CompanyName = "Imaginary Coop.",
             *  ContactEmail = "*****@*****.**",
             *  ContactPhone = "0898420000",
             *  Age = 30,
             *  CompanyLocation = "Bulgaria, Sofia",
             *  HostAds = new IndexSingleAdViewModel() { Ads = ads }
             *
             * };*/

            try
            {
                model = service.GetEmployer(id);
            }
            catch (IndexOutOfRangeException)
            {
                return(this.View("InvalidAction", new InvalidActionViewModel()
                {
                    ErrorMessage = "Failed to execute last command:\nIndex was out of range"
                }));
            }
            catch (ArgumentException e)
            {
                return(this.View("InvalidAction", new InvalidActionViewModel()
                {
                    ErrorMessage = e.Message
                }));
            }

            return(View(model));
        }
        public async Task <IActionResult> GetEmployer()
        {
            string userId = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            return(Ok(await _employerService.GetEmployer(userId)));
        }
        public EmployerViewModel GetEmployer(int employerId)
        {
            var employer = _employerService.GetEmployer(employerId, false);

            return(employer.Convert());
        }