Example #1
0
        public Vacancy ArchiveVacancy(Vacancy vacancy)
        {
            Condition.Requires(vacancy);

            vacancy.Status = VacancyStatus.Completed;

            return(_upsertVacancyStrategy.UpsertVacancy(vacancy, v => _vacancyWriteRepository.Update(v)));
        }
Example #2
0
        public Vacancy UpdateVacancy(Vacancy vacancy)
        {
            if (vacancy.Status == VacancyStatus.Completed)
            {
                var message = $"Vacancy {vacancy.VacancyReferenceNumber} can not be in Completed status on saving.";
                throw new CustomException(message, ErrorCodes.EntityStateError);
            }

            // Make sure the standard is null if the vacancy is a traineeship (RA-30)
            SetStandardAsNullIfTraineeship(vacancy);
            SetSectorAsNullIfApprenticeship(vacancy);

            return(_upsertVacancyStrategy.UpsertVacancy(vacancy, v => _vacancyWriteRepository.Update(v)));
        }
Example #3
0
 public void ProcessVacancyClosure(VacancyEligibleForClosure vacancyEligibleForClosure)
 {
     var vacancy = _vacancyReadRepository.Get(vacancyEligibleForClosure.VacancyId);
     
     switch (vacancy.Status)
     {
         case VacancyStatus.Live:
             vacancy.Status = VacancyStatus.Closed;
             _vacancyWriteRepository.Update(vacancy);
             break;
         default:
             return;
     }
 }