示例#1
0
        private void btnKhoiPhucNV_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Khôi phục nhân viên " + dgvNV["Tên nhân viên", dgvNV.CurrentRow.Index].Value.ToString() + "?",
                                                  "THÔNG BÁO!",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                int      rowIndex = dgvNV.CurrentRow.Index;
                string   ma       = dgvNV["Mã nhân viên", rowIndex].Value.ToString();
                string   ten      = dgvNV["Tên nhân viên", rowIndex].Value.ToString();
                bool     gioitinh = (bool)dgvNV["Giới tính", rowIndex].Value;
                DateTime ngaysinh = (DateTime)dgvNV["Ngày sinh", rowIndex].Value;
                string   sdt      = dgvNV["Số điện thoại", rowIndex].Value.ToString();
                string   diaChi   = dgvNV["Địa chỉ", rowIndex].Value.ToString();

                if (dgvNV["Action", rowIndex].Value.ToString().Trim() == "D")
                {
                    nvbll.KhoiPhuc(ma, ten, gioitinh, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục nhân viên " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else if (dgvNV["Action", rowIndex].Value.ToString().Trim() == "U")
                {
                    nvbll.NhanVien_Update(ma, ten, gioitinh, ngaysinh, sdt, diaChi);
                    MessageBox.Show("Ðã khôi phục thông tin nhân viên " + ten, "THÔNG BÁO!",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }