private void BuscarVenta() { //aca el ejemplo int.TryParse(this.cboMarca.SelectedValue.ToString(), out int idMarca); int.TryParse(this.cboModelo.SelectedValue.ToString(), out int idModelo); int.TryParse(this.cboAnio.SelectedValue.ToString(), out int anio); int.TryParse(this.cboTipoPago.SelectedValue.ToString(), out int tipoPago); DateTime fechaDesde = DateTime.MinValue; DateTime fechaHasta = DateTime.MinValue; if (this.fechDesde.SelectedDate != null) { fechaDesde = this.fechDesde.SelectedDate.Value; } if (this.fechHasta.SelectedDate != null) { fechaHasta = this.fechHasta.SelectedDate.Value; } var nombre = this.txtNombre.Text; var ventas = _ventaBL.ObtenerVentasListado(nombre, tipoPago, idMarca, idModelo, anio, fechaDesde, fechaHasta); this.gridVentas.ItemsSource = ventas; this.gridVentas.IsReadOnly = true; if (!ventas.Any()) { MessageBox.Show("No se han encontrado resultados", "Atención"); } else { var totalUnidades = ventas.Count(); int montoTotal = 0; foreach (var ve in ventas) { montoTotal = montoTotal + ve.PrecioVenta; } txtMontoTotal.Text = $"$ {montoTotal:#,##0}"; txtTotalUnidades.Text = totalUnidades.ToString("#,##0"); } //aca el de ventas }