public DailySchedule Schedule(SupportScheduleSpecification supportScheduleSpecification) { var scheduleDate = supportScheduleSpecification.Date; _supportScheduleDateValidator.EnsureValid(scheduleDate); return(ScheduleWithoutValidation(supportScheduleSpecification)); }
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; }
public UnableToMeetSpecificationSchedulingException(SupportScheduleSpecification supportScheduleSpecification, string message) : base(message) { SupportScheduleSpecification = supportScheduleSpecification; }
public UnableToMeetSpecificationSchedulingException(SupportScheduleSpecification supportScheduleSpecification) { SupportScheduleSpecification = supportScheduleSpecification; }