private void bt_Huy_Click(object sender, EventArgs e) { if (txb_MaKH.Text == "") { MessageBox.Show("Chưa nhập thông tin đơn đặt phòng cần hủy", "Erro"); return; } DTO_CTHD obj_cthd = new DTO_CTHD(); DTO_CTDV obj_ctdv = new DTO_CTDV(); DTO_HoaDon obj_hd = new DTO_HoaDon(); obj_hd.MaCTHD = get_MACTHD; obj_ctdv.Macthd = get_MACTHD; obj_cthd.Macthd = get_MACTHD; if (bus_ctdv.DeleteAll(obj_ctdv) != "0") { MessageBox.Show("Huy phong that bai"); return; } if (bus_hd.Delete(obj_hd) != "0") { MessageBox.Show("Huy phong that bai"); return; } if (bus_cthd.Delete(obj_cthd) != "0") { MessageBox.Show("Huy phong that bai"); return; } List <DTO_LoaiPhong> lsobj_lp = new List <DTO_LoaiPhong>(); List <DTO_Phong> lsobj_p = new List <DTO_Phong>(); string result = bus_p.SelectAll(lsobj_p); string result1 = bus_lp.SelectAll(lsobj_lp); var Malp = from x in lsobj_p join y in lsobj_lp on x.Malp equals y.Malp where x.Sophong == txb_SoPhong.Text select new { SoPhong = x.Sophong, TrangThai = "EMPTY", MaLP = x.Malp, }; DTO_Phong objp = new DTO_Phong(); foreach (var x in Malp) { objp.Sophong = x.SoPhong; objp.Malp = x.MaLP; objp.Status = x.TrangThai; } bus_p.Update(objp); MessageBox.Show("Huy phong thanh cong"); }