示例#1
0
        // Constructor that uses a course id
        public Course(int courseID)
        {
            CourseInfo DB = CourseInfo.Create();

            this.courseID  = courseID;
            this.professor = DB.getProf(courseID);

            this.time = DB.getTime(courseID);
            this.day  = DB.getDay(courseID);

            this.building = DB.getBuilding(courseID);
            this.room     = DB.getRoom(courseID);

            this.courseDept = DB.getCourseDept(courseID);
            this.courseNum  = DB.getCourseNum(courseID);
            this.courseSect = DB.getCourseSect(courseID);
            this.courseCode = DB.getCourseCode(courseID);

            this.shortName = DB.getShortName(courseID);
            this.longName  = DB.getLongName(courseID);

            this.enrollment = DB.getEnrollment(courseID);
            this.capacity   = DB.getCapacity(courseID);

            this.credits = DB.getCredits(courseID);

            this.allInfo = DB.getAllInfo(courseID);
        }
示例#2
0
        // displays an info box containing information about a course
        string getCalendarPopupString(int id)
        {
            // Gets all courses with same course code:
            List <int> ids = new List <int>();

            for (int i = 0; i < DB.getNumCourses(); i++)
            {
                if (DB.getCourseCode(i) == DB.getCourseCode(id))
                {
                    ids.Add(i);
                }
            }

            string val = DB.getCourseCode(ids[0]) + "\n";

            val += DB.getLongName(ids[0]) + "\n";
            val += "with " + DB.getProf(ids[0]).first + " " + DB.getProf(ids[0]).last + "\n\n";

            int credits = 0;

            foreach (int course_id in ids)
            {
                val     += DB.getCourse(course_id).getTimeString().Item1 + " to " + DB.getCourse(course_id).getTimeString().Item2;
                val     += " on " + getDays(DB.getCourse(course_id)) + " in " + DB.getBuilding(course_id) + " " + DB.getRoom(course_id) + "\n";
                credits += DB.getCredits(course_id);
            }

            val += "\n" + credits.ToString() + " total credits\n";
            val += DB.getEnrollment(ids[0]).ToString() + " seats taken out of " + DB.getCapacity(ids[0]).ToString() + "\n";
            return(val);
        }