Exemplo n.º 1
0
 public static SANPHAM GetProduct(int id)
 {
     using (var db = new ShopFruistConnectionDB())
     {
         return(db.SingleOrDefault <ShopFruistConnection.SANPHAM>("select * from SANPHAM where MaSanPham = @0", id));
     }
 }
Exemplo n.º 2
0
 public static void UpdateProductType(LOAISANPHAM lsp)
 {
     using (var db = new ShopFruistConnectionDB())
     {
         db.Update <LOAISANPHAM>("SET TenLoaiSanPham=@0 WHERE MaLoaiSanPham=@1", lsp.TenLoaiSanPham, lsp.MaLoaiSanPham);
     }
 }
Exemplo n.º 3
0
        public static IEnumerable <SANPHAM> RelatedProductsDetails(int idSP, int limit, int?LSP)
        {
            var    db    = new ShopFruistConnectionDB();
            String query = "select top " + limit + " * from sanpham where MaSanPham not in (" + idSP + ") and LoaiSp = " + LSP;

            return(db.Query <SANPHAM>(query));
        }
Exemplo n.º 4
0
        public static IEnumerable <SANPHAM> List(int limit, String sx)
        {
            var    db    = new ShopFruistConnectionDB();
            String query = "select top " + limit + " * from sanpham order by MaSanPham " + sx;

            return(db.Query <SANPHAM>(query));
        }
Exemplo n.º 5
0
 public static void Delete(int id)
 {
     try
     {
         using (var db = new ShopFruistConnectionDB())
         {
             db.Execute("delete from loaisanpham where MaLoaiSanPham = @0", id);
         }
     }
     catch
     {
     }
 }
Exemplo n.º 6
0
 public static void UpdateProduct(SANPHAM Sp, int valueImg)
 {
     if (valueImg == 0)
     {
         using (var db = new ShopFruistConnectionDB())
         {
             db.Update <SANPHAM>("SET TenSanPham=@0, Gia=@1, GiamGia=@2,MoTa=@3, LoaiSp=@4 WHERE MaSanPham=@5", Sp.TenSanPham, Sp.Gia, Sp.GiamGia, Sp.MoTa, Sp.LoaiSp, Sp.MaSanPham);
         }
     }
     else
     {
         using (var db = new ShopFruistConnectionDB())
         {
             db.Update <SANPHAM>("SET TenSanPham=@0, Gia=@1, GiamGia=@2, HinhAnh=@3, MoTa=@4, LoaiSp=@5 WHERE MaSanPham=@6", Sp.TenSanPham, Sp.Gia, Sp.GiamGia, Sp.HinhAnh, Sp.MoTa, Sp.LoaiSp, Sp.MaSanPham);
         }
     }
 }
Exemplo n.º 7
0
        public static IEnumerable <LISTIMAGE> danhsach(int id)
        {
            var db = new ShopFruistConnectionDB();

            return(db.Query <LISTIMAGE>("select * from listimage where IdSanPham = @0", id));
        }
Exemplo n.º 8
0
        public static IEnumerable <LOAISANPHAM> DanhSach()
        {
            var db = new ShopFruistConnectionDB();

            return(db.Query <LOAISANPHAM>("select * from loaisanpham"));
        }
Exemplo n.º 9
0
        public static LOAISANPHAM GetProductType(int id)
        {
            var db = new ShopFruistConnectionDB();

            return(db.SingleOrDefault <LOAISANPHAM>("select * from loaisanpham where MaLoaiSanPham=@0", id));
        }
Exemplo n.º 10
0
        public static IEnumerable <SANPHAM> List()
        {
            var db = new ShopFruistConnectionDB();

            return(db.Query <SANPHAM>("select * from sanpham "));
        }
Exemplo n.º 11
0
        public static Page <SANPHAM> GetProductByProductType(int PageNumber, int itemPerPage, int id)
        {
            var db = new ShopFruistConnectionDB();

            return(db.Page <SANPHAM>(PageNumber, itemPerPage, "select * from sanpham where LoaiSp=@0", id));
        }
Exemplo n.º 12
0
        public static SANPHAM Details(int id)
        {
            var db = new ShopFruistConnectionDB();

            return(db.SingleOrDefault <SANPHAM>("select * from sanpham where MaSanPham = @0", id));
        }