示例#1
0
        //Constructs Course Object, using name it queries the database and gets the information for the class
        //Class lacks exception handling and does not account for the class name entered being invalid
        public Course(string name, bool taken)
        {
            Taken = taken;

            DataTable result = GraduationPlanningSystem.db.find(name, "course");

            DataRow[] rows     = result.Select();
            Object[]  rowArray = rows[0].ItemArray;

            Name         = (String)rowArray[1];
            UID          = (String)rowArray[0];
            CourseNumber = (String)rowArray[2];
            Department   = (String)rowArray[4];
            Hours        = (Int64)rowArray[3];
            SemOffered   = (String)rowArray[9];

            String entry = (String)rowArray[5];         //gets list of reqs and parses them into nodes for a list

            if (entry.Equals(""))
            {
                CoReq = null;
            }
            else
            {
                CoReq = ParseGPS.parseReqs(entry);
            }

            entry = (String)rowArray[6];
            if (entry.Equals(""))
            {
                Prereq = null;
            }
            else
            {
                Prereq = ParseGPS.parseReqs(entry);
            }

            entry = (String)rowArray[7];
            if (entry.Equals(""))
            {
                PrereqOrCoreq = null;
            }
            else
            {
                PrereqOrCoreq = ParseGPS.parseReqs(entry);
            }
        }
示例#2
0
        //Constructs Course Object, using name it queries the database and gets the information for the class
        //Class lacks exception handling and does not account for the class name entered being invalid
        public Course(string nameorUID, AcademicStatus taken)
        {
            Depth = -1;
            if (nameorUID != "")
            {
                //Populate the course.
                this.Prereq        = new List <string>();
                this.CoReq         = new List <string>();
                this.PrereqOrCoreq = new List <string>();
                Status             = taken;
                //SemesterTaken = -1;
                DataTable result = GraduationPlanningSystem.db.find(nameorUID, "course");

                if (result.Rows.Count == 0)
                {
                    result = GraduationPlanningSystem.db.find(nameorUID, "uid");
                }

                if (result.Rows.Count > 0)
                {
                    DataRow[] rows     = result.Select();
                    Object[]  rowArray = rows[0].ItemArray;

                    Name         = (String)rowArray[1];
                    UID          = (String)rowArray[0];
                    CourseNumber = (String)rowArray[2];
                    Department   = (String)rowArray[4];
                    Hours        = (Int64)rowArray[3];
                    SemOffered   = (String)rowArray[9];

                    String entry = (String)rowArray[6];         //gets list of reqs and parses them into nodes for a list
                    if (entry.Equals(""))
                    {
                        CoReq = new List <string>();
                    }
                    else
                    {
                        CoReq = ParseGPS.parseReqs(entry);
                    }

                    entry = (String)rowArray[5];
                    if (entry.Equals(""))
                    {
                        Prereq = new List <string>();
                    }
                    else
                    {
                        Prereq = ParseGPS.parseReqs(entry);
                    }

                    entry = (String)rowArray[7];
                    if (entry.Equals(""))
                    {
                        PrereqOrCoreq = new List <string>();
                    }
                    else
                    {
                        PrereqOrCoreq = ParseGPS.parseReqs(entry);
                    }
                }
            }
        }