public RetailCollections(string json) { DataContractJsonSerializer serializador = new DataContractJsonSerializer(typeof(RetailCollections)); MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(json)); RetailCollections retaList = (RetailCollections)serializador.ReadObject(stream); this.AddRange(retaList); }
private void btnListar_Click(object sender, RoutedEventArgs e) { ServiceReference1.Service1Client proxy = new ServiceReference1.Service1Client(); string json = proxy.ReadAllRetail(); Core.Negocio.RetailCollections collRet = new Core.Negocio.RetailCollections(json); collRet.ToList(); dgRetail.ItemsSource = collRet; }
private RetailCollections GenerarLista(List <DALC.RETAIL> listaDALC) { RetailCollections list = new RetailCollections(); foreach (var item in listaDALC) { Retail ret = new Retail(); ret.IdRetail = (int)item.ID_RETAIL; ret.RutRetail = item.RUT; ret.NombreRetail = item.NOMBRE; ret.RazonSocial = item.RAZON_SOCIAL; ret.Telefono = (int)item.TELEFONO; ret.Email = item.EMAIL; ret.Direccion = item.DIRECCION; ret.IdRegion = (int)item.REGION_ID; ret.IdComuna = (int)item.COMUNA_ID; list.Add(ret); } return(list); }