Exemplo n.º 1
0
        public DailySchedule Schedule(SupportScheduleSpecification supportScheduleSpecification)
        {
            var scheduleDate = supportScheduleSpecification.Date;

            _supportScheduleDateValidator.EnsureValid(scheduleDate);

            return(ScheduleWithoutValidation(supportScheduleSpecification));
        }
Exemplo n.º 2
0
        private DailySchedule ScheduleWithoutValidation(SupportScheduleSpecification supportScheduleSpecification)
        {
            var supportCandidates = _supportCandidateSelector.Select(supportScheduleSpecification);

            if (supportCandidates.Count() < ShiftsPerDay)
            {
                throw new UnableToMeetSpecificationSchedulingException(
                          supportScheduleSpecification,
                          "Not enough engineers meet requirements to schedule a full day");
            }

            var scheduledEngineers = _randomSelector.Select(supportCandidates).Take(ShiftsPerDay);
            var dailySchedule      = new DailySchedule(supportScheduleSpecification.Date, scheduledEngineers);

            _supportScheduleRepository.Save(dailySchedule);

            return(dailySchedule);
        }
 public SchedulingException(SupportScheduleSpecification supportScheduleSpecification, string message, Exception inner) : base(message, inner)
 {
     SupportScheduleSpecification = supportScheduleSpecification;
 }
 public SchedulingException(SupportScheduleSpecification supportScheduleSpecification)
 {
     SupportScheduleSpecification = supportScheduleSpecification;
 }
Exemplo n.º 5
0
 public UnableToMeetSpecificationSchedulingException(SupportScheduleSpecification supportScheduleSpecification, string message) : base(message)
 {
     SupportScheduleSpecification = supportScheduleSpecification;
 }
Exemplo n.º 6
0
 public UnableToMeetSpecificationSchedulingException(SupportScheduleSpecification supportScheduleSpecification)
 {
     SupportScheduleSpecification = supportScheduleSpecification;
 }