Exemple #1
0
        public PotentialStudentDTO GetPotentialStudent(string id)
        {
            PotentialStudentDTO potentialstudent;

            this.ConnectToDatabase();

            MySqlCommand command = this.mySQLConnection.CreateCommand();

            command.CommandText = "SELECT * FROM POTENTIAL_STUDENT where POTENTIAL_STUDENT_ID = '" + id + "'";

            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                string potentialstudentId   = reader.GetString(0);
                string potentialstudentName = reader.GetString(1);
                float  mark      = reader.GetFloat(2);
                string phone     = reader.GetString(3);
                int    dateCount = reader.GetInt32(4);
                string status    = reader.GetString(5);
                string address   = reader.GetString(6);
                string gender    = reader.GetString(7);
                potentialstudent = new PotentialStudentDTO(potentialstudentId, potentialstudentName, mark, phone, dateCount, status, address, gender);
                return(potentialstudent);
            }

            reader.Close();
            this.Close();
            return(null);
        }
Exemple #2
0
        public List <PotentialStudentDTO> GetAllPotentialStudent()
        {
            List <PotentialStudentDTO> listPotentialStudent = new List <PotentialStudentDTO>();

            this.ConnectToDatabase();

            MySqlCommand command = this.mySQLConnection.CreateCommand();

            command.CommandText = "SELECT * FROM POTENTIAL_STUDENT ";

            MySqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                string potentialstudentId   = reader.GetString(0);
                string potentialstudentName = reader.GetString(1);
                float  mark      = reader.GetFloat(2);
                string phone     = reader.GetString(3);
                int    dateCount = reader.GetInt32(4);
                string status    = reader.GetString(5);
                string address   = reader.GetString(6);
                string gender    = reader.GetString(7);
                PotentialStudentDTO potentialstudent = new PotentialStudentDTO(potentialstudentId, potentialstudentName, mark, phone, dateCount, status, address, gender);
                listPotentialStudent.Add(potentialstudent);
            }

            reader.Close();
            this.Close();
            return(listPotentialStudent);
        }
Exemple #3
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            //sửa thôn tin học viên
            PotentialStudentDTO    currentObject = (PotentialStudentDTO)dgvListPotentialStudent.CurrentRow.DataBoundItem;
            EditInforPotentialForm f             = new EditInforPotentialForm(currentObject);

            this.Close();
            f.Show();
        }
Exemple #4
0
        public bool InsertPotentialStudent(PotentialStudentDTO potentialstudent)
        {
            this.ConnectToDatabase();

            string Query = "insert into POTENTIAL_STUDENT values('" + potentialstudent.PotentialStudentId + "','"
                           + potentialstudent.PotentialStudentName + "','" + potentialstudent.Mark + "','" + potentialstudent.Phone
                           + "','" + potentialstudent.DateCount + "','" + potentialstudent.Status + "','" + potentialstudent.Address + "','" + potentialstudent.Gender + "');";

            //This is command class which will handle the query and connection object.
            MySqlCommand command = new MySqlCommand(Query, mySQLConnection);

            command.ExecuteNonQuery();


            this.Close();
            return(true);
        }
Exemple #5
0
        public bool UpdatePotentialStudent(PotentialStudentDTO potentialstudent)
        {
            this.ConnectToDatabase();

            string Query = "update POTENTIAL_STUDENT set POTENTIAL_STUDENT_NAME = '"
                           + potentialstudent.PotentialStudentName + "',MARK = '" + potentialstudent.Mark + "',PHONE = '" + potentialstudent.Phone
                           + "',DATE_COUNT = '" + potentialstudent.DateCount + "',STATUS = '" + potentialstudent.Status + "',ADDRESS ='" + potentialstudent.Address + "',GENDER='" + potentialstudent.Gender + "'"
                           + " WHERE POTENTIAL_STUDENT_ID='" + potentialstudent.PotentialStudentId + "'";

            //This is command class which will handle the query and connection object.
            MySqlCommand command = new MySqlCommand(Query, mySQLConnection);

            command.ExecuteNonQuery();


            this.Close();
            return(true);
        }
Exemple #6
0
        private void btConfim_Click(object sender, EventArgs e)
        {
            PotentialStudentDTO currentObject       = (PotentialStudentDTO)dgvListPotentialStudent.CurrentRow.DataBoundItem;
            PotentialStudentDAL potentialStudentDAL = new PotentialStudentDAL();

            potentialStudentDAL.ConnectToDatabase();
            // string idd = currentObject.PotentialStudentId;
            DialogResult dialogResult = MessageBox.Show("Bạn có chắc xoá học viên:" + currentObject.PotentialStudentId, "", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                potentialStudentDAL.DeletePotentialStudent(currentObject.PotentialStudentId);

                MessageBox.Show("Xoá học viên thành công!!!");
                this.Close();
                DeletePotentialStudentForm f = new DeletePotentialStudentForm();
                f.Show();
            }
            else if (dialogResult == DialogResult.No)
            {
            }
        }