private void btnThanhToan_Click(object sender, EventArgs e) { db.UpdateTTHD(sdt); var mp = (from hd in db.tbl_hoadons where hd.SoDienThoai == sdt select hd).ToList(); foreach (var item in mp) { maphong = item.MaPhong; db.UpdateTTPhong(maphong); } db.UpdateTTDP(sdt); Load_HD(); }
private void btnDel_Click(object sender, EventArgs e) { if (dgvDatPhong.CurrentRow != null) { var r = dgvDatPhong.CurrentRow; var mp = from dp in db.tbl_chitietdats where dp.Mapd.Equals(r.Cells["MaPhieu"].Value.ToString()) select dp; foreach (var item in mp) { maphong = item.MaPhong; } db.DelChiTietDat(r.Cells["MaPhieu"].Value.ToString()); db.DelNhanPhong(r.Cells["MaPhieu"].Value.ToString()); db.UpdateTTPhong(maphong); db.SubmitChanges(); Load_PhongTrong(); Load_DSDat(); MessageBox.Show("Thành công", "Hủy Nhận Phòng", MessageBoxButtons.OK, MessageBoxIcon.Information); frmMHC frm = new frmMHC(); frm.Load_Phong(); } }