public static IEnumerable <SanPham> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where TinhTrang='0'")); } }
public static IEnumerable <NhaSanXuat> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <NhaSanXuat>("select * from NhaSanXuat ")); } }
public static IEnumerable <LoaiSanPham> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <LoaiSanPham>("select * from LoaiSanPham ")); } }
public static void Them(string masanpham, string mataikhoan, int soluong, int gia, string tensanpham) { using (var db = new ShopOnlineConnectionDB()) { var x = db.Query <GioHang>("select * from GioHang Where MaTaiKhoan = '" + mataikhoan + "' and MaSanPham = '" + masanpham + "'").ToList(); if (x.Count() > 0) { // gọi hàm update so lượng int a = (int)x.ElementAt(0).SoLuong + soluong; CapNhat(masanpham, mataikhoan, a, gia, tensanpham); } else { GioHang giohang = new GioHang() { MaSanPham = masanpham, MaTaiKhoan = mataikhoan, SoLuong = soluong, Gia = gia, TenSanPham = tensanpham, TongTien = gia * soluong }; db.Insert(giohang); } } }
public static IEnumerable <NhaSanXuat> NhaSanXuat() { using (var db = new ShopOnlineConnectionDB()) { return(db.Query <ShopOnlineConnection.NhaSanXuat>("select * from NhaSanXuat ")); } }
public static IEnumerable <LoaiSanPham> LoaiSanPham() { using (var db = new ShopOnlineConnectionDB()) { return(db.Query <ShopOnlineConnection.LoaiSanPham>("select * from LoaiSanPham ")); } }
public static IEnumerable <GioHang> DanhSach(string mataikhoan) { using (var db = new ShopOnlineConnectionDB()) { return(db.Query <GioHang>("select * from GioHang where MaTaiKhoan = '" + mataikhoan + "'")); } }
public static void Xoa(string masanpham, string mataikhoan) { using (var db = new ShopOnlineConnectionDB()) { var a = db.Query <GioHang>("select * from GioHang where MaSanPham = '" + masanpham + "' and MaTaiKhoan ='" + mataikhoan + "'").FirstOrDefault(); db.Delete(a); } }
//----------------------------------------------admin---------- public static IEnumerable <SanPham> DanhSachSP() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham")); //foreach (var item in ds) //{ // item.HinhChinh = LoadAvartaImg(item.MaSanPham); //} //return ds; }
public static int TongTien(string mataikhoan) { using (var db = new ShopOnlineConnectionDB()) { List <GioHang> a = DanhSach(mataikhoan).ToList(); if (a.Count() == 0) { return(0); } return(db.Query <int>("select sum(Gia) from GioHang where MaTaiKhoan = '" + mataikhoan + "' ").FirstOrDefault()); } }
public static void CapNhat(string masanpham, string mataikhoan, int soluong, int gia, string tensanpham) { using (var db = new ShopOnlineConnectionDB()) { GioHang giohang = new GioHang() { MaSanPham = masanpham, MaTaiKhoan = mataikhoan, SoLuong = soluong, Gia = gia, TenSanPham = tensanpham, TongTien = gia * soluong }; var tamp = db.Query <GioHang>("Select idGH from GioHang Where MaTaiKhoan = '" + mataikhoan + "' and MaSanPham = '" + masanpham + "'").FirstOrDefault(); db.Update(giohang, tamp.IdGH); } }
public static IEnumerable <SanPham> TimKiem(string TimKiem) { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where TenSanPham like '%" + TimKiem + "%'")); }
public static IEnumerable <SanPham> DanhSach() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham ")); }
public static IEnumerable <SanPham> HotItems() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select Top 8 * from SanPham where LuotView>0")); }
//---------------------------------menu loại sản phẩm--------------------------------------// public static IEnumerable <LoaiSanPham> LoaiSanPham() { var sql = new ShopOnlineConnectionDB(); return(sql.Query <LoaiSanPham>("select * from LoaiSanPham where TinhTrang=0")); }
public static IEnumerable <SanPham> TatCaSLoaiSanPham(string id) { var sql = new ShopOnlineConnectionDB(); return(sql.Query <SanPham>("select * from SanPham where Maloaisanpham = @0", id).ToList()); }
//------------ Khach hàng--------------------------- public static IEnumerable <NhaSanXuat> DanhSach() { var db = new ShopOnlineConnectionDB(); return(db.Query <NhaSanXuat>("select * from NhaSanXuat where TinhTrang = '0 '")); }
//---------------------------menu nhà sản xuất-----------------------------------------// public static IEnumerable <NhaSanXuat> NhaSanXuat() { var sql = new ShopOnlineConnectionDB(); return(sql.Query <NhaSanXuat>("select * from NhaSanXuat where TinhTrang=0")); }
public static IEnumerable <SanPham> TopHot() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where LuotXem > 2")); }
public static IEnumerable <SanPham> Top4New() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where GhiChu = N'New'")); }
public static IEnumerable <SanPham> ChiTiet(String id) { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where MaLoaiSanPham = '" + id + "'")); }
public static IEnumerable <SanPham> ChiTiet(String id) { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where MaNHaSanXuat = '" + id + "' AND TinhTrang = '0 '")); }
public static IEnumerable <SanPham> TopHot() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select Top 4 * from SanPham Where LuotView > '1000' AND TinhTrang = '0 '")); }
public static IEnumerable <LoaiSanPham> DanhSach() { var db = new ShopOnlineConnectionDB(); return(db.Query <LoaiSanPham>("select * from LoaiSanPham where TinhTrang = 0")); }
public static IEnumerable <BinhLuan> LoadBinhLuan(int page = 1, int pagesize = 1) { var db = new ShopOnlineConnectionDB(); return(db.Query <BinhLuan>("select * from BinhLuan ORDER BY Ngay desc").ToPagedList(page, pagesize)); }