private void btnHuyHd_Click(object sender, EventArgs e) { string err = ""; try { //xóa hết các chi tiết hóa đơn của hóa đơn đó if (balChiTietNhap.XoaChiTietNhapTheoMaDonNhap(ref err, txtMaHD.Text)) { //khi thành công thì xóa đơn nhập try { // Xóa hóa đơn nhập if (balHDNhapHang.XoaDonNhap(ref err, txtMaHD.Text)) { //xóa thành công DonThongTinCTHD(); DonThongTinHD(); groupSP.Enabled = false; MessageBox.Show("Đã hủy đơn nhập...", "Thành công", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Không thể xóa đơn nhập!!!! \rLỗi:" + err, "Lỗi SQL", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception er) { MessageBox.Show("Xóa đơn nhập không thành công\rLỗi: " + er.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Không thể xóa chi tiết đơn nhập!!!!\r Lỗi:" + err, "Lỗi SQL", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception er) { MessageBox.Show("Xóa chi tiết đơn nhập không thành công\rLỗi: " + er.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }