예제 #1
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();
                }
            }
        }
예제 #2
0
        private void cboDepartmentCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboDepartmentCode.Text == "")
            {
                MessageBox.Show("Ensure all fields are filled", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboDepartmentCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM department WHERE Dept_Code LIKE '" + cboDepartmentCode.Text + "' ORDER BY Dept_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.cboDepartmentName.Text = dataReader["Dept_Name"].ToString();
                        this.rtxtDescription.Text   = dataReader["Description"].ToString();
                        this.cboFacultyCode.Text    = dataReader["Faculty_Code"].ToString();

                        deptCode = dataReader["Dept_Code"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #3
0
        private void cboCourseCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboCourseCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboCourseCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM course WHERE Course_Code LIKE '" + cboCourseCode.Text + "' ORDER BY Course_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.txtCourseName.Text   = dataReader["Course_Title"].ToString();
                        this.txtUnits.Text        = dataReader["Units"].ToString();
                        this.rtxtDescription.Text = dataReader["Description"].ToString();
                        this.cboProgramCode.Text  = dataReader["Prog_Code"].ToString();

                        courCode = dataReader["Course_Code"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbnExamCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cbnExamCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM exam WHERE Exam_Code LIKE '" + cbnExamCode.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

                    if (dataReader.Read())
                    {
                        this.txtCourseCode.Text     = dataReader["Course_Code"].ToString();
                        this.txtRegNo.Text          = dataReader["Reg_No"].ToString();
                        this.txtExaminerCode.Text   = dataReader["Examiner_Code"].ToString();
                        this.txtE_ExaminerCode.Text = dataReader["E_Examiner_Code"].ToString();
                        this.cboExamType.Text       = dataReader["Exam_Type"].ToString();
                        this.dtpExamDate.Text       = dataReader["Exam_Date"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #5
0
        private void cboYearCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboYearCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboYearCode.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM year_of_study WHERE Year_Code LIKE '" + cboYearCode.Text + "' ORDER BY Year_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.cbn1YearOfStudy.Text = dataReader["Yos"].ToString();
                        this.cbn2Semester.Text    = dataReader["Semester"].ToString();
                        dataReader["Semester"].ToString();
                        yearCode = dataReader["Year_Code"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #6
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();
                }
            }
        }
예제 #7
0
        private void GetCourseCode()
        {
            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
            {
                query = "INSERT INTO course(Course_Code, Course_Title, Description, Units, Prog_Code) VALUES('" + cboCourseCode.Text + "', '" + txtCourseName.Text + "', '" + rtxtDescription.Text + "', '" + txtUnits.Text + "', '" + cboProgramCode.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);
            }
        }
예제 #8
0
        private void cboUniversityCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboUniversityCode.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboUniversityCode.Focus();
            }
            else
            {
                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

                    if (dataReader.Read())
                    {
                        this.txtUniversityName.Text = dataReader["University_Name"].ToString();
                        this.txtPostalAddress.Text  = dataReader["Postal_Code"].ToString();
                        this.txtLocation.Text       = dataReader["Location"].ToString();
                        this.txtZipCode.Text        = dataReader["Zip_Code"].ToString();
                        this.txtTown.Text           = dataReader["Town"].ToString();
                        uniCode = dataReader["University_Code"].ToString();       //for editing
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #9
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     //for deletion
     if (cboUniversityCode.Visible == false)
     {
         MessageBox.Show("Select Details to Edit");
         cboUniversityCode.Visible = true;
     }
     else if (MessageBox.Show("Are you sure you want to exit?", "EIMS Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         query = "DELETE FROM university WHERE University_Code='" + cboUniversityCode.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);
         }
     }
 }
예제 #10
0
        private void cboRegNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cboRegNo.Text == "")
            {
                MessageBox.Show("Ensure that all fields are filled!", "EIMS Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
                cboRegNo.Focus();
            }
            else
            {
                conn connect = new conn();
                if (connect.OpenConnection() == true)
                {
                    query = "SELECT * FROM student WHERE Reg_No LIKE '" + cboRegNo.Text + "' 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

                    if (dataReader.Read())
                    {
                        this.txtFirstName.Text     = dataReader["F_Name"].ToString();
                        this.txtMiddleName.Text    = dataReader["M_Name"].ToString();
                        this.txtLastName.Text      = dataReader["L_Name"].ToString();
                        this.txtEmailAddress.Text  = dataReader["Email_Address"].ToString();
                        this.txtPhoneNo.Text       = dataReader["Phone_No"].ToString();
                        this.txtPostalAddress.Text = dataReader["Postal_Address"].ToString();
                        //this.rbtnActive.Text = dataReader["Status"].ToString();
                        //this.rbtnInactive.Text = dataReader["Status"].ToString();
                        dataReader["Status"].ToString();
                    }
                    connect.CloseConnection();
                }
            }
        }
예제 #11
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);
                }
            }
        }
예제 #12
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;
                }
            }
        }
예제 #13
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);
         }
     }
 }
예제 #14
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();
                }
            }
        }
예제 #15
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);
                }
            }
        }
예제 #16
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();
            }
        }
예제 #17
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();
            }
        }
예제 #18
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);
                }
            }
        }
예제 #19
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);
                }
            }
        }
예제 #20
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);
                }
            }
        }
예제 #21
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);
                }
            }
        }
예제 #22
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);
                }
            }
        }
예제 #23
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);
                }
            }
        }
예제 #24
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);
                }
            }
        }
예제 #25
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);
                }
            }
        }
예제 #26
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);
                }
            }
        }