public static bool Them(string TenHH, int NhapMax, int SLmin, int NCC, int QuanLy, int LoaiHang, double DonGia) { bool rs = false; int SoLuongTra = 0; using (PTTKHTEntities context = new PTTKHTEntities()) { HangHoa a = new HangHoa() { TenHH = TenHH, NhapMax = NhapMax, SLmin = SLmin, SoLuongTra = SoLuongTra, NCC = NCC, QuanLy = QuanLy, LoaiHang = LoaiHang, DonGia = DonGia, SoLuongTon = 0 }; context.HangHoas.Add(a); var created = context.SaveChanges(); if (created > 0) { rs = true; } } return(rs); }
public static List <DoiTacQuangCao> getList() { List <DoiTacQuangCao> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.DoiTacQuangCaos.ToList(); } return(list); }
public static List <HangHoa> getList() { List <HangHoa> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.HangHoas.ToList(); } return(list); }
public static List <DonTraHangCC> getAllList() { List <DonTraHangCC> list = null; using (PTTKHTEntities contex = new PTTKHTEntities()) { list = contex.DonTraHangCCs.Where(p => p.NguoiXacNhap.Equals(null)).ToList(); } return(list); }
public static List <NhanVien> getListNhanVien() { List <NhanVien> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.NhanViens.Where(s => s.ChucVu == "NhanVien").ToList(); } return(list); }
public static List <ChiTietDonNhapHang> getAllList_IDDN(int IDDN) { List <ChiTietDonNhapHang> list = null; using (PTTKHTEntities contex = new PTTKHTEntities()) { list = contex.ChiTietDonNhapHangs.Where(p => p.IDDonNhap == IDDN).ToList(); } return(list); }
public static List <LoaiHoang> getList() { List <LoaiHoang> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.LoaiHoangs.ToList(); } return(list); }
public static List <NhaCungCap> getList() { List <NhaCungCap> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.NhaCungCaps.ToList(); } return(list); }
public static List <ChiTietDonTraHangNCC> getAllList_IDDT(int IDDT) { List <ChiTietDonTraHangNCC> list = null; using (PTTKHTEntities contex = new PTTKHTEntities()) { list = contex.ChiTietDonTraHangNCCs.Where(p => p.IDDonTra == IDDT).ToList(); } return(list); }
public static List <HangHoa> DanhSachHangTra(int NCC) { List <HangHoa> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.HangHoas .Where(hh => hh.NCC == NCC && hh.SoLuongTra > 0).ToList(); } return(list); }
public static DonTraHangCC Them(DonTraHangCC param) { DonTraHangCC dth = null; using (PTTKHTEntities context = new PTTKHTEntities()) { context.DonTraHangCCs.Add(param); context.SaveChanges(); dth = param; } return(dth); }
static public NhanVien CheckNhanVien(string user, string pass) { NhanVien result = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var query = context.NhanViens.Where(nv => nv.Email == user && nv.Password == pass) .FirstOrDefault <NhanVien>(); result = (NhanVien)query; } return(result); }
public static List <HangHoa> getHangHoaFilter1(int QuanLy, int IDNCC) { List <HangHoa> list = null; using (PTTKHTEntities context = new PTTKHTEntities()) { list = context.HangHoas .Where(p => p.QuanLy == QuanLy && p.NCC == IDNCC) .Select(p => p).ToList(); } return(list); }
static public KhachHang CheckKhachHang(string user, string pass) { KhachHang result = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var query = context.KhachHangs.Where(nv => nv.Email == user && nv.Password == pass) .FirstOrDefault <KhachHang>(); result = (KhachHang)query; } return(result); }
static public DonNhapHang Them(DonNhapHang dnh) { DonNhapHang rs = null; using (PTTKHTEntities context = new PTTKHTEntities()) { context.DonNhapHangs.Add(dnh); context.SaveChanges(); rs = dnh; } return(rs); }
public static Comment Them(Comment cm) { Comment rs = null; using (PTTKHTEntities context = new PTTKHTEntities()) { context.Comments.Add(cm); if (context.SaveChanges() == 1) { rs = cm; } } return(rs); }
public static NhanVien TimNhanVien(int ID) { NhanVien lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.NhanViens.SingleOrDefault(b => b.ID == ID); if (v is NhanVien) { lh = (NhanVien)v; } } return(lh); }
public static NhaCungCap TimNCC(int ID) { NhaCungCap lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.NhaCungCaps.SingleOrDefault(b => b.ID == ID); if (v is NhaCungCap) { lh = (NhaCungCap)v; } } return(lh); }
public static HangHoa TimLoaiHang(int ID) { HangHoa lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.HangHoas.SingleOrDefault(b => b.ID == ID); if (v is HangHoa) { lh = (HangHoa)v; } } return(lh); }
public static LoaiHoang TimLoaiHang(int ID) { LoaiHoang lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.LoaiHoangs.SingleOrDefault(b => b.ID == ID); if (v is LoaiHoang) { lh = (LoaiHoang)v; } } return(lh); }
public static KhachHang TimKhachHang(int ID) { KhachHang lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.KhachHangs.SingleOrDefault(b => b.ID == ID); if (v is KhachHang) { lh = (KhachHang)v; } } return(lh); }
public static DoiTacQuangCao TimLoaiHang(int ID) { DoiTacQuangCao lh = null; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.DoiTacQuangCaos.SingleOrDefault(b => b.ID == ID); if (v is DoiTacQuangCao) { lh = (DoiTacQuangCao)v; } } return(lh); }
public static bool Xoa(int ID) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.DoiTacQuangCaos.SingleOrDefault(b => b.ID == ID); if (v != null) { context.DoiTacQuangCaos.Remove(v); int rm = context.SaveChanges(); rs = rm > 0; } } return(rs); }
public static bool ChinhSua(int ID, string TenDoiTac) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.DoiTacQuangCaos.SingleOrDefault(b => b.ID == ID); if (v != null) { v.TenDoiTac = TenDoiTac; int updated = context.SaveChanges(); rs = updated > 0; } } return(rs); }
public static bool ChinhSua(int ID, string tenLoaiHang) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { var v = context.LoaiHoangs.SingleOrDefault(b => b.ID == ID); if (v != null) { v.TenLoai = tenLoaiHang; int updated = context.SaveChanges(); rs = updated > 0; } } return(rs); }
public static bool ThemList(int IDDONTRA, List <ChiTietDonTraHangNCC> list) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { foreach (ChiTietDonTraHangNCC ct in list) { ct.IDDonTra = IDDONTRA; context.ChiTietDonTraHangNCCs.Add(ct); } if (context.SaveChanges() == list.Count) { rs = true; } } return(rs); }
public static bool XacNhanDonTraHang(int IDDonTra, int IDNguoiXacNhan) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { DonTraHangCC abc = context.DonTraHangCCs.SingleOrDefault(b => b.ID == IDDonTra); abc.NguoiXacNhap = IDNguoiXacNhan; abc.NgayXacNhan = DateTime.Now; foreach (ChiTietDonTraHangNCC ct in abc.ChiTietDonTraHangNCCs) { ct.HangHoa.SoLuongTra -= ct.SoLuong; } int index = context.SaveChanges(); rs = true; } return(rs); }
public static bool themList(int ID_DNH, List <ChiTietDonNhapHang> list) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { foreach (ChiTietDonNhapHang ct in list) { ct.IDDonNhap = ID_DNH; context.ChiTietDonNhapHangs.Add(ct); } if (context.SaveChanges() == list.Count) { rs = true; } } return(rs); }
public static bool Them(string TenDoiTac) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { DoiTacQuangCao a = new DoiTacQuangCao() { TenDoiTac = TenDoiTac }; context.DoiTacQuangCaos.Add(a); var created = context.SaveChanges(); if (created > 0) { rs = true; } } return(rs); }
public static bool Them(string TenLoai) { bool rs = false; using (PTTKHTEntities context = new PTTKHTEntities()) { LoaiHoang a = new LoaiHoang() { TenLoai = TenLoai }; context.LoaiHoangs.Add(a); var created = context.SaveChanges(); if (created > 0) { rs = true; } } return(rs); }