void InitPotentialStudentData() { PotentialStudentDAL potentialStudentDAL = new PotentialStudentDAL(); potentialStudentDAL.ConnectToDatabase(); List <PotentialStudentDTO> potentialStudentDTOs = potentialStudentDAL.GetAllPotentialStudent(); dgvListPotentialStudent.DataSource = potentialStudentDTOs; }
private void btConfim_Click(object sender, EventArgs e) { PotentialStudentDAL potentialStudentDAL = new PotentialStudentDAL(); potentialStudentDAL.ConnectToDatabase(); try { if (potentialStudentDAL.InsertPotentialStudent(textboxPotentialStudentID.Text, textboxPotentialStudentName.Text, int.Parse(textboxPotentialStudentInputScore.Text), textboxPotentialStudentPhoneNumber.Text, int.Parse(textboxPotentialStudentAppointmentCount.Text), dropboxStatus.Text, textboxPotentialStudentAddress.Text, dropboxPotentialStudentGender.Text)) { MessageBox.Show("Thêm học viên thành công!!!"); this.Hide(); PotentialStudentForm f = new PotentialStudentForm(); f.Show(); } } catch (Exception) { MessageBox.Show("Thất bại, Kiểm tra lại dữ liệu nhập vào!!!"); }; }
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) { } }