public ActionResult XoaHoaDon(long id) { if (Session["admin"] == null) { return(RedirectToAction("Login", "Admin")); } if (hd.XoaHD(id)) { return(Json(new { message = "Xóa thành công!", code = 1 }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { message = "Xóa thất bại!", code = -1 }, JsonRequestBehavior.AllowGet)); } }
private void btnThoat_Click(object sender, EventArgs e) { frmSoDoChinh SoDoChinh = new frmSoDoChinh(); string maban = txtMaBan.Text; //FromSoDoChinh = new frmSoDoChinh(); BanCoKhach bck = getBanCoKhach(); Oder od = getOder(); CTOder ctod = getCTOder(); HoaDon hd = getHD(); CTHoaDon cthd = getCTHD(); BanSDNhieu bsd = getBanSDNhieu(); bck.MaBan = txtMaBan.Text; int i = int.Parse(txtMaOder.Text); od.MaOder = i; hd.MaOder = i; string maHD = hdBO.layMaHD(i); int mahd = 0; Int32.TryParse(maHD, out mahd); string luotsd = bsdBO.layLuotSD(txtMaBan.Text); int lsd = 0; Int32.TryParse(luotsd, out lsd); if (ctBO.kiemTraGoiMon(i) == false) { hdBO.XoaHD(hd); bckBO.XoaBanCoKhach(bck); odBO.XoaOder(od); int luotsddung = lsd - 1; bsd.LuotSD = luotsddung; bsdBO.SuaLuotSD(bsd); } this.Close(); SoDoChinh.Show(); }