public bool ThemDSHangNhapKho(DSHANGNHAP ds) { try { qlkho.DSHANGNHAPs.InsertOnSubmit(ds); qlkho.SubmitChanges(); return(true); } catch { return(false); } }
public bool SuaSoLuongSP(DSHANGNHAP ds) { try { DSHANGNHAP k = qlkho.DSHANGNHAPs.Where(t => t.MAPN == ds.MAPN).Where(t => t.MASP == ds.MASP).FirstOrDefault(); k.SL = ds.SL; int n = (int)k.SL; k.ThanhTien = ThanhTien(n, ds.MASP.ToString()); qlkho.SubmitChanges(); return(true); } catch { return(false); } }
public bool KTTonTaiSPdsPhieuNhap(string mapn) { DSHANGNHAP p = qlkho.DSHANGNHAPs.Single(t => t.MAPN == mapn); if (p != null) { return(true); } else { return(false); } }
public void XoaDSPhieuNhap(string mapn, int dem) { for (int i = 0; i <= dem; i++) { DSHANGNHAP p = qlkho.DSHANGNHAPs.Where(t => t.MAPN == mapn).FirstOrDefault(); if (p == null) { return; } else { qlkho.DSHANGNHAPs.DeleteOnSubmit(p); qlkho.SubmitChanges(); } } }
public bool SuaTTDSPhieuNhap(DSHANGNHAP ds) { try { DSHANGNHAP k = qlkho.DSHANGNHAPs.Where(t => t.MAPN == ds.MAPN).Where(t => t.MASP == ds.MASP).FirstOrDefault(); ds.SL = k.SL + 1; int n = (int)ds.SL; string ma = ds.MASP.ToString(); ds.ThanhTien = ThanhTien(n, ma); k.SL = ds.SL; k.ThanhTien = ds.ThanhTien; qlkho.SubmitChanges(); return(true); } catch { return(false); } }