Ejemplo n.º 1
0
        private void btnGetProducts_Click(object sender, EventArgs e)
        {
            btnGetProducts.Text = "Getting Products...";
            var productResource = new ProductResource(_apiContext);
            ProductCollection products = productResource.GetProducts(DataViewMode.Live);

            if (productResource != null && products.Items.Count > 0)
                dataGridViewProducts.DataSource = products.Items;
            btnGetProducts.Text = "Refresh Product List";
        }
        protected override async Task<bool> GetDataAsync()
        {
         
            var resource = new ProductResource(Context, DataViewMode.HasValue ? DataViewMode.Value : Api.DataViewMode.Live);
            _results = await resource.GetProductsAsync(startIndex: StartIndex, pageSize: PageSize, sortBy: SortBy, filter: Filter, q: Q, qLimit: QLimit,responseFields:ResponseFields);

            TotalCount = _results.TotalCount;
            PageCount = _results.PageCount;
            PageSize = _results.PageSize;
            return _results.Items != null && _results.Items.Count > 0;
        }
 private Product GetProductById(MozuContext mozuContext, string productCode)
 {
     if (!_products.ContainsKey(productCode))
     {
         ProductResource resource = new ProductResource(mozuContext.GetApiContext());
         Product p = resource.GetProduct(productCode);
         _products[productCode] = p;
     }
     return _products[productCode];
 }
Ejemplo n.º 4
0
 public void GetProductTest()
 {
     var messageHandler = ServiceClientMessageFactory.GetTestClientMessage(TestBaseTenant.Id,
                                                TestBaseTenant.MasterCatalogs.First().Id, TestBaseTenant.MasterCatalogs.First().Catalogs.First().Id);
     var productResource = new ProductResource(messageHandler.ApiContext, DataViewMode.Live);
     var product = productResource.GetProductAsync("test").Result;
     Assert.IsNull(product);
 }