Exemplo n.º 1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            if (radioButtonStudent.Checked)
            {
                try
                {
                    Student student = retrieveStudentInformation();

                    MySQLDBManager db = new MySQLDBManager();
                    db.AddStudent(student);
                    emptyControlsStudent();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (radioButtonCourse.Checked)
            {
                try
                {
                    Course course = retrieveCourseInformation();

                    MySQLDBManager db = new MySQLDBManager();
                    db.AddCourse(course);
                    emptyControlsCourse();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Exemplo n.º 2
0
        private void btnRetrieve_Click(object sender, EventArgs e)
        {
            if (radioButtonStudent.Checked)
            {
                try
                {
                    MySQLDBManager db = new MySQLDBManager();

                    gridStudents.DataSource = db.retrieveStudents();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else if (radioButtonCourse.Checked)
            {
                try
                {
                    MySQLDBManager db = new MySQLDBManager();

                    gridCourses.DataSource = db.retrieveCourses();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }