Beispiel #1
0
        private void TestEditClass()
        {
            Course      course      = cc.SearchCourse("cosc2323");
            Lecturer    lecturer    = lc.SearchLecturer("v3222222");
            string      className   = course.Id + "-" + lecturer.Id;
            Class       aClass      = clc.SearchClass(className);
            DateTime    startTime   = DateTime.Parse("16:30");
            DateTime    endTime     = DateTime.Parse("18:00");
            Room        room        = rc.SearchRoom("1.1.2");
            string      dayOfWeek   = "Monday";
            ClassPeriod classPeriod = new ClassPeriod(room, dayOfWeek, startTime, endTime);

            clc.DeleteClassName(className);
            if (clc.ConflictTime(classPeriod))
            {
                Console.WriteLine("Fail! This class has period that clashed with following class: ");
                Console.WriteLine("\t\t(Class name ({0})): ", course.Id + "-" + lecturer.Id);
                Console.WriteLine("\tClass period: {0}", classPeriod.ToString());
            }
            else
            {
                clc.CreateClass(course, lecturer, classPeriod);
                Console.WriteLine("Pass! This class is updated, no period conflicted.");
                Console.WriteLine("\t\t(Class name ({0})): ", course.Id + "-" + lecturer.Id);
                Console.WriteLine("\tClass period: {0}", classPeriod.ToString());
            }
        }
Beispiel #2
0
        private void TestAddClass()
        {
            Console.WriteLine("Testing Add Class");
            Console.WriteLine();
            Console.WriteLine("\t\t\t\tAdding class no conflict to others");
            Course      course      = cc.SearchCourse("cosc2323");
            Lecturer    lecturer    = lc.SearchLecturer("v3222222");
            Room        room        = rc.SearchRoom("1.1.2");
            DateTime    startTime   = DateTime.Parse("8:00");
            DateTime    endTime     = DateTime.Parse("9:00");
            string      dayOfWeek   = "monday";
            ClassPeriod classPeriod = new ClassPeriod(room, dayOfWeek, startTime, endTime);

            for (int i = 0; i < 2; i++)
            {
                if (clc.ConflictTime(classPeriod))
                {
                    Console.WriteLine("Fail! This class has period that clashed with following class: ");
                    Console.WriteLine("\t\t(Class name ({0})): ", course.Id + "-" + lecturer.Id);
                    Console.WriteLine("\tClass period: {0}", classPeriod.ToString());
                }
                else
                {
                    clc.CreateClass(course, lecturer, classPeriod);
                    Console.WriteLine("Pass! This class is added, no period conflicted.");
                }
            }
            Console.WriteLine();
        }