/*Queries the database for all the classes the currently selected student has taken.
         * Then, it constructs a List containing 'Course' objects which represent each course
         * the student has completed*/
        private void studentSelectionButton_Click(object sender, EventArgs e)
        {
            searchWindow.ShowDialog(this);
            String studentName = searchWindow.getName();
            String studentID = searchWindow.getId();
            if (studentID != null)
            {

                setStudent(studentID, studentName);

                //Overwrite the previous student course list
                this.studentCourseList = new List<Course>();

                System.Data.Odbc.OdbcConnection connection = new System.Data.Odbc.OdbcConnection(dsnSource);
                System.Data.Odbc.OdbcCommand command = connection.CreateCommand();
                System.Data.Odbc.OdbcDataReader Reader;
                command.CommandText = "select * from S_HIST_DETAIL where ID = '" + studentID + "'";
                try
                {
                    connection.Open();
                    Reader = command.ExecuteReader();
                    while (Reader.Read())
                    {

                        String courseSubject = Reader["SUBJECT"].ToString();
                        String courseNumber = Reader["COURSE_NUMBER"].ToString();
                        String CRN = Reader["CRN"].ToString();
                        Double gpa = Convert.ToDouble(Reader["DECIMAL_GRADE"]);
                        String term = Reader["TERM"].ToString();
                        Course currCourse = new Course(CRN, courseNumber, gpa, courseSubject, term);
                        studentCourseList.Add(currCourse);

                    }
                    connection.Close();
                }
                catch (Exception s)
                {
                    MessageBox.Show("There was a connection problem. Please try again later");
                    MessageBox.Show(s.ToString());
                }

                if (majEval.size() > 0)
                {
                    buildMajorEvaluation();
                }
            }
        }
 public void add(Course newCourse)
 {
     this.allCourses.Add(newCourse);
 }
        private void button2_Click(object sender, EventArgs e)
        {
            //System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(ThreadProc));
            //t.Start(this);
            newWindow.ShowDialog(this);
            String studentName = newWindow.getName();
            String studentID = newWindow.getId();
            if (studentID != null)
            {
                groupBox1.Text = studentName;

                //Overwrite the previous student course list
                this.studentCourseList = new CourseList();

                string MyConString = "SERVER=tcekle.com;" +
                    "DATABASE=dummydb;" +
                    "UID=remote;" +
                    "PASSWORD=f3erePub;";
                MySqlConnection connection = new MySqlConnection(MyConString);
                MySqlCommand command = connection.CreateCommand();
                MySqlDataReader Reader;
                command.CommandText = "select * from S_HIST_DETAIL where ID = '" + studentID + "'";
                connection.Open();
                Reader = command.ExecuteReader();
                while (Reader.Read())
                {

                    //Not sure if 'SUBJECT' or 'DEPT' fields give the correct course
                    //category (i.e. MATH, CSCI, PHIL, PSYCH, etc)
                    String courseSubject = Reader["SUBJECT"].ToString();

                    String courseNumber = Reader["COURSE_NUMBER"].ToString();
                    String CRN = Reader["CRN"].ToString();
                    Double gpa = Reader.GetDouble("DECIMAL_GRADE");
                    String term = Reader["TERM"].ToString();

                    Course currCourse = new Course(CRN, courseNumber, gpa, courseSubject, term);
                    studentCourseList.add(currCourse);

                    //We can test the contents of our cours list by adding them to the listview
                    ListViewItem item2 = new ListViewItem(new[] { (courseSubject + courseNumber),
                        CRN, gpa.ToString(), term, "none", "complete"  });

                    listView1.Items.Add(item2);
                }
                connection.Close();

                MessageBox.Show(studentID);
            }
        }