private async void MethodLoadDetails(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria)
 {
     await Task.Factory.StartNew(() =>
     {
         CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria);
         Application.Current.Dispatcher.Invoke(() =>
         {
             CollectionESGR_PedidoDetalle.Clear();
             CollectionESGR_Producto.ToList().ForEach(x =>
             {
                 var vrDetalle = CollectionESGR_Detalle.FirstOrDefault(y => y.ESGR_Producto.IdProducto == x.IdProducto);
                 if (vrDetalle != null)
                 {
                     CollectionESGR_PedidoDetalle.Add(vrDetalle);
                 }
                 else
                 {
                     CollectionESGR_PedidoDetalle.Add(new ESGR_PedidoDetalle()
                     {
                         ESGR_Producto = x, Cantidad = 0, CantidadAux = 0, Enviado = false
                     });
                 }
             });
         });
     });
 }
Esempio n. 2
0
 private void MethodLoadDetails()
 {
     try
     {
         CollectionESGR_Producto.Source = new CmpObservableCollection <ESGR_Producto>(new BSGR_Producto().GetCollectionProducto(new ESGR_ProductoSubCategoria(), "%", "PRODUCTO"));
         CollectionESGR_Producto.ToList().ForEach(x => MethodAddDetails(new ESGR_CartaDiaDetalle()
         {
             ESGR_Producto = x, Precio = Convert.ToDecimal(x.Precio)
         }));
     }
     catch (Exception ex)
     {
         CmpMessageBox.Show(SGRMessage.AdministratorCartaDia, ex.Message, CmpButton.Aceptar);
     }
 }