public bool ktslnhap(int idpd, int idsp, int sldanhap) { bool kq = true; CHITIETPHIEUDAT ctpd = quanLyKho.CHITIETPHIEUDATs.SingleOrDefault(n => n.ID_PD == idpd && n.ID_SP == idsp); int sl = (int)ctpd.SOLUONG; if (sldanhap > sl) { kq = false; } return(kq); }
public bool insert_CTPD(int idpd, int idsp, int soluong) { try { CHITIETPHIEUDAT insert = new CHITIETPHIEUDAT(); insert.ID_PD = idpd; insert.ID_SP = idsp; insert.SOLUONG = soluong; insert.THANHTIEN = 0; quanLyKho.CHITIETPHIEUDATs.InsertOnSubmit(insert); quanLyKho.SubmitChanges(); return(true); } catch (Exception) { return(false); throw; } }