Esempio n. 1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            int blresult = 0;

            blresult = Convert.ToInt16(MessageBox.Show("Are you sure you want to delete this row?", "Deleting Employee", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation));
            if (blresult == 1)
            {
                if (string.IsNullOrWhiteSpace(txtEmployeeID.Text) != true)
                {
                    if (bus_emp.Delete(txtEmployeeID.Text))
                    {
                        MessageBox.Show("DELETING SUCCESS!", "DELETE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        LoadData();
                        ResetValues();
                    }
                    else
                    {
                        MessageBox.Show("DELETING FAIL!", "DELETE", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MessageBox.Show("Please enter the Employee ID you want to delete in the Employee ID box!");
                    txtEmployeeID.Focus();
                }
            }//Kết thúc thao tác xóa
        }
        private void btndeletenv_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có muốn xoá thật không?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                BUS_Employee dl = new BUS_Employee();
                DTO_Employee dt = new DTO_Employee(Convert.ToInt32(txtmanv.Text));
                dl.Delete(dt);
                dgvlistnv.DataSource = GetEmployee();

                MessageBox.Show(" BẠN ĐÃ XÓA NHÂN VIÊN THÀNH CÔNG", " Xác nhận");
            }
        }