public void Handle(ApplicationHousekeepingRequest request)
        {
            ApplicationDetail application;

            switch (request.VacancyType)
            {
            case VacancyType.Apprenticeship:
            {
                application = _apprenticeshipApplicationReadRepository.Get(request.ApplicationId, false);

                if (application == null)
                {
                    _logService.Debug("Apprenticeship application no longer exists, no housekeeping to do for id={0}",
                                      request.ApplicationId);
                    return;
                }
                break;
            }

            case VacancyType.Traineeship:
            {
                application = _traineeshipApplicationReadRepository.Get(request.ApplicationId, false);

                if (application == null)
                {
                    _logService.Debug("Traineeship application no longer exists, no housekeeping to do for id={0}",
                                      request.ApplicationId);
                    return;
                }
                break;
            }

            default:
                throw new InvalidOperationException(string.Format("Unknown vacancy type: {0}.", request.VacancyType));
            }

            if (application.DateApplied.HasValue && application.DateApplied <= GetHousekeepingDate())
            {
                _logService.Info("Deleting submitted application: type={0}, id={1}, date applied={2}",
                                 request.VacancyType, request.ApplicationId, application.DateApplied);

                _hardDeleteApplicationStrategy.Delete(
                    request.VacancyType,
                    request.ApplicationId);

                _logService.Info("Deleted submitted application: type={0}, id={1}, date applied={2}",
                                 request.VacancyType, request.ApplicationId, application.DateApplied);
                return;
            }

            Successor.Handle(request);
        }
Beispiel #2
0
        public void Handle(ApplicationHousekeepingRequest request)
        {
            switch (request.VacancyType)
            {
            case VacancyType.Apprenticeship:
            {
                var application = _apprenticeshipApplicationReadRepository.Get(request.ApplicationId, false);

                if (application == null)
                {
                    _logService.Debug("Apprenticeship application no longer exists, no housekeeping to do for id={0}",
                                      request.ApplicationId);

                    return;
                }

                if (!application.DateApplied.HasValue && application.Vacancy.ClosingDate <= GetHousekeepingDate())
                {
                    _logService.Info("Deleting unsubmitted application for expired vacancy: type={0}, id={1}, vacancy closing date={2}",
                                     request.VacancyType, request.ApplicationId, application.Vacancy.ClosingDate);

                    _hardDeleteApplicationStrategy.Delete(
                        request.VacancyType,
                        request.ApplicationId);

                    _logService.Info("Deleted unsubmitted application for expired vacancy: type={0}, id={1}, vacancy closing date={2}",
                                     request.VacancyType, request.ApplicationId, application.Vacancy.ClosingDate);
                    return;
                }
                break;
            }

            case VacancyType.Traineeship:
                // There are no draft traineeship applications.
                break;

            default:
                throw new InvalidOperationException(string.Format("Unknown vacancy type: {0}.", request.VacancyType));
            }

            Successor.Handle(request);
        }
 protected bool Equals(ApplicationHousekeepingRequest other)
 {
     return(ApplicationId.Equals(other.ApplicationId));
 }
Beispiel #4
0
 public void Handle(ApplicationHousekeepingRequest request)
 {
     _draftApplicationForExpiredVacancyHousekeeper.Handle(request);
 }