public bool Kiemtrasutontai(string maphieu) { Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Where(x => x.maPhieuNhap == maphieu).FirstOrDefault(); if (pnk == null) { return(false); } return(true); }
public bool DeletePhieuNK(string delid) { try { Tbl_PhieuNK deletema = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == delid); DB.Tbl_PhieuNKs.DeleteOnSubmit(deletema); DB.SubmitChanges(); return(true); } catch { return(false); } }
public int ThemPhieuNhapKho(ePhieuNK newpnk) { if (Kiemtrasutontai(newpnk._maPhieuNhap)) { return(0); } Tbl_PhieuNK pnkTmp = new Tbl_PhieuNK(); pnkTmp.maPhieuNhap = newpnk._maPhieuNhap; pnkTmp.ngayLapNhap = newpnk._ngayLapNhap; pnkTmp.maNV = newpnk._maNV; pnkTmp.msKho = newpnk._msKho; pnkTmp.tinhTrang = newpnk._tinhTrang; DB.Tbl_PhieuNKs.InsertOnSubmit(pnkTmp); DB.SubmitChanges(); return(1); }
public bool UpDatePhieuNK(ePhieuNK updatepnk) { try { Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == updatepnk._maPhieuNhap); pnk.maPhieuNhap = updatepnk._maPhieuNhap; pnk.ngayLapNhap = Convert.ToDateTime(updatepnk._ngayLapNhap); pnk.maNV = updatepnk._maNV; pnk.msKho = updatepnk._msKho; pnk.tinhTrang = updatepnk._tinhTrang; DB.SubmitChanges(); return(true); } catch { return(false); } }
public bool AddAllPhieuNK(ePhieuNK newpnk) { try { Tbl_PhieuNK pnk = DB.Tbl_PhieuNKs.Single(x => x.maPhieuNhap == newpnk._maPhieuNhap); pnk.maPhieuNhap = newpnk._maPhieuNhap; pnk.ngayLapNhap = Convert.ToDateTime(newpnk._ngayLapNhap); pnk.maNV = newpnk._maNV; pnk.msKho = newpnk._msKho; pnk.tinhTrang = newpnk._tinhTrang; DB.Tbl_PhieuNKs.InsertOnSubmit(pnk); DB.SubmitChanges(); return(true); } catch { return(false); } }