Exemplo n.º 1
0
        private void ActualizarGrillaVentas()
        {
            var ventas = VentaRepository.Listado(v => v.VentaProductos,
                                                 v => v.VentaProductos.Select(vp => vp.Producto))
                         .Where(v => v.CierreCajaId == UsuarioActual.CierreCajaIdActual)
                         .OrderByDescending(v => v.FechaVenta).Take(10).ToList();

            var ventasFormateadas = ventas.Select(v => new VentaGridStruct
            {
                VentaId = v.VentaId,
                Fecha   = String.Format("{0} {1}",
                                        v.FechaVenta.ToShortDateString(),
                                        v.FechaVenta.ToShortTimeString()),
                ImporteTotal   = "$" + v.ImporteTotal.ToString("N2"),
                PrimerProducto = v.VentaProductos.First().Producto.Descripcion
            }).ToList();

            dgvVentas.DataSource = ventasFormateadas;
        }