コード例 #1
0
        public void addIndex(string courseCode, string index)
        {
            NetworkCommunicator nc = new NetworkCommunicator();
            string courseInformation = nc.GetCourseInfo(courseCode);
            CourseInformationParser cip = new CourseInformationParser();
            Course newCourse = cip.ParseCourseInformationFromHtmlString(courseInformation);
            newCourse.Indices.RemoveAll(i => i.IndexNumber != index);

            // if this index actually exists, add to the list
            if (newCourse.Indices.Count != 0)
            {
                // check whether this course is already in the list
                Course existingCourse = CourseList.Find(c => c.CourseCode == courseCode);
                if (existingCourse == null)
                    CourseList.Add(newCourse);
                else
                {
                    existingCourse.addIndex(newCourse.Indices.First());
                }
            }
        }
コード例 #2
0
        public void AddCourse(string courseCode)
        {
            NetworkCommunicator nc = new NetworkCommunicator();

            // build course structure
            string courseInformation = nc.GetCourseInfo(courseCode);
            CourseInformationParser cip = new CourseInformationParser();
            Course newCourse = cip.ParseCourseInformationFromHtmlString(courseInformation);

            // add exam time information
            string examTimeInformation = nc.GetCourseExamTime(courseCode);
            string examTime = cip.ParseCourseExamTimeFromHtmlString(examTimeInformation);
            newCourse.ExamTime = examTime;

            // add indices vacancy information

            if (newCourse != null)
            {
                CourseList.Add(newCourse);
            }
        }