Beispiel #1
0
        private Student Student; //The Student

        #endregion Fields

        #region Constructors

        public Scheduler(Student Student, ProgramSequence MasterSequence)
        {
            this.Student = Student;
            this.MasterSequence = MasterSequence;
            LocalSequence = ProgramSequence.DeepClone(MasterSequence);
            CoursesTaken = new List<Course>();
            CoursesToTake = new List<string>();
            PrereqsMissing = new List<Course>();
            ScheduledSectionsFall = new List<Section>();
            ScheduledSectionsWinter = new List<Section>();

            foreach (CourseTaken s in db.Students.Find(Student.StudentId).CourseTakens.ToList())
                CoursesTaken.Add(s.Section.Course);
        }
Beispiel #2
0
        private bool isConstrained(Student s, Section sec)
        {
            string startHour = sec.StartTime.ToString().Split(':')[0];
            string startMinute = sec.StartTime.ToString().Split(':')[1];
            string endHour = sec.EndTime.ToString().Split(':')[0];
            string endMinute = sec.EndTime.ToString().Split(':')[1];

            System.Diagnostics.Debug.WriteLine("Section: " + startHour + ":" + startMinute + " -> " + endHour + ":" + endMinute);
            foreach (StudentConstraint constraint in s.StudentConstraints.ToList())
            {
                System.Diagnostics.Debug.WriteLine("\tCosntraint Compared: " + constraint.StartHour + " : " + constraint.StartMinute + " -> " + constraint.EndHour + ":" + constraint.EndMinute);
                if (!HasDay(constraint, sec))
                    continue;

                if (constraint.EndHour == startHour && constraint.EndMinute == startMinute)
                    return false;

                if (constraint.StartHour == endHour && constraint.StartMinute == endMinute)
                    return false;

                int startCons = Convert.ToInt32(constraint.StartHour + constraint.StartMinute);
                int endCons = Convert.ToInt32(constraint.EndHour + constraint.EndMinute);
                int startSec = Convert.ToInt32(startHour + startMinute);
                int endSec = Convert.ToInt32(endHour + endMinute);

                if (startCons < endSec && startSec < endCons)
                {
                    System.Diagnostics.Debug.WriteLine("\t\t!!!!!!!!CONSTRAINED!!!!!!!!!!!");
                    return true;
                }

            }
            return false;
        }