Example #1
0
 public Schedule(Section sec, Classroom clas, int start, int end, int day)
 {
     section = sec;
     classroom = clas;
     startHour = start;
     endHour = end;
     whichDay = day;
 }
Example #2
0
 public Schedule(Section sec, Classroom clas, int start, int end, int day)
 {
     section = sec;
     classroom = clas;
     startHour = start;
     endHour = end;
     whichDay = day;
     sec.hourList.Add(this); //need to sync across the classes.
     clas.scheduleList.Add(this);
 }
Example #3
0
 private Schedule chooseRandomSection(Section sec)
 {
     Random rndElement = new Random();
     int index;
     if (sec.hourList.Count > 1)
     {
         index = rndElement.Next(0, sec.hourList.Count - 1);
         return sec.hourList[index];
     }
     else return null;
 }
Example #4
0
        public Department(Form1 mainform)
        {
            ListCurriculum=new List<Curriculum>();
            this.mainform = mainform;
            for (int j = 0; j < 10; j++)
            {
                List<Professor> ProfessorList = new List<Professor>();
                List<Classroom> ClassroomList = new List<Classroom>();
                List<Semester> SemesterList = new List<Semester>();
                List<Course> CourseList = new List<Course>();
                List<Section> SectionList = new List<Section>();

                ListCurriculum.Add(new Curriculum(this));

                for (int i = 0; i < 8; i++)
                {
                    SemesterList.Add(new Semester(i + 1, string.Format("{0}. semester", i + 1), ListCurriculum[j]));
                }

                ListCurriculum[j].addSemester(SemesterList);

                foreach (var prof in Context.PROFESSOR.Select(p => new { p.PROF_ID, p.PROF_NAME }).ToList())
                {
                    ProfessorList.Add(new Professor(prof.PROF_ID, prof.PROF_NAME));
                }

                foreach (var clsr in Context.CLASSROOM.Select(p => new { p.CLRO_ID, p.CLRO_NAME }).ToList())
                {
                    ClassroomList.Add(new Classroom(clsr.CLRO_ID, clsr.CLRO_NAME));
                }

                foreach (var item in Context.COURSE.Select(p => new { p.COUR_ID, p.COUR_NAME, p.COUR_SEMESTER, p.COUR_HOUR }).ToList())
                {
                    Semester sem = SemesterList.Where(s => s.ID == item.COUR_SEMESTER).FirstOrDefault();
                    Course crs = new Course(item.COUR_ID, item.COUR_NAME, sem, item.COUR_HOUR);
                    CourseList.Add(crs);
                    sem.courseList.Add(crs);
                }

                foreach (var item in Context.SECTION.Select(p => new { p.SECT_ID, p.SECT_COURSEID, p.SECT_PREFDAY, p.SECT_PREFHOUR, p.SECT_PROFESSORID, p.SECT_PREFCLASSROOM,p.SECT_NAME }).ToList())
                {
                    Course crs = CourseList.Where(c => c.ID == item.SECT_COURSEID).FirstOrDefault();
                    Classroom clr = ClassroomList.Where(c => c.ID == item.SECT_PREFCLASSROOM).FirstOrDefault();
                    Professor prof = ProfessorList.Where(p => p.ID == item.SECT_PROFESSORID).FirstOrDefault();
                    Section sec = new Section(item.SECT_ID, item.SECT_PREFDAY, item.SECT_PREFHOUR, crs, clr, prof,item.SECT_NAME);
                    SectionList.Add(sec);
                    prof.SectionList.Add(sec);
                    crs.SectionList.Add(sec);
                }

                foreach (var item in SemesterList)
                {
                    foreach (var item2 in item.courseList)
                    {
                        foreach (var item3 in item2.SectionList)
                        {
                            new Schedule(item3, item3.PrefferedClassroom, (int)item3.prefferedHour, (int)(item3.prefferedHour) + (int)(item3.SectionCourse.NumberOfHours), item3.prefferedDay);
                        }
                    }
                }

                ListCurriculum[j].addProfessor(ProfessorList);
                ListCurriculum[j].addClassroom(ClassroomList);

            }
        }