Exemplo n.º 1
0
        public IEnumerable Handle(AddCourse command)
        {
            Course course = ScheduleFactory.CreateCourse(command);
            var    agRoot = DomainRepository.GetSchedule(command.ScheduleId);

            // TODO: Any rules about duplicate courses scheduled?
            agRoot.AddCourse(course);

            DomainRepository.UpdateSchedule(agRoot);

            yield return(ScheduleFactory.EventFactory.CourseAddedToSchedule());
        }
Exemplo n.º 2
0
        public IEnumerable Handle(ScheduleRoom command)
        {
            ClassRoom classRoom = ScheduleFactory.CreateClassRoom(command.RoomNumber, command.Day, command.StartTime, command.EndTime);
            var       agRoot    = DomainRepository.GetSchedule(command.ScheduleId);

            // TODO: Rules about start and end times
            //          - All courses start at hh:15 and end at hh+:10
            //          - In blocks of 1, 2, 3, or 4 hours only
            //          - Fits in the standard work schedule (7AM to 11PM Mon-Fri, 7AM to 5PM Sat)
            // TODO: Rules about over-laps
            //          - Time overlaps in schedule
            // TODO: Rules about course
            //          - Too many hours slotted
            //          - Course happens only once per day
            agRoot.ScheduleRoom(command.CourseId, classRoom);

            DomainRepository.UpdateSchedule(agRoot);

            yield return(ScheduleFactory.EventFactory.RoomScheduledForCourse());
        }