protected decimal GoToHoursShedule(LoadItem item, decimal Load, ScheduleDay dayShedule, int Attempt) { //можно ли еще добалять пары в этот день или это день для группы заполнен if (dayShedule.LimitLessonsNotExceeded(item.Groups, dayShedule.Week, dayShedule.Day)) { List <Position> freePositions = new List <Position>(); //цикл по доступным часам для этого дня (в будни и выходные часы для проставления пар разные) for (int Hour = dayShedule.EarlierPossibleHour; Hour <= dayShedule.LastPossibleHour; Hour++) { ScheduleTime Time = new ScheduleTime(dayShedule.Week, dayShedule.Day, Hour); //выбираем аудиторию ScheduleRoom Room = FindRoom(item, Time); if (Room != null) { freePositions.Add(new Position(Room, Time)); } } // добавляем занятия if (freePositions.Count > 0) { Load = PutLessonsOnFreePositions(freePositions, Load, Attempt, item); } } return(Load); }
protected virtual bool CanPutToPosition(ScheduleTime time, ScheduleRoom room, LoadItem item) { ScheduleDay day = Shedule.GetDay(time.Week, time.Day); return(time.WeekNumber <= 4 && time.WeekNumber >= 1 && day != null && day.LimitLessonsNotExceeded(item.Groups, time.Week, time.Day, 1) && Employments.IsHourFree(item.Teacher, item.Groups, room.Name, time)); }
protected virtual decimal PutLesson(LoadItem item, ScheduleTime time, ScheduleRoom room, decimal Load) { //получить занятие из расписания ScheduleLesson Lesson = Shedule.GetLesson(time, room.Name); //задать параметры занятию Lesson.UpdateFields(item.Teacher, item.Discipline, item.Groups, item.LessonType); //проставить занятости Employments.Add(item.Teacher, item.Groups, room.Name, time, ReasonEmployment.GeneratorPutLesson); //уменьшить нагрузку на два академичаских часа или на одну пару return(Load - 2); }
public ProgramItemSlot(TimeSlot slot, ScheduleRoom room) { Room = room; TimeSlot = slot; }
public Position(ScheduleRoom room, ScheduleTime time) { Room = room; Time = time; }
//Можно ли проводить данный вид занятия в этой аудитории private bool PossibleAppointLessonRoom(ScheduleRoom room, LessonType type) { return(type == LessonType.Lection ? room.Lection : type == LessonType.Labwork ? room.LabWork : type == LessonType.Practice ? room.Practice : true); }