public PHIEUNHAPHANGCHINHANH createNHCN(TAIKHOAN tk) { db = new CMART8Entities(); PHIEUNHAPHANGCHINHANH pnh = new PHIEUNHAPHANGCHINHANH(); pnh.SOPHIEU = autoID(); pnh.NGAYNHAP = DateTime.Now; pnh.MATK = tk.MATK; db.PHIEUNHAPHANGCHINHANHs.Add(pnh); db.SaveChanges(); return(pnh); }
public bool deletePN(PHIEUNHAPHANGCHINHANH PN) { try { db = new CMART8Entities(); PHIEUNHAPHANGCHINHANH pn = db.PHIEUNHAPHANGCHINHANHs.Find(PN.SOPHIEU); db.PHIEUNHAPHANGCHINHANHs.Remove(pn); db.SaveChanges(); return(true); } catch { return(false); } }
//Update Phiếu nhập hàng chi nhánh public bool updatePNHTS(PHIEUNHAPHANGCHINHANH PN, string sophieuTS, string chinhanh) { try { db = new CMART8Entities(); PHIEUNHAPHANGCHINHANH pn = db.PHIEUNHAPHANGCHINHANHs.Find(PN.SOPHIEU); pn.SOPHIEUNHTS = sophieuTS; pn.CHINHANH = chinhanh; db.Entry(pn).State = System.Data.EntityState.Modified; db.SaveChanges(); return(true); } catch { return(false); } }