Example #1
0
        public bool AddLesson(DateTime date, LessonsOrder lesson, Room room, IEnumerable<Teacher> teachers, IEnumerable<Group> groups)
        {
            bool b = true;

            foreach (Teacher t in teachers)
            {
                if (IsLessonTeacher(date, lesson, t))
                {
                    b = false;
                    break;
                }
            }
            if (b)
            {
                foreach (Group g in groups)
                {
                    if (IsLessonGroup(date, lesson, g))
                    {
                        b = false;
                        break;
                    }
                }
            }
            if (IsLessonRoom(date, lesson, room))
            {
                b = false;
            }
            if (b)
            {
                if (!items.ContainsKey(date))
                {
                    items[date] = new List<ScheduleItem>();
                }
                items[date].Add(new ScheduleItem() { Lesson = lesson, Room = room, Teachsrs = teachers, Groups = groups });
            }
            return b;
        }
Example #2
0
 public ScheduleItem(LessonsOrder lesson, Room room, IEnumerable<Teacher> teachers, IEnumerable<Group> groups)
 {
     Lesson = lesson;
     Room = room;
     Teachsrs = teachers;
     Groups = groups;
 }
Example #3
0
 private bool IsLessonRoom(DateTime date, LessonsOrder lesson, Room room)
 {
     bool b = false;
     if (items.ContainsKey(date))
     {
         foreach (ScheduleItem s in items[date])
         {
             if (s.Lesson == lesson && object.Equals(s.Room, room))
             {
                 b = true;
             }
         }
     }
     return b;
 }
 public void AddRoom(Room r )
 {
     rooms.Add(r);
 }
 public bool AddLesson(DateTime date, LessonsOrder lesson, Room room, IEnumerable<Teacher> teachers, IEnumerable<Group> groups)
 {
     return  schedule.AddLesson(date, lesson, room, teachers, groups);
 }