예제 #1
0
        // Class constructor
        public course(string crsID, string ttl, string ist, string crdt, int sea, int num_time_b, List <string> time_bs)
        {
            this.crsID = crsID;
            title      = ttl;
            instructor = ist;
            credit     = crdt;
            seats      = sea;
            maxSeats   = sea;
            num_time   = num_time_b;
            timeBlocks = time_bs;
            time_blocks_alternative = new List <classTime> {
            };

            foreach (string timeBlock in time_bs)
            {
                List <char> days = new List <char>();
                days.AddRange(DecodeDay(Convert.ToInt32(timeBlock.Substring(0, 2))));

                double startTime = Convert.ToDouble(timeBlock.Substring(2, 2)) / 2;
                double endTime   = startTime + Convert.ToDouble(timeBlock.Substring(4, 1)) * 0.5;

                classTime timeOfBlock = new classTime(days, startTime, endTime);
                time_blocks_alternative.Add(timeOfBlock);
            }
        }
예제 #2
0
        public void changeCourse(string crsID, string newInstructor, List <string> timeBlocks)
        {
            course tempCrs = getCourse(crsID);

            tempCrs.instructor = newInstructor;
            tempCrs.timeBlocks = timeBlocks;
            tempCrs.num_time   = timeBlocks.Count;
            tempCrs.time_blocks_alternative.Clear();

            foreach (string timeBlock in tempCrs.timeBlocks)
            {
                List <char> days = new List <char>();
                days.AddRange(course.DecodeDay(Convert.ToInt32(timeBlock.Substring(0, 2))));

                double startTime = Convert.ToDouble(timeBlock.Substring(2, 2)) / 2;
                double endTime   = startTime + Convert.ToDouble(timeBlock.Substring(4, 1)) * 0.5;

                classTime timeOfBlock = new classTime(days, startTime, endTime);
                tempCrs.time_blocks_alternative.Add(timeOfBlock);
            }
        }