⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainmodule.cs

📁 实现课程表编排和打印功能,通过在候选列表中选择课程和教师(没有被排课且该教师教授所选择的课程)来完成排课,代码约8000行
💻 CS
📖 第 1 页 / 共 5 页
字号:
            if (this.teachers != null)
                if (this.teachers.Contains(Teacher))
                    this.teachers.Remove(Teacher);
        }

        public void RemoveAllClass()
        {
            if (this.classes != null)
                this.classes.Clear();
        }

        public void RemoveAllSubject()
        {
            if (this.subjects != null)
                this.subjects.Clear();
        }

        public void RemoveAllTeacher()
        {
            if (this.teachers != null)
                this.teachers.Clear();
        }

        public void Dispose()
        {
            
        }

        public bool HasClass(string ClassName)
        {
            bool b = false;
            if (this.classes != null)
            {
                for (int i = 0; i < this.classes.Count; i++)
                {
                    if (this.classes[i].ClassName == ClassName)
                    {
                        b = true;
                        break;
                    }
                }
            }
            return b;
        }

        public bool HasClass(Class cls)
        {
            bool b = false;
            if (this.classes != null)
                b = this.classes.Contains(cls);
            return b;
        }

        public bool HasTeacher(string TeacherName)
        {
            bool b = false;
            if (this.teachers != null)
            {
                for (int i = 0; i < this.teachers.Count; i++)
                {
                    if (this.teachers[i].TeacherName == TeacherName)
                    {
                        b = true;
                        break;
                    }
                }
            }
            return b;
        }

        public bool HasTeacher(Teacher Teacher)
        {
            bool b = false;
            if (this.teachers != null)
                b = this.teachers.Contains(Teacher);
            return b;
        }

        public bool HasSubject(string SubjectName)
        {
            bool b = false;
            if (this.subjects != null)
            {
                for (int i = 0; i < this.subjects.Count; i++)
                {
                    if (this.subjects[i].SubjectName == SubjectName)
                    {
                        b = true;
                        break;
                    }
                }
            }
            return b;
        }

        public bool HasSubject(Subject Subject)
        {
            bool b = false;
            if (this.subjects != null)
                b = this.subjects.Contains(Subject);
            return b;
        }

        public Grade()
        {
            
        }

        public Grade(string GradeName)
        {
            this.gradeName = GradeName;
        }

        ~Grade()
        {
            
        }
    }

    public class Teacher
    {
        public override bool Equals(object obj)
        {
            //return base.Equals(obj);
            bool b = false;
            if (obj is Teacher)
            {
                if (this.teacherName == (obj as Teacher).teacherName)
                    b = true;
            }
            return b;
        }

        private string teacherName;

        public string TeacherName
        {
            get { return teacherName; }
            set { teacherName = value; }
        }
        private CourseTable courseTable;

        public CourseTable CourseTable
        {
            get { return courseTable; }
            set { courseTable = value; }
        }
        private IList<Subject> subjects;

        public IList<Subject> Subjects
        {
            get { return subjects; }
            set { subjects = value; }
        }
        private IList<Grade> grades;

        public IList<Grade> Grades
        {
            get { return grades; }
            set { grades = value; }
        }

        public void Dispose()
        {
            
        }

        public Teacher()
        {
            
        }

        public Teacher(string TeacherName)
        {
            this.teacherName = TeacherName;
        }

        ~Teacher()
        {
            
        }

        public void AddGrade(string GradeName)
        {
            if (this.grades == null)
                this.grades = new List<Grade>();
            for (int i = 0; i < School.Grades.Count; i++)
            {
                if (School.Grades[i].GradeName == GradeName)
                    if (!this.grades.Contains(School.Grades[i]))
                        this.grades.Add(School.Grades[i]);
            }
        }

        public void AddGrade(Grade Grade)
        {
            if (this.grades == null)
                this.grades = new List<Grade>();
            if (!this.grades.Contains(Grade))
                this.grades.Add(Grade);
        }

        public void AddSubject(string SubjectName)
        {
            if (this.subjects == null)
                this.subjects = new List<Subject>();
            for (int i = 0; i < School.Subjects.Count; i++)
            {
                if (School.Subjects[i].SubjectName == SubjectName)
                    if (!School.Subjects.Contains(School.Subjects[i]))
                        this.subjects.Add(School.Subjects[i]);
            }
        }

        public void AddSubject(Subject Subject)
        {
            if (this.subjects == null)
                this.subjects = new List<Subject>();
            if (!this.subjects.Contains(Subject))
                this.subjects.Add(Subject);
        }

        public void RemoveGrade(string GradeName)
        {
            if (this.grades != null)
            {
                for (int i = 0; i < this.grades.Count; i++)
                {
                    if (this.grades[i].GradeName == GradeName)
                    {
                        this.grades.Remove(this.grades[i]);
                        break;
                    }
                }
            }
        }

        public void RemoveGrade(Grade Grade)
        {
            if (this.grades != null)
            {
                if (this.grades.Contains(Grade))
                    this.grades.Remove(Grade);
            }
        }

        public void RemoveSubject(string SubjectName)
        {
            if (this.subjects != null)
            {
                for (int i = 0; i < this.subjects.Count; i++)
                {
                    if (this.subjects[i].SubjectName == SubjectName)
                    {
                        this.subjects.Remove(this.subjects[i]);
                        break;
                    }
                }
            }
        }

        public void RemoveSubject(Subject Subject)
        {
            if (this.subjects != null)
            {
                if (this.subjects.Contains(Subject))
                    this.subjects.Remove(Subject);
            }
        }

        public void RemoveAllGrade()
        {
            if (this.grades != null)
                this.grades.Clear();
        }

        public void RemoveAllSubject()
        {
            if (this.subjects != null)
                this.subjects.Clear();
        }

        public bool HasSubject(string SubjectName)
        {
            bool b = false;
            if (this.subjects != null)
            {
                for (int i = 0; i < this.subjects.Count; i++)
                {
                    if (this.subjects[i].SubjectName == SubjectName)
                    {
                        b = true;
                        break;
                    }
                }
            }
            return b;
        }

        public bool HasSubject(Subject Subject)
        {
            bool b = false;
            if (this.subjects != null)
                b = this.subjects.Contains(Subject);
            return b;
        }

        public bool HasGrade(string GradeName)
        {
            bool b = false;
            if (this.grades != null)
            {
                for (int i = 0; i < this.grades.Count; i++)
                {
                    if (this.grades[i].GradeName == GradeName)
                    {
                        b = true;
                        break;
                    }
                }
            }
            return b;
        }

        public bool HasGrade(Grade Grade)
        {
            bool b = false;
            if (this.grades != null)
                b = this.grades.Contains(Grade);
            return b;
        }

        public IList<Course> GetCourses(string SubjectName)
        {
            List<Course> courses = new List<Course>();
            if (this.courseTable != null)
            {
                if (this.courseTable.Courses != null)
                {
                    for (int i = 0; i < this.courseTable.Courses.Count; i++)
                    {
                        if (this.courseTable.Courses[i].Subject.SubjectName == SubjectName)
                            courses.Add(this.courseTable.Courses[i]);
                    }
                }
            }
            return courses;
        }

        public IList<Course> GetCourses(Subject Subject)
        {
            List<Course> courses = new List<Course>();
            if (this.courseTable != null)
            {
                if (this.courseTable.Courses != null)
                {
                    for (int i = 0; i < this.courseTable.Courses.Count; i++)
                    {
                        if (this.courseTable.Courses[i].Subject.SubjectName == Subject.SubjectName)
                            courses.Add(this.courseTable.Courses[i]);
                    }
                }
            }
            return courses;
        }

        public Grade GetGrade(string GradeName)
        {
            Grade grade = null;
            if (this.grades != null)
            {
                for (int i = 0; i < this.grades.Count; i++)
                {
                    if (this.grades[i].GradeName == GradeName)
                    {
                        grade = this.grades[i];
                        break;
                    }
                }
            }
            return grade;
        }

        public Subject GetSubject(string SubjectName)
        {
            Subject subject = null;
            if (this.subjects != null)
            {
                for (int i = 0; i < this.subjects.Count; i++)
                {
                    if (this.subjects[i].SubjectName == SubjectName)
                    {
                        subject = this.subjects[i];
                        break;
                    }
                }
            }
            return subject;
        }
    }

    public class Subject
    {
        public override bool Equals(object obj)
        {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -