Example #1
0
 public static void Them(string masanpham, string mataikhoan, int gia, int soluong, string tensanpham)
 {
     using (var sql = new MobileShopConnectionDB())
     {
         var x = sql.Query <GioHang>("select * from GioHang Where MaTaiKhoan = '" + mataikhoan + "'and MaSP ='" + masanpham + "'").ToList();
         if (x.Count() > 0)
         {
             //update so luong
             int a = (int)x.ElementAt(0).SoLuong + soluong;
             CapNhat(masanpham, mataikhoan, gia, a, tensanpham);
         }
         else
         {
             GioHang giohang = new GioHang()
             {
                 MaSP       = masanpham,
                 MaTaiKhoan = mataikhoan,
                 Gia        = gia,
                 SoLuong    = soluong,
                 TenSP      = tensanpham,
                 TongTien   = gia * soluong
             };
             sql.Insert(giohang);
         }
     }
 }
 public static void Them(int MaSanPham, string MaTaiKhoan)
 {
     using (var db = new MobileShopConnectionDB())
     {
         GioHang gh = new GioHang()
         {
             MaSanPham  = MaSanPham,
             MaTaiKhoan = MaTaiKhoan,
             SoLuong    = 1
         };
         db.Insert(gh);
     }
 }
Example #3
0
        public static void ThemBinhLuan(BinhLuan bl)
        {
            var db = new MobileShopConnectionDB();

            db.Insert(bl);
        }
Example #4
0
        public static void ThemSP(SanPham sp)
        {
            var sql = new MobileShopConnectionDB();

            sql.Insert(sp);
        }
Example #5
0
        public static void ThemNSX(NhaSanXuat NSX)
        {
            var sql = new MobileShopConnectionDB();

            sql.Insert(NSX);
        }
Example #6
0
        public static void Them(MobileShopConnection.LoaiSP LoaiSP)
        {
            var db = new MobileShopConnectionDB();

            db.Insert(LoaiSP);
        }
        public static void ThemLSP(LoaiSP LSP)
        {
            var sql = new MobileShopConnectionDB();

            sql.Insert(LSP);
        }
Example #8
0
        public static void Them(MobileShopConnection.HangSP HangSp)
        {
            var db = new MobileShopConnectionDB();

            db.Insert(HangSp);
        }
Example #9
0
        public static void Them(MobileShopConnection.SanPham sp)
        {
            var db = new MobileShopConnectionDB();

            db.Insert(sp);
        }