private void btnListar_Click(object sender, RoutedEventArgs e) { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string json = proxy.ReadAllProductos(); Core.Negocio.ProductoCollections collprod = new Core.Negocio.ProductoCollections(json); collprod.ToList(); dgProd.ItemsSource = collprod; string JSON = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail); SucursalCollections sucCol = new SucursalCollections(JSON); dgSuc.ItemsSource = sucCol.ToList(); }
private async void btnListar_Click(object sender, RoutedEventArgs e) { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string json = proxy.ReadAllProductos(); Core.Negocio.ProductoCollections collprod = new Core.Negocio.ProductoCollections(json); var collprodu = new ProductoCollections(); if (txtBuscarProducto.Text.Length > 0) { foreach (var item in collprod) { if (item.Nombre.Contains(txtBuscarProducto.Text)) { collprodu.Add(item); } } if (collprodu.Count > 0) { collprodu.ToList(); dgProd.ItemsSource = collprodu; } else { await this.ShowMessageAsync("Vaya...", "No hay registros que coincidan"); } } else { if (collprod.Count > 0) { collprod.ToList(); dgProd.ItemsSource = collprod; } else { await this.ShowMessageAsync("Error", "No existen registros para mostrar"); } } //string JSON = proxy.ReadAllSucursal(mainwindow.RetailActual.IdRetail); //SucursalCollections sucCol = new SucursalCollections(JSON); //dgSuc.ItemsSource = sucCol.ToList(); }