Beispiel #1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (txtMaNhanVien.Text == frmSieuThi.nv.MaNhanVien + "")
            {
                MessageBox.Show("Thao tác thất bạt, không được xóa chính bạn", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            else
            {
                BULHoaDon bulHoaDon = new BULHoaDon();
                if (bulHoaDon.coNhanVien(txtMaNhanVien.Text))
                {
                    MessageBox.Show("Có dữ liệu khác đang chứa nhân viên này", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
                else
                {
                    try
                    {
                        BULNhanVien bul = new BULNhanVien();
                        bul.xoaNhanVien(new NhanVien(int.Parse(txtMaNhanVien.Text)));
                        frmST.hienDanhSachNhanVien();

                        MessageBox.Show("Xóa thành công", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.Close();
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Thao tác thất bạt, dữ liệu sai", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    }
                }
            }
        }
Beispiel #2
0
        private void btnXoaNhanVien_Click(object sender, EventArgs e)
        {
            NhanVien nv = new NhanVien(txtMaNhanVien.Text, txtTenNhanVien.Text, txtDiaChi.Text, txtSoDienThoai.Text);

            DialogResult rs = MessageBox.Show("Ban Có Muốn Xóa Không ???", "Xóa Nhân Viên", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (rs == DialogResult.Yes)
            {
                bulnv.xoaNhanVien(nv);
                MessageBox.Show("Xóa thành công");
                this.Close();
            }
        }