private void btnThem_Click(object sender, EventArgs e) { if (txtHoTen.Text != "" && txtSDT.Text != "" && txtGioiTinh.Text != "" && txtDate.Text != "" && txtDepartment.Text != "" && txtSDT.Text != "") { DialogResult dialog = MessageBox.Show("Bạn có muốn thêm nhân viên " + txtHoTen.Text + " ở phòng ban " + txtDepartment.Text + " không?", "Xác nhận thêm", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) { if (!DNV.check_Nv(txtMaNv.Text)) { if (DNV.Add_NV(txtHoTen.Text, txtGioiTinh.Text, txtDate.Value, txtDiaChi.Text, txtSDT.Text, txtDepartment.Text)) { MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); openButton(true); } else { MessageBox.Show("Thêm thất bại, vui lòng kiểm tra lại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); } } } } else { MessageBox.Show("Vui lòng điền đầy đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnUpdate_Click(object sender, EventArgs e) { if (txtHoTen.Text != "" && txtSDT.Text != "" && txtGioiTinh.Text != "" && txtDate.Text != "" && txtDepartment.Text != "" && txtSDT.Text != "") { DialogResult dialog = MessageBox.Show("Bạn có chắc chắn muốn cập nhật mục này không?", "Xác nhận cập nhật", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) { if (DNV.Update_NV(txtHoTen.Text, txtGioiTinh.Text, txtDate.Value, txtDiaChi.Text, txtSDT.Text, txtDepartment.Text, txtMaNv.Text)) { MessageBox.Show("Cập nhật thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); openButton(true); } else { MessageBox.Show("Cập nhật thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); } } } else { MessageBox.Show("Vui lòng không để trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Btn_ReFresh_Click(object sender, EventArgs e) { Data_NV DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); Clear(); loi = false; }
private void btnDelete_Click(object sender, EventArgs e) { if (txtHoTen.Text != "" && txtSDT.Text != "" && txtGioiTinh.Text != "" && txtDate.Text != "" && txtDepartment.Text != "" && txtSDT.Text != "") { DialogResult dialog = MessageBox.Show("Bạn có chắc chắn muốn xóa nhân viên " + txtHoTen.Text + " ở phòng ban " + txtDepartment.Text + " không?", "Xác nhận xóa", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialog == DialogResult.Yes) { if (DNV.Delete_NV(txtMaNv.Text)) { MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); openButton(true); } else { MessageBox.Show("Xóa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); } } } }
private void DanhSachNhanVien_Load(object sender, EventArgs e) { DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); }
private void ThongTinNhanVien_Enter(object sender, EventArgs e) { DNV = new Data_NV(); Load_NV(DNV.Inf_Staff()); }