public string getMaSP(string tensp) { db = new QLCafeDataContext(); SanPham l = db.SanPhams.Where(o => o.tenSP == tensp).FirstOrDefault(); return(l.maSP); }
public decimal getDonGia(string tensp) { db = new QLCafeDataContext(); SanPham l = db.SanPhams.Where(o => o.tenSP == tensp).FirstOrDefault(); return(l.dongia); }
public List <KhachHang> getKhachHangByTen(string tenKH) { da = new QLCafeDataContext(); List <KhachHang> lstKH = da.KhachHangs.Where(o => o.tenKH == tenKH).ToList(); return(lstKH); }
public List <HoaDon> getHdayMa(string mahd) { da = new QLCafeDataContext(); List <HoaDon> lst = da.HoaDons.Where(o => o.maHD == mahd).ToList(); return(lst); }
public List <KhachHang> getKhachHangByMa(string maKH) { da = new QLCafeDataContext(); List <KhachHang> lstKH = da.KhachHangs.Where(o => o.maKH == maKH).ToList(); return(lstKH); }
public List <HoaDon> getAllHDThu() { da = new QLCafeDataContext(); List <HoaDon> lst = da.HoaDons.Where(o => o.loaiHD == true).ToList(); return(lst); }
public string getKhachHangByName(string tenKH) { da = new QLCafeDataContext(); KhachHang lstKH = da.KhachHangs.Where(o => o.tenKH == tenKH).FirstOrDefault(); return(lstKH.maKH); }
public List <KhachHang> getAllKhachHang() { da = new QLCafeDataContext(); List <KhachHang> lstKH = da.KhachHangs.ToList(); return(lstKH); }
public string getDVTinh(string tenNL) { db = new QLCafeDataContext(); NguyenLieu lst = new NguyenLieu(); lst = db.NguyenLieus.Where(o => o.tenNL == tenNL).FirstOrDefault(); return(lst.dvtinh); }
public List <LoaiSP> GetAllSP2Grid() { db = new QLCafeDataContext(); List <LoaiSP> lst = new List <LoaiSP>(); lst = db.LoaiSPs.ToList(); return(lst); }
public List <NhanVien> GetAllNhanVien() { db = new QLCafeDataContext(); List <NhanVien> lst = new List <NhanVien>(); lst = db.NhanViens.ToList(); return(lst); }
public List <SanPham> GetAllSP() { db = new QLCafeDataContext(); List <SanPham> lst = new List <SanPham>(); lst = db.SanPhams.ToList(); return(lst); }
public List <NguyenLieu> GetAllNguyenLieu() { db = new QLCafeDataContext(); List <NguyenLieu> lst = new List <NguyenLieu>(); lst = db.NguyenLieus.ToList(); return(lst); }
public bool addHDThu(HoaDon hdthu) { try { da = new QLCafeDataContext(); da.HoaDons.InsertOnSubmit(hdthu); da.SubmitChanges(); return(true); } catch { throw new Exception("Thêm Hóa đơn thất bại"); } }
public bool addCTHDThu(CT_HoaDonThu cthdThu) { try { da = new QLCafeDataContext(); da.CT_HoaDonThus.InsertOnSubmit(cthdThu); da.SubmitChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <clsCTHD> getCTHdayMa(string mahd) { da = new QLCafeDataContext(); var qr = da.CT_HoaDonThus.Where(hd => hd.maHDT == mahd).Join(da.SanPhams, hd => hd.maSP, sp => sp.maSP, (hd, sp) => new clsCTHD { TenSP = sp.tenSP, Soluong = hd.soluong, Dongia = decimal.Parse(hd.dongia.ToString()) }); List <clsCTHD> lst = qr.ToList(); return(lst); }
public bool AddLoaiSP(LoaiSP s) { try { db = new QLCafeDataContext(); db.LoaiSPs.InsertOnSubmit(s); db.SubmitChanges(); return(true); } catch { return(false); } }
public List <SanPham> searchTheoMa(string s) { try { List <SanPham> lst = new List <SanPham>(); db = new QLCafeDataContext(); lst = db.SanPhams.Where(o => o.maSP == s).ToList(); return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }
public List <NguyenLieu> searchTheoTen(string s) { try { db = new QLCafeDataContext(); List <NguyenLieu> lst = new List <NguyenLieu>(); lst = db.NguyenLieus.Where(o => o.tenNL == s).ToList(); return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }
public NhanVien searchTheoMa(string s) { try { NhanVien lst = new NhanVien(); db = new QLCafeDataContext(); lst = db.NhanViens.Where(o => o.maNV == s).FirstOrDefault(); return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }
public clsCTHDChi getCTHdayMa(string mahd) { da = new QLCafeDataContext(); var qr = da.CT_HoaDonChis.Join(da.NguyenLieus, hd => hd.maNL, sp => sp.maNL, (hd, sp) => new clsCTHDChi { TenNL = sp.tenNL, DVTinh = sp.dvtinh, Soluong = hd.soluong, Ghichu = hd.ghichu }); clsCTHDChi lst = qr.ToList().FirstOrDefault(); return(lst); }
public bool AddNguyenLieu(NguyenLieu s) { try { db = new QLCafeDataContext(); db.NguyenLieus.InsertOnSubmit(s); db.SubmitChanges(); return(true); } catch { return(false); } }
public List <NhanVien> searchTheoMaNhanVien(string s) { try { List <NhanVien> lst = new List <NhanVien>(); db = new QLCafeDataContext(); lst = db.NhanViens.Where(o => o.maNV == s).ToList(); return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool AddNhanVien(NhanVien s) { try { db = new QLCafeDataContext(); db.NhanViens.InsertOnSubmit(s); db.SubmitChanges(); return(true); } catch { return(false); } }
public List <LoaiSP> searchTheoTen(string s) { try { db = new QLCafeDataContext(); List <LoaiSP> lst = new List <LoaiSP>(); lst = db.LoaiSPs.Where(o => o.tenLoai == s).ToList(); return(lst); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool deleteNguyenLieu(string s) { try { db = new QLCafeDataContext(); NguyenLieu l = db.NguyenLieus.Where(o => o.maNL == s).FirstOrDefault(); db.NguyenLieus.DeleteOnSubmit(l); db.SubmitChanges(); return(true); } catch (Exception ex) { throw new Exception(ex.Message); } }
public bool deleteSP(string s) { try { db = new QLCafeDataContext(); SanPham l = db.SanPhams.Where(o => o.maSP == s).FirstOrDefault(); db.SanPhams.DeleteOnSubmit(l); db.SubmitChanges(); return(true); } catch { return(false); } }
public bool addKhachHang(KhachHang kh) { try { if (da.KhachHangs.Where(o => o.cmnd == kh.cmnd).FirstOrDefault() == null) { da = new QLCafeDataContext(); da.KhachHangs.InsertOnSubmit(kh); da.SubmitChanges(); return(true); } return(false); } catch { throw new Exception("Thêm khách hàng thất bại. Mã khách hàng đã tồn tại"); } }
public bool deleteLoaiSP(string s) { try { db = new QLCafeDataContext(); LoaiSP l = db.LoaiSPs.Where(o => o.maLoai == s).FirstOrDefault(); db.LoaiSPs.DeleteOnSubmit(l); db.SubmitChanges(); return(true); } catch { throw new Exception("Không xóa được vì có sản phẩm đang sử dụng Mã: " + s); } }
public bool deleteHDThu(string maHD) { try { da = new QLCafeDataContext(); HoaDon hd = da.HoaDons.Where(o => o.maHD == maHD).FirstOrDefault(); da.HoaDons.DeleteOnSubmit(hd); da.SubmitChanges(); return(true); } catch { throw new Exception("Cần xóa hết các chi tiết trong hóa đơn trước khi xóa hóa đơn!");; } }