public bool DeLetePDNNK(string SoPhieu) { var c = from i in db.PhieuNhapKhos where i.sopnk == SoPhieu select i; if (c.Any()) { throw new Exception("This Can't Be Delete"); } else { PhieuDNNK Phieu = db.PhieuDNNKs.Where(x => x.MaPhieuDNNK == SoPhieu).FirstOrDefault(); if (Phieu != null) { db.PhieuDNNKs.DeleteOnSubmit(Phieu); db.SubmitChanges(); return(true); } else { throw new Exception("Invalid ID"); } } }
private void UpdateTinhTrang(ePhieuNhapKho pnk) { PhieuDNNK p = db.PhieuDNNKs.Where(pdn => pdn.MaPhieuDNNK == pnk.SoPDNN).FirstOrDefault(); p.tinhtrang = 1; db.SubmitChanges(); }
private bool KtraTonTai(string soPhieu) { PhieuDNNK p = db.PhieuDNNKs.Where(pdn => pdn.MaPhieuDNNK == soPhieu).FirstOrDefault(); if (p != null) { return(false); } return(true); }
public IEnumerable <object> GetTTPhieuNhapKho(string maphieu) { PhieuDNNK pdnnk = db.PhieuDNNKs.Where(e => e.MaPhieuDNNK == maphieu).FirstOrDefault(); var query = pdnnk.ChiTietPhieuDNNKs.Select(e => new { e.SanPham.MaSP, e.SanPham.TenSp, e.SoLuong, e.GhiChu }); return(query.ToList()); }
public void InsertPDNNK(ePhieuDeNghiNhapKho Phieu) { Phieu.NgayLap = DateTime.Now; PhieuDNNK PDNNK = new PhieuDNNK(); PDNNK.MaPhieuDNNK = TaoMaPDNNK(); PDNNK.MaHoaDonNCC = Phieu.MaHoaDonNhaCungCap; PDNNK.MaKho = Phieu.MaKho; PDNNK.MaNhanVien = Phieu.MaNhanVien; PDNNK.MoTa = Phieu.MoTa; PDNNK.NgayLap = Phieu.NgayLap; PDNNK.tinhtrang = 0; db.PhieuDNNKs.InsertOnSubmit(PDNNK); db.SubmitChanges(); }