Exemplo n.º 1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     //for deletion
     if (cboUserCode.Visible == false)
     {
         MessageBox.Show("Select Details to Edit");
         cboUserCode.Visible = true;
     }
     else if (MessageBox.Show("Are you sure you want to exit?", "EIMS Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         query = "DELETE FROM user WHERE User_Code='" + cboUserCode.Text + "'";
         try
         {
             conn connect = new conn();
             if (connect.OpenConnection() == true)
             {
                 MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                 cmd.ExecuteNonQuery();
                 connect.CloseConnection();
                 MessageBox.Show("Record Successfully deleted!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 Reset();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }
Exemplo n.º 2
0
        private void cboProgramCode_SelectedIndexChanged_1(object sender, EventArgs e)
        {
            if (cbo2ProgramCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbo2ProgramCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM program WHERE Prog_Code LIKE '" + cbo2ProgramCode.Text + "' ORDER BY Prog_Code ASC";
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    //Read the data and store them in the list

                    if (dataReader.Read())
                    {
                        this.cboProgramCode.Text    = dataReader["Prog_Code"].ToString();
                        this.cboProgramName.Text    = dataReader["Prog_Code"].ToString();
                        this.rtxtDescription.Text   = dataReader["Description"].ToString();
                        this.cboDuration.Text       = dataReader["Duration"].ToString();
                        this.cboDepartmentCode.Text = dataReader["Dept_Code"].ToString();

                        proCode = dataReader["Prog_Code"].ToString();           //for editing
                    }
                    connect.CloseConnection();
                }
            }
        }
Exemplo n.º 3
0
        private void cboUserCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboUserCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboUserCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM user WHERE User_Code LIKE '" + cboUserCode.Text + "' ORDER BY User_Code ASC";
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    //Read the data and store them in the list

                    if (dataReader.Read())
                    {
                        this.txtUserName.Text           = dataReader["Username"].ToString();
                        this.txtFirstName.Text          = dataReader["F_Name"].ToString();
                        this.txtLastName.Text           = dataReader["F_Name"].ToString();
                        this.txtPostalAddress.Text      = dataReader["Postal_Address"].ToString();
                        this.txtPhoneNo.Text            = dataReader["Phone_No"].ToString();
                        this.txtPassword.Text           = dataReader["Previledges"].ToString();
                        this.txtPassword.Text           = dataReader["Passsword"].ToString();
                        this.dtpDateOfRegistration.Text = dataReader["Date_Of_Reg"].ToString();
                        dataReader["Status"].ToString();

                        usrCode = dataReader["User_Code"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
Exemplo n.º 4
0
        private void cboAcademicYearCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboAcademicYearCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboAcademicYearCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM academic_year WHERE Acad_Code LIKE '" + cboAcademicYearCode.Text + "' ORDER BY Acad_Code ASC";
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    //Read the data and store them in the list

                    if (dataReader.Read())
                    {
                        this.cbnAcademicYear.Text = dataReader["Acad_Year"].ToString();
                        dataReader["Status"].ToString();
                        acadyearCode = dataReader["Acad_Code"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
Exemplo n.º 5
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboStudentExamCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboStudentExamCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM student_exam WHERE Stud_Exam_Code LIKE '" + cboStudentExamCode.Text + "' ORDER BY Stud_Exam_Code ASC";
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    //Read the data and store them in the list

                    if (dataReader.Read())
                    {
                        this.txtRegNo.Text            = dataReader["Reg_No"].ToString();
                        this.txtExamCode.Text         = dataReader["Exam_Code"].ToString();
                        this.txtInternalCat.Text      = dataReader["I_CAT"].ToString();
                        this.txtInternalSemester.Text = dataReader["I_Semester"].ToString();
                        this.txtExternalCat.Text      = dataReader["E_CAT"].ToString();
                        this.txtExternalSemester.Text = dataReader["E_Semester"].ToString();
                        stdxamCode = dataReader["Stud_Exam_Code"].ToString();       //for editing
                    }
                    connect.CloseConnection();
                }
            }
        }
Exemplo n.º 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboFacultyCode.Text == "" && cbo1FacultyCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboFacultyCode.Focus();
            }
            else if (cbo1FacultyCode.Text == "" && cbo1FacultyCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbo1FacultyCode.Focus();
            }
            else if (cboFacultyName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboFacultyName.Focus();
            }
            else if (txtUniversityCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUniversityCode.Focus();
            }
            else if (rtxtDescription.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                rtxtDescription.Focus();
            }


            else
            {
                if (cbo1FacultyCode.Visible == true)

                {
                    query = "UPDATE faculty SET Faculty_Code='" + cboFacultyCode.Text + "',Faculty_Name='" + cboFacultyName.Text + "' ,Description='" + rtxtDescription.Text + "' WHERE Faculty_Code='" + facCode + "'";
                }
                else
                {
                    query = "INSERT INTO Faculty(Faculty_Code, Faculty_Name, Description, University_Code) VALUES('" + cboFacultyCode.Text + "', '" + cboFacultyName.Text + "', '" + rtxtDescription.Text + "', '" + txtUniversityCode.Text + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();
                        MessageBox.Show("Successful");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 7
0
        private void btnAdvanceSearch_Click(object sender, EventArgs e)
        {
            if (cboCriteria.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled");
                gboSearch.Focus();
            }
            if (txtSearch.Text == "" && cboCriteria.Text != "ALL")
            {
                MessageBox.Show("Ensure all fields are filled");
                txtSearch.Focus();
            }
            else
            {
                if (cboCriteria.Text == "University_Code")
                {
                    query = "SELECT * FROM university WHERE University_Code LIKE '" + "%" + txtSearch.Text + "%" + "'";
                }
                else if (cboCriteria.Text == "University_Name")
                {
                    query = "SELECT * FROM university WHERE University_Name LIKE '" + "%" + txtSearch.Text + "%" + "'";
                }
                else if (cboCriteria.Text == "Location")
                {
                    query = "SELECT * FROM university WHERE Location LIKE '" + "%" + txtSearch.Text + "%" + "'";
                }
                else if (cboCriteria.Text == "Town")
                {
                    query = "SELECT * FROM university WHERE Town LIKE '" + "%" + txtSearch.Text + "%" + "'";
                }
                else
                {
                    query = "SELECT * FROM university";
                }


                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    // query = "SELECT * FROM University WHERE University_Code LIKE '" + cboUniversityCode.Text + "' ORDER BY University_Code ASC";
                    MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    //Read the data and store them in the list
                    this.dataGrideView1.Rows.Clear();
                    while (dataReader.Read())
                    {
                        string [] row = new string[] { dataReader["University_Code"].ToString(), dataReader["University_Name"].ToString(), dataReader["Location"].ToString(), dataReader["Town"].ToString() };
                        dataGrideView1.Rows.Add(row);
                    }
                    connect.CloseConnection();
                    gboData.Visible = true;
                    //gboSearch.Visible =false;
                }
            }
        }
Exemplo n.º 8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (txtCenterCode.Text == "" && cboCentreCode.Visible == false)
     {
         MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtCenterCode.Focus();
     }
     else if (cboCentreCode.Text == "" && cboCentreCode.Visible == true)
     {
         MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         cboCentreCode.Focus();
     }
     else if (txtLocation.Text == "")
     {
         MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtLocation.Focus();
     }
     else if (txtUniversityCode.Text == "")
     {
         MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         txtUniversityCode.Focus();
     }
     else
     {
         if (cboCentreCode.Visible == true)
         {
             query = "UPDATE centre SET Centre_Code='" + cboCentreCode.Text + "',Centre_Name='" + txtCenterName.Text + "' ,Location='" + txtLocation.Text + "',University_Code='" + txtUniversityCode.Text + "' WHERE Centre_Code='" + cenCode + "'";
         }
         else
         {
             query = "INSERT INTO centre(Centre_Code,Centre_Name,Location, University_Code) VALUES('" + txtCenterCode.Text + "','" + txtCenterName.Text + "', '" + txtLocation.Text + "','" + txtUniversityCode.Text + "')";
         }
         try
         {
             conn connect = new conn();
             if (connect.OpenConnection() == true)
             {
                 MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                 cmd.ExecuteNonQuery();
                 connect.CloseConnection();
                 MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 Reset();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("" + ex);
         }
     }
 }
Exemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtCourseCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCourseCode.Focus();
            }
            else if (txtCourseName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCourseName.Focus();
            }
            else if (txtUnits.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUnits.Focus();
            }
            else if (cboProgramCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboProgramCode.Focus();
            }
            else if (rtxtDescription.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                rtxtDescription.Focus();
            }
            if (cboCourseCode.Visible == true)
            {
                query = "UPDATE course SET Course_Code='" + cboCourseCode.Text + "', Course_Title='" + txtCourseName.Text + "', Description= '" + rtxtDescription.Text + "', Units='" + txtUnits.Text + "', Prog_Code='" + cboProgramCode.Text + "' WHERE Course_Code= '" + courCode + "'";
            }
            else
            {
                conn connect = new conn();
                query = "INSERT INTO course(Course_Code, Course_Title, Description, Units, Prog_Code ) VALUES('" + txtCourseCode.Text + "', '" + txtCourseName.Text + "', '" + rtxtDescription.Text + "', '" + txtUnits.Text + "', '" + cboProgramCode.Text + "' )";

                //string query = "SELECT * FROM user WHERE Username='******' AND Passsword='" + textPassword.Text.ToString() + "' AND Status=1";
                //open connection
                if (connect.OpenConnection() == true)
                {
                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                    cmd.ExecuteNonQuery();
                    connect.CloseConnection();
                    MessageBox.Show("Connection successful");
                    Reset();
                }
            }
        }
Exemplo n.º 10
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (textUsername.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textUsername.Focus();
            }
            else if (textPassword.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                textPassword.Focus();
            }
            else
            {
                try
                {
                    conn   connect = new conn();
                    string query   = "SELECT * FROM user WHERE Username='******' AND Passsword='" + textPassword.Text.ToString() + "' AND Status=1";
                    //open connection
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                        MySqlDataReader dataReader = cmd.ExecuteReader();

                        //Read the data and store them in the list
                        if (dataReader.Read())
                        {
                            // MessageBox.Show("Authentication successful");
                            Dashboard das = new Dashboard();
                            das.Visible = true;
                            this.Hide();
                        }

                        else
                        {
                            textUsername.Text = "";
                            textPassword.Text = "";
                            textUsername.Focus();
                            MessageBox.Show("password/username mismatch!");
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 11
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtAcademicYearCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAcademicYearCode.Focus();
            }
            else if (cbnAcademicYear.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbnAcademicYear.Focus();
            }
            else if (rbtn1Active.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                rbtn1Active.Focus();
            }
            else if (rbtn2Inactive.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                rbtn2Inactive.Focus();
            }
            else
            {
                query = "INSERT INTO Academic(Acad_Code, Acad_Year, Status) VALUES('" + txtAcademicYearCode.Text + "', '" + cbnAcademicYear.Text + "', '" + rbtn1Active.Text + "', '" + rbtn2Inactive.Text + "')";

                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        //MySqlDataReader dataReader
                        cmd.ExecuteReader();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 12
0
        private void GetUniversityCode()
        {
            conn connect = new conn();

            if (connect.OpenConnection() == true)
            {
                query = "SELECT * FROM University ORDER BY University_Code ASC";
                MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                //Read the data and store them in the list
                this.cboUniversityCode.Items.Clear();
                while (dataReader.Read())
                {
                    if (dataReader["University_Code"].ToString().Replace(" ", "") != "")
                    {
                        this.cboUniversityCode.Items.Add(dataReader["University_Code"].ToString());
                    }
                }
                connect.CloseConnection();
            }
        }
Exemplo n.º 13
0
        private void GetRegNo()
        {
            conn connect = new conn();

            if (connect.OpenConnection() == true)
            {
                query = "SELECT * FROM Student ORDER BY Reg_No ASC";
                MySqlCommand    cmd        = new MySqlCommand(query, connect.connection);
                MySqlDataReader dataReader = cmd.ExecuteReader();
                //Read the data and store them in the list
                this.cboRegNo.Items.Clear();
                while (dataReader.Read())
                {
                    if (dataReader["Reg_No"].ToString().Replace(" ", "") != "")
                    {
                        this.cboRegNo.Items.Add(dataReader["Reg_No"].ToString());
                    }
                }
                connect.CloseConnection();
            }
        }
Exemplo n.º 14
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (txtExamCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExamCode.Focus();
            }
            else if (txtExternalCat.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExternalCat.Focus();
            }
            else if (txtExternalSemester.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExternalSemester.Focus();
            }
            else if (txtInternalCat.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtInternalCat.Focus();
            }
            else if (txtInternalSemester.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtInternalSemester.Focus();
            }
            else if (txtRegNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRegNo.Focus();
            }
            else if (txtStudentExamCode.Text == "" && cboStudentExamCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtStudentExamCode.Focus();
            }
            else if (cboStudentExamCode.Text == "" && cboStudentExamCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboStudentExamCode.Focus();
            }



            else
            {
                query = "INSERT INTO student_exam(Stud_Exam_Code, Reg_No, Exam_Code, I_CAT, I_Semester, E_CAT, E_Semester) VALUES('" + txtStudentExamCode.Text + "', '" + txtRegNo.Text + "', '" + txtExamCode.Text + "', '" + txtInternalCat.Text + "', '" + txtInternalSemester.Text + "',  '" + txtExternalSemester.Text + "', '" + txtExternalSemester.Text + "')";

                //string query = "SELECT * FROM user WHERE Username='******' AND Passsword='" + textPassword.Text.ToString() + "' AND Status=1";
                //open connection
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        MessageBox.Show("Am there!");
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        //MySqlDataReader dataReader
                        cmd.ExecuteReader();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int status;

            if (txtAcademicYearCode.Text == "" && cboAcademicYearCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtAcademicYearCode.Focus();
            }
            if (cboAcademicYearCode.Text == "" && cboAcademicYearCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboAcademicYearCode.Focus();
            }
            else if (cbnAcademicYear.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbnAcademicYear.Focus();
            }

            /* else if (rbtn1Active.Text == "")
             * {
             *   MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *   rbtn1Active.Focus();
             * }
             * else if (rbtn2Inactive.Text == "")
             * {
             *   MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *   rbtn2Inactive.Focus();
             * }*/

            else
            {
                status = 1;
                if (rbtn1Active.Checked == true)
                {
                    status = 1;
                }
                else
                {
                    status = 0;
                }
                if (cboAcademicYearCode.Visible == true)
                {
                    query = "UPDATE academic_year SET Acad_Code='" + cboAcademicYearCode.Text + "',Acad_Year='" + cbnAcademicYear.Text + "' ,Status='" + status + "' WHERE Centre_Code='" + acadyearCode + "'";
                }
                else
                {
                    query = "INSERT INTO academic_year (Acad_Code, Acad_Year, Status) VALUES('" + txtAcademicYearCode.Text + "', '" + cbnAcademicYear.Text + "', '" + status + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //MessageBox.Show("Hey");
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        //MySqlDataReader dataReader
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show("Failed" + ex);
                }
            }
        }
Exemplo n.º 16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtUniversityCode.Text == "" && cboUniversityCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUniversityCode.Focus();
            }
            if (cboUniversityCode.Text == "" && cboUniversityCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboUniversityCode.Focus();
            }
            else if (txtUniversityName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUniversityName.Focus();
            }
            else if (txtZipCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtZipCode.Focus();
            }
            else if (txtTown.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtTown.Focus();
            }
            else if (txtLocation.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLocation.Focus();
            }
            else if (txtLocation.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLocation.Focus();
            }


            else
            {
                if (cboUniversityCode.Visible == true)
                {
                    query = "UPDATE university SET University_Code='" + cboUniversityCode.Text + "', University_Name='" + txtUniversityName.Text + "', Location= '" + txtLocation.Text + "', Postal_Code='" + txtPostalAddress.Text + "', Zip_Code='" + txtZipCode.Text + "', Town='" + txtTown.Text + "' WHERE University_Code= '" + uniCode + "'";
                }

                else
                {
                    query = "INSERT INTO University(University_Code, University_Name, Location, Postal_Code, Zip_Code, Town) VALUES('" + txtUniversityCode.Text + "', '" + txtUniversityName.Text + "', '" + txtLocation.Text + "', '" + txtPostalAddress.Text + "', '" + txtZipCode.Text + "', '" + txtTown.Text + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        //MySqlDataReader dataReader
                        cmd.ExecuteReader();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (cboProgramCode.Text == "" && cbo2ProgramCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboProgramCode.Focus();
            }
            else if (cbo2ProgramCode.Text == "" && cbo2ProgramCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbo2ProgramCode.Focus();
            }
            else if (cboProgramName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboProgramName.Focus();
            }
            else if (cboDepartmentCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboDepartmentCode.Focus();
            }
            else if (cboDuration.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboDuration.Focus();
            }
            else if (rtxtDescription.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                rtxtDescription.Focus();
            }


            else
            {
                if (cbo2ProgramCode.Visible == true)
                {
                    query = "UPDATE program SET Prog_Code='" + cbo2ProgramCode.Text + "',Prog_Name='" + cboProgramName.Text + "' ,Description='" + rtxtDescription.Text + "',Description='" + rtxtDescription.Text + "',Description='" + rtxtDescription.Text + "' WHERE Prog_Code='" + proCode + "'";
                }
                else
                {
                    query = "INSERT INTO Program(Prog_Code, Prog_Name, Description, Duration, Dept_Code) VALUES('" + cboProgramCode.Text + "', '" + cboProgramName.Text + "', '" + rtxtDescription.Text + "', '" + cboDepartmentCode.Text + "', '" + cboDuration.Text + "')";
                }
                try
                {
                    // MessageBox.Show("Am there");
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteReader();
                        connect.CloseConnection();
                        MessageBox.Show("Successfull");
                        Reset();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int user;

            if (txtEmailAddress.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmailAddress.Focus();
            }
            else if (txtFirstName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtFirstName.Focus();
            }
            else if (txtLastName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLastName.Focus();
            }
            else if (txtPhoneNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPhoneNo.Focus();
            }
            else if (txtUserCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserCode.Focus();
            }
            else if (txtUserName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtUserName.Focus();
            }
            else if (txtPassword.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
            }
            else if (cboPriviledges.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboPriviledges.Focus();
            }
            else if (dtpDateOfRegistration.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpDateOfRegistration.Focus();
            }

            /* else if (rbtnActive.Text == "")
             * {
             *   MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *   rbtnActive.Focus();
             * }
             * else if (rbtnInactive.Text == "")
             * {
             *   MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *   rbtnInactive.Focus();
             * }*/
            else
            {
                if (rbtnActive.Checked == true)
                {
                    user = 1;
                }
                else
                {
                    user = 0;
                }
                if (cboUserCode.Visible == true)
                {
                    query = "UPDATE user SET User_Code='" + cboUserCode.Text + "', F_Name='" + txtFirstName.Text + "', L_Name='" + txtLastName.Text + "', Postal_Address='" + txtPostalAddress.Text + "', Phone_No='" + txtPhoneNo.Text + "',Priviledges='" + cboPriviledges.Text + "',Passsword='" + txtPassword.Text + "',Date_Of_Reg='" + dtpDateOfRegistration.Text + "', '" + user + "' WHERE University_Code= '" + usrCode + "'";
                }
                else
                {
                    query = "INSERT INTO user(User_Code, Username, F_Name, L_Name, Postal_Address, Phone_No, Priviledges, Passsword, Date_Of_Reg, Satus) VALUES('" + txtUserName + "', '" + txtUserCode + "', '" + txtFirstName + "', '" + txtLastName + "', '" + txtPassword + "', '" + txtPhoneNo + "', '" + txtPostalAddress + "', '" + cboPriviledges + "', '" + dtpDateOfRegistration + "', '" + user + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        //MySqlDataReader dataReader
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }


                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }
Exemplo n.º 19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int stat;

            if (txtRegNo.Text == "" && cboRegNo.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRegNo.Focus();
            }
            else if (cboRegNo.Text == "" && cboRegNo.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboRegNo.Focus();
            }
            else if (txtFirstName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtFirstName.Focus();
            }
            else if (txtMiddleName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMiddleName.Focus();
            }
            else if (txtLastName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtLastName.Focus();
            }
            else if (txtPhoneNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPhoneNo.Focus();
            }
            else if (txtPostalAddress.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPostalAddress.Focus();
            }
            else if (cboProgramCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboProgramCode.Focus();
            }
            else if (cboAcademicCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboAcademicCode.Focus();
            }
            else if (cboYearCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboYearCode.Focus();
            }

            /*else if (rbtnActive.Text == "")
             * {
             *  MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  rbtnActive.Focus();
             * }
             * else if (rbtnInactive.Text == "")
             * {
             *  MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  rbtnInactive.Focus();
             * }*/
            else
            {
                if (rbtnActive.Checked == true)
                {
                    stat = 1;
                }
                else
                {
                    stat = 0;
                }
                if (cboRegNo.Visible == true)
                {
                    query = "UPDATE student SET Reg_No='" + cboRegNo.Text + "',F_Name='" + txtFirstName.Text + "' ,M_Name='" + txtMiddleName.Text + "',L_Name='" + txtLastName.Text + "',Status='" + stat + "',Phone_No='" + txtPhoneNo.Text + "',Email_Address='" + txtEmailAddress.Text + "',Postal_Address='" + txtPostalAddress.Text + "',Prog_Code='" + cboProgramCode.Text + "',Acad_Code='" + cboAcademicCode.Text + "',Year_Code='" + cboYearCode.Text + "' WHERE Reg_No='" + stdCode + "'";
                }
                else
                {
                    query = "INSERT INTO student(Reg_No, F_Name, M_Name, L_Name, Status, Phone_No,Email_Address, Postal_Address, Prog_Code, Acad_Code, Year_Code) VALUES('" + txtRegNo.Text + "', '" + txtFirstName.Text + "', '" + txtMiddleName.Text + "', '" + txtLastName.Text + "', '" + stat + "', '" + txtPhoneNo.Text + "', '" + txtEmailAddress.Text + "','" + txtPostalAddress.Text + "', '" + cboProgramCode.Text + "', '" + cboAcademicCode.Text + "', '" + cboYearCode.Text + "')";
                }

                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();

                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed!" + ex);
                }
            }
        }
Exemplo n.º 20
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtExaminerCode.Text == "" && cboExaminer_Code.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExaminerCode.Focus();
            }
            if (cboExaminer_Code.Text == "" && txtExaminerCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboExaminer_Code.Focus();
            }
            else if (txtFirstName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtFirstName.Focus();
            }
            else if (txtMiddleName.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtMiddleName.Focus();
            }
            else if (txtPhoneNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPhoneNo.Focus();
            }
            else if (txtEmailAddress.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtEmailAddress.Focus();
            }


            else
            {
                if (cboExaminer_Code.Visible == true)
                {
                    query = "UPDATE examiner SET Examiner_Code='" + cboExaminer_Code.Text + "',F_Name= '" + txtFirstName.Text + "',M_Name ='" + txtMiddleName.Text + "', L_Name='" + txtLastName.Text + "', Phone_No='" + txtPhoneNo.Text + "', Email_Address='" + txtEmailAddress.Text + "' WHERE Examiner_Code='" + exaCode + "'";
                }
                else
                {
                    query = "INSERT INTO examiner (Examiner_Code, F_Name, M_Name, L_Name, Phone_No, Email_Address) VALUES('" + txtExaminerCode.Text + "', '" + txtFirstName.Text + "', '" + txtMiddleName.Text + "', '" + txtLastName.Text + "', '" + txtPhoneNo.Text + "', '" + txtEmailAddress.Text + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();
                        MessageBox.Show("Connection Successful");
                        Reset();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed" + ex);
                }
            }
        }
Exemplo n.º 21
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtCourseCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCourseCode.Focus();
            }
            else if (txtE_ExaminerCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtE_ExaminerCode.Focus();
            }
            else if (txtExamCode.Text == "" && cbnExamCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExamCode.Focus();
            }
            else if (cbnExamCode.Text == "" && cbnExamCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbnExamCode.Focus();
            }
            else if (txtExaminerCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExaminerCode.Focus();
            }
            else if (txtRegNo.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtRegNo.Focus();
            }

            else if (txtExaminerCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtExaminerCode.Focus();
            }
            else if (cboExamType.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboExamType.Focus();
            }
            else if (dtpExamDate.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpExamDate.Focus();
            }


            else
            {
                if (cboExamType.Visible == true)
                {
                    query = "UPDATE exam SET Exam_Code='" + cbnExamCode.Text + "',Course_COde= '" + txtCourseCode.Text + "',Reg_No ='" + txtRegNo.Text + "', Examiner_Code='" + txtExaminerCode.Text + "', E_Examiner_Code='" + txtE_ExaminerCode.Text + "', Exam_Type='" + cboExamType.Text + "', Exam_Date='" + dtpExamDate.Text + "' WHERE Exam_Code='" + xamCode + "'";
                }
                else
                {
                    query = "INSERT INTO Exam(Exam_Code, Reg_No, Course_Code, Examiner_Code, E_Examiner_COde, Exam_Type, Exam_Date) VALUES('" + txtExamCode.Text + "', '" + txtExaminerCode.Text + "', '" + txtRegNo.Text + "', '" + txtE_ExaminerCode + "', '" + txtCourseCode.Text + "', '" + cboExamType.Text + "', '" + dtpExamDate.Text + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteNonQuery();
                        connect.CloseConnection();
                        MessageBox.Show("Successful");
                        Reset();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Failed" + ex);
                }
            }
        }
Exemplo n.º 22
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int status;

            if (cbn1YearOfStudy.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbn1YearOfStudy.Focus();
            }
            else if (cbn2Semester.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbn2Semester.Focus();
            }
            else if (txtYearCode.Text == "" && cboYearCode.Visible == false)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtYearCode.Focus();
            }
            else if (cboYearCode.Text == "" && cboYearCode.Visible == true)
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboYearCode.Focus();
            }

            /*else if (rbtn1Active.Text == "")
             * {
             *  MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  rbtn1Active.Focus();
             * }
             * else if (rbtn2Inactive.Text == "")
             * {
             *  MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
             *  rbtn2Inactive.Focus();
             * }*/


            else
            {
                status = 0;
                if (rbtn1Active.Checked == true)
                {
                    status = 1;
                }
                else if (rbtn2Inactive.Checked == true)
                {
                    status = 0;
                }

                if (cboYearCode.Visible == true)
                {
                    query = "UPDATE year_of_study SET Year_Code='" + cboYearCode.Text + "',Yos='" + cbn1YearOfStudy.Text + "', Semester='" + cbn2Semester.Text + "',Status='" + status + "' WHERE Year_Code='" + yearCode + "'";
                }
                else
                {
                    query = "INSERT INTO year_of_study(Year_Code, Yos,Semester, Status) VALUES('" + cboYearCode.Text + "', '" + cbn1YearOfStudy.Text + "', '" + cbn2Semester.Text + "', '" + status + "')";
                }
                try
                {
                    conn connect = new conn();
                    if (connect.OpenConnection() == true)
                    {
                        //create command and assign the query and connection from the constructor
                        MySqlCommand cmd = new MySqlCommand(query, connect.connection);
                        cmd.ExecuteReader();
                        connect.CloseConnection();
                        MessageBox.Show("Record Successfully saved!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Reset();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("" + ex);
                }
            }
        }