public void PublishVacancySummaryUpdate(Vacancy vacancy) { if (vacancy == null) { return; } try { if (vacancy.Status == VacancyStatus.Live) { var vacancySummary = _vacancySummaryService.GetByIds(new List <int> { vacancy.VacancyId }).Single(); var vacancyOwnerRelationship = _providerService.GetVacancyOwnerRelationships(new List <int> { vacancySummary.VacancyOwnerRelationshipId }, false).Single().Value; var employer = _employerService.GetEmployers(new List <int> { vacancyOwnerRelationship.EmployerId }).Single(); var providers = _providerService.GetProviders(new List <int> { vacancy.ContractOwnerId }).Single(); var categories = _referenceDataProvider.GetCategories().ToList(); if (vacancy.VacancyType == VacancyType.Apprenticeship) { _logService.Info($"Publishing apprenticeship summary message for vacancy id {vacancy.VacancyId}"); var apprenticeshipSummary = ApprenticeshipSummaryMapper.GetApprenticeshipSummary(vacancySummary, employer, providers, categories, _logService); var apprenticeshipSummaryUpdate = _mapper.Map <ApprenticeshipSummary, ApprenticeshipSummaryUpdate>(apprenticeshipSummary); apprenticeshipSummaryUpdate.UseAlias = true; _serviceBus.PublishMessage(apprenticeshipSummaryUpdate); _logService.Info($"Published apprenticeship summary message for vacancy id {vacancy.VacancyId}"); } if (vacancy.VacancyType == VacancyType.Traineeship) { _logService.Info($"Publishing traineeship summary message for vacancy id {vacancy.VacancyId}"); var traineeshipSummary = TraineeshipSummaryMapper.GetTraineeshipSummary(vacancySummary, employer, providers, categories, _logService); var traineeshipSummaryUpdate = _mapper.Map <TraineeshipSummary, TraineeshipSummaryUpdate>(traineeshipSummary); traineeshipSummaryUpdate.UseAlias = true; _serviceBus.PublishMessage(traineeshipSummaryUpdate); _logService.Info($"Published traineeship summary message for vacancy id {vacancy.VacancyId}"); } } } catch (Exception ex) { _logService.Warn($"Failed to publish vacancy summary message for vacancy id {vacancy.VacancyId}", ex); } }
public ActionResult Create() { ViewBag.EmployerId = new SelectList(employerService.GetEmployers(), "EmployerId", "EmployerName"); ViewBag.CityId = new SelectList(cityService.GetCities(), "CityId", "CityName"); ViewBag.ExperienceId = new SelectList(experienceService.GetExperiences(), "ExperienceId", "ExperienceName"); var socialrights = new List <SocialRight>(socialService.GetSocialRights()); var socialrightnames = new string[socialrights.Count()]; for (int i = 0; i < socialrights.Count(); i++) { socialrightnames[i] = socialrights[i].SocialRightName; } ViewBag.SocialRightNames = socialrightnames; return(View()); }
private List <VacancyOwnerRelationship> GetVacancyParties(EmployerSearchRequest request) { Condition.Requires(request).IsNotNull(); _logService.Debug( "Calling VacancyOwnerRelationshipReadRepository to get vacancy party for provider site with Id='{0}'.", request.ProviderSiteId); var vacancyParties = _vacancyOwnerRelationshipReadRepository.GetByProviderSiteId(request.ProviderSiteId).ToList(); if (request.IsQuery) { var employers = _employerService.GetEmployers(vacancyParties.Select(v => v.EmployerId).Distinct()); if (request.IsEmployerEdsUrnQuery) { employers = employers.Where(e => e.EdsUrn == request.EmployerEdsUrn); } else if (request.IsNameAndLocationQuery) { employers = employers.Where(employer => employer.FullName.ToLower().Contains(request.Name.ToLower()) && IsMatchingAddress(request, employer)); } else if (request.IsNameQuery) { employers = employers.Where(e => e.FullName.ToLower().Contains(request.Name.ToLower())); } else if (request.IsLocationQuery) { employers = employers.Where(e => IsMatchingAddress(request, e)); } vacancyParties = vacancyParties.Where(vp => employers.Any(e => e.EmployerId == vp.EmployerId)).ToList(); } return(vacancyParties); }
// api/Employer/GetEmployersList public IHttpActionResult Get() { var employers = _employerService.GetEmployers(); return(Ok(employers)); }