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 }); } }); }); }); }
private async void MethodCleaningOrder() { await Task.Factory.StartNew(() => { try { Application.Current.Dispatcher.Invoke(() => { CollectionMSGR_PedidoDetalle.Clear(); SelectedESGR_ProductoSubCategoria = null; CollectionESGR_Producto.Clear(); ListVMSGR_PedidoDetalleDelete.Clear(); }); Total = 0; var Opcion = ESGR_Pedido.Opcion; if (Opcion == "I") { var NombreMesa = ESGR_Pedido.Identificador; var NumPersonas = ESGR_Pedido.Cubierto; ESGR_Pedido = new BSGR_Pedido().GetPedido(); ESGR_Pedido.Opcion = Opcion; ESGR_Pedido.Identificador = NombreMesa; ESGR_Pedido.Cubierto = NumPersonas; ESGR_Pedido.ESGR_PedidoTipo = SelectedESGR_PedidoTipo; } } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar); } }); }
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); } }
private async void MethodLoadProducto(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria, string Filtro = "%") { await Task.Factory.StartNew(() => { try { if (ESGR_ProductoSubCategoria == null) { Application.Current.Dispatcher.Invoke(() => { CollectionESGR_Producto.Clear(); }); return; } PropertyMetroProgressBarProducto = true; CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria, Filtro); PropertyMetroProgressBarProducto = false; } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.TitlePedido, ex.Message, CmpButton.Aceptar); } }); }