Пример #1
0
        public bool Add(ClassProduct.Product product)
        {
            string query = "INSERT INTO SanPham VALUES ( @MaSP , @TenSP , @Gia , @DanhMuc , @SoLuong , @NgayNhap )";

            object[] para = new object[] { product.MaSP, product.TenSP, product.Gia, product.DanhMuc, product.SoLuong, product.NgayNhap };

            if (DataProvider.Instance.ExecuteNonQuery(query, para) > 0)
            {
                return(true);
            }
            return(false);
        }
Пример #2
0
        public bool Edit(ClassProduct.Product product)
        {
            string MaSP  = product.MaSP;
            string query = "UPDATE SanPham SET TenSP = @TenSP , Gia = @Gia , DanhMuc = @DanhMuc , SoLuong = @SoLuong , NgayNhap = @NgayNhap  WHERE MaSP = @MaSP ";

            object[] para = new object[] { product.TenSP, product.Gia, product.DanhMuc, product.SoLuong, product.NgayNhap, product.MaSP };

            if (DataProvider.Instance.ExecuteNonQuery(query, para) > 0)
            {
                return(true);
            }
            return(false);
        }