Exemple #1
0
        /// <summary>
        /// 生成所有教师的课表
        /// </summary>
        /// <returns></returns>
        public void  GenericTeacherSchedule()
        {
            _conflictInformation = null;
            _teacherSchedule.Clear();
            foreach (ClassSchedule cs in this._classes)
            {
                foreach (DaySchedule ds in cs)
                {
                    foreach (Lesson l in ds)
                    {
                        if (l != null && l.TeacherID != 0)
                        {
                            if (_teacherSchedule.Add(l.TeacherID, l.DayOfWeek, l.Section, l.ClassID))
                            {
                                //_conflictClassID = l.ClassID;

                                _conflictInformation = new ConflictInformation(l.ClassID, l.SubjectName);

                                l.Conflict = true;
                            }
                            else
                            {
                                l.Conflict = false;
                            }
                        }
                    }
                }
            }
        }
 private void TestConflict()
 {
     schedule.GenericTeacherSchedule();
     //返回第一个有冲突的班级ID
     //firstConflictClassID = this.schedule.ConflictClassID;
     firstConflictInformation = this.schedule.FirstConflictInformation;
     if (firstConflictInformation == null)
     {
         tslConflict.Text = "没有任何冲突课程";
     }
     else
     {
         tslConflict.Text = string.Format("{0}班{1}有冲突", firstConflictInformation.ConflictClassID + 1, firstConflictInformation.SubjectName);
     }
 }