public int XoaThongTinPhieuBanHang(string mapbh, string tenkho) { MuaHangBUS muaHangBUS = new MuaHangBUS(); DataTable dt1 = uC_BanHang_TheoChungTuDAO.ChuyenTenKhoThanhMaKho(tenkho); string makho = ""; if (dt1.Rows.Count > 0 && dt1 != null) { makho = dt1.Rows[0]["MaKH"].ToString(); } DataTable kt = uC_BanHang_TheoChungTuDAO.KiemTraXemPhieuNhapHangDaCoPhieuThu(mapbh); if (kt.Rows.Count == 0) { DataTable dt = uC_BanHang_TheoChungTuDAO.LayThongTinCT_PhieuMuaHangTheoMa(mapbh); if (uC_BanHang_TheoChungTuDAO.XoaCT_PhieuMuaHang(mapbh) > 0) { for (int i = 0; i < dt.Rows.Count; i++) { muaHangBUS.CapNhatSoLuongHangHoa(dt.Rows[i]["MaSanPham"].ToString(), int.Parse(dt.Rows[i]["SoLuong"].ToString()), makho); } uC_BanHang_TheoChungTuDAO.XoaPhieuBanHang(mapbh); return(1); } } else { return(-1); } return(0); }
public int XoaCT_PhieuBanHangTheoMa(string mapbh, string makho) { DataTable dt = phieuBanHangDAO.LayChiTietPhieuBanHangTheoMa(mapbh); phieuBanHangDAO.XoaCT_PhieuBanHang(mapbh); if (dt.Rows.Count > 0 && dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { MuaHangBUS muaHangBUS = new MuaHangBUS(); muaHangBUS.CapNhatSoLuongHangHoa(dt.Rows[i]["MaSanPham"].ToString(), int.Parse(dt.Rows[i]["SoLuong"].ToString()), makho); } } return(1); }