//---sua-----// public static NhaSanXuat Update(string id) { using (var db = new ShopOnlineConnectionDB()) { return(db.Single <NhaSanXuat>("select * from NhaSanXuat where Manhasanxuat =@0", id)); } }
//---sua-----// public static LoaiSanPham Update(string id) { using (var db = new ShopOnlineConnectionDB()) { return(db.Single <LoaiSanPham>("select * from LoaiSanPham where Maloaisanpham =@0", id)); } }
public static SanPham ChiTiet(String a) { var db = new ShopOnlineConnectionDB(); var sql = string.Format("select * from SanPham where masanpham='{0}'", a); return(db.SingleOrDefault <SanPham>(sql)); }
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> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <NhaSanXuat>("select * from NhaSanXuat ")); } }
public static IEnumerable <SanPham> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where TinhTrang='0'")); } }
public static IEnumerable <GioHang> DanhSach(string mataikhoan) { using (var db = new ShopOnlineConnectionDB()) { return(db.Query <GioHang>("select * from GioHang where MaTaiKhoan = '" + mataikhoan + "'")); } }
public static IEnumerable <LoaiSanPham> DS() { { var db = new ShopOnlineConnectionDB(); return(db.Query <LoaiSanPham>("select * from LoaiSanPham ")); } }
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 ")); } }
//----------------------------------update images--------------- public static void UpdateImages(string id, string images) { var db = new ShopOnlineConnectionDB(); var sp = ShopOnlineBUS.ChiTiet(id); sp.MoreImages = images; db.Update(sp, id); }
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); } }
//---------khoi phuc-------------// public static void KhoiPhuc(string id) { using (var db = new ShopOnlineConnectionDB()) { var lsp = db.Single <SanPham>("select * from SanPham where Masanpham = @0", id); lsp.Tinhtrang = "0"; db.Update("SanPham", "Masanpham", lsp); } }
//---------khoi phuc-------------// public static void KhoiPhuc(string id) { using (var db = new ShopOnlineConnectionDB()) { var lsp = db.Single <NhaSanXuat>("select * from NhaSanXuat where Manhasanxuat = @0", id); lsp.TinhTrang = 0; db.Update("NhaSanXuat", "Manhasanxuat", lsp); } }
public static void ThemBT(BinhLuan bl) { // phần Hiền làm // // truy vấn thiếu hoặc sai gì đó var db = new ShopOnlineConnectionDB(); //string a = "insert into BinhLuan(MaSanPham,MaTaiKhoan,NoiDung) values('" + MaSanPham + "','" + MaTaiKhoan + "','" + NoiDung + "')"; db.Insert(bl); }
//---------khoi phuc-------------// public static void KhoiPhuc(string id) { using (var db = new ShopOnlineConnectionDB()) { var lsp = db.Single <LoaiSanPham>("select * from LoaiSanPham where MaLoaiSanPham = @0", id); lsp.TinhTrang = 0; db.Update("LoaiSanPham", "MaLoaiSanPham", lsp); } }
//----------------------------------------------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> ChiTiet(String id) { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where MaLoaiSanPham = '" + id + "'")); }
public static void UpdateSP(String id, SanPham sp) { var db = new ShopOnlineConnectionDB(); db.Update(sp, id); }
public static IEnumerable <LoaiSanPham> DanhSach() { var db = new ShopOnlineConnectionDB(); return(db.Query <LoaiSanPham>("select * from LoaiSanPham where TinhTrang = 0")); }
public static IEnumerable <SanPham> TimKiem(string TimKiem) { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where TenSanPham like '%" + TimKiem + "%'")); }
//---------------------------------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()); }
//---------------------------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 Page <SanPham> DS(int page, int itempage) { var sql = new ShopOnlineConnectionDB(); return(sql.Page <SanPham>(page, itempage, "select * from SanPham where TinhTrang=0")); }
public static SanPham ChiTiet(String a) { var db = new ShopOnlineConnectionDB(); return(db.SingleOrDefault <SanPham>("select * from SanPham where MaSanPham = @0", a)); }
public static IEnumerable <SanPham> Top4New() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where GhiChu = N'New'")); }
public static IEnumerable <SanPham> TopHot() { var db = new ShopOnlineConnectionDB(); return(db.Query <SanPham>("select * from SanPham where LuotXem > 2")); }