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 MethodLoadProductos(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria) { await Task.Factory.StartNew(() => { try { CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria); } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.AdministratorVenta, ex.Message, CmpButton.Aceptar); } }); }
public CmpObservableCollection <ESGR_Producto> GetCollectionProductoCartaDia(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria, string Filtro = "%") { try { var objCmpSql = new CmpSql(SGRVariables.ConectionString); var CollectionProductoCartaDia = new CmpObservableCollection <ESGR_Producto>(); objCmpSql.CommandProcedure("spSGR_GET_CartaDiaProducto"); objCmpSql.AddParameter("@Filtro", SqlDbType.VarChar, (Filtro == null || Filtro == string.Empty) ? "%" : Filtro); objCmpSql.AddParameter("@IdCategoria", SqlDbType.Int, ESGR_ProductoSubCategoria.ESGR_ProductoCategoria.IdCategoria); objCmpSql.AddParameter("@IdSubCategoria", SqlDbType.Int, ESGR_ProductoSubCategoria.IdSubCategoria); DataTable dt = objCmpSql.ExecuteDataTable(); for (int x = 0; x < dt.Rows.Count; x++) { CollectionProductoCartaDia.Add(new ESGR_Producto { IdProducto = (dt.Rows[x]["IdProducto"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdProducto"]) : Convert.ToInt16(0), Precio = (dt.Rows[x]["Precio"] != DBNull.Value) ? Convert.ToDecimal(dt.Rows[x]["Precio"]) : Convert.ToDecimal(0), Producto = (dt.Rows[x]["Producto"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Producto"]) : string.Empty, Imagen = (dt.Rows[x]["Imagen"] != DBNull.Value) ? (Byte[])(dt.Rows[x]["Imagen"]) : new byte[] { }, ESGR_ProductoSubCategoria = new ESGR_ProductoSubCategoria() { IdSubCategoria = (dt.Rows[x]["IdSubCategoria"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["IdSubCategoria"]) : Convert.ToInt16(0), SubCategoria = (dt.Rows[x]["SubCategoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["SubCategoria"]) : string.Empty, ESGR_ProductoCategoria = new ESGR_ProductoCategoria() { Categoria = (dt.Rows[x]["Categoria"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Categoria"]) : string.Empty, IdCategoria = (dt.Rows[x]["IdCategoria"] != DBNull.Value) ? Convert.ToInt32(dt.Rows[x]["IdCategoria"]) : 0, ValidaStock = (dt.Rows[x]["ValidaStock"] != DBNull.Value) ? Convert.ToBoolean(dt.Rows[x]["ValidaStock"]) : false, Impresora = (dt.Rows[x]["Impresora"] != DBNull.Value) ? Convert.ToString(dt.Rows[x]["Impresora"]) : string.Empty } }, Stock = (dt.Rows[x]["Stock"] != DBNull.Value) ? Convert.ToInt16(dt.Rows[x]["Stock"]) : Convert.ToInt16(0), ImageSource = (dt.Rows[x]["Imagen"] != DBNull.Value) ? ToImage((Byte[])(dt.Rows[x]["Imagen"])) : null }); } return(CollectionProductoCartaDia); } catch (Exception) { throw; } }
/// <summary> /// Insertar, Editar y Eliminar Producto Sub Categoria /// </summary> /// <param name="ESGR_ProductoSubCategoria">Objecto de la Entidad Producto Sub Categoria</param> public void TransProductoSubCategoria(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria) { try { var objCmpSql = new CmpSql(SGRVariables.ConectionString); objCmpSql.CommandProcedure("spSGR_SET_ProductoSubCategoria"); objCmpSql.AddParameter("@Opcion", SqlDbType.VarChar, ESGR_ProductoSubCategoria.Opcion); objCmpSql.AddParameter("@IdSubCategoria", SqlDbType.SmallInt, ESGR_ProductoSubCategoria.IdSubCategoria); objCmpSql.AddParameter("@IdCategoria", SqlDbType.SmallInt, ESGR_ProductoSubCategoria.ESGR_ProductoCategoria.IdCategoria); objCmpSql.AddParameter("@SubCategoria", SqlDbType.VarChar, ESGR_ProductoSubCategoria.SubCategoria); objCmpSql.ExecuteNonQuery(); } catch (Exception) { throw; } }
private async void MethodLoadDetails() { try { await Task.Factory.StartNew(() => { if (SelectedESGR_ProductoCategoria == null) { SelectedESGR_ProductoCategoria = new ESGR_ProductoCategoria(); } if (SelectedESGR_ProductoSubCategoria == null) { SelectedESGR_ProductoSubCategoria = new ESGR_ProductoSubCategoria(); } CollectionESGR_ListadoPedidoAnulado.Source = new BSGR_ListadoPedidoAnulado().CollectionESGR_ListadoPedidoAnulado(SelectedESGR_ProductoCategoria.IdCategoria, SelectedESGR_ProductoSubCategoria.IdSubCategoria, ESGR_Producto.IdProducto, SelectedFechaInicio, SelectedFechaFin, ESGR_Usuario.IdUsuario); }); } catch (Exception ex) { CmpMessageBox.Show(SGRMessage.ListadoPedidoAnulado, ex.Message, CmpButton.Aceptar); } }
private async void MethodLoadProducto(ESGR_ProductoSubCategoria ESGR_ProductoSubCategoria) { await Task.Factory.StartNew(() => { try { PropertyMetroProgressBarProducto = true; if (PropertyFlitroText.Trim().Length > 0) { CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProducto(ESGR_ProductoSubCategoria = null, PropertyFlitroText, "PRODUCTO"); } else { CollectionESGR_Producto.Source = new BSGR_Producto().GetCollectionProducto(ESGR_ProductoSubCategoria); } PropertyMetroProgressBarProducto = false; } 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); } }); }