Hello good afternoon to everyone. could you please help me with the following
I would like to bring to a datagridvew the corresponding sales between two date ranges
for this I have the following code
- namespace CapaLogica
- {
- public class VentasEntreFechasDTO
- {
- public string NumeroVenta { get; set; }
- public string Producto { get; set; }
- public string Unidad { get; set; }
- public decimal Precio { get; set; }
- public int Cantidad { get; set; }
- public decimal ValorFila { get; set; }
-
-
- public static List<VentasEntreFechasDTO> Ventas(DateTime Inicio, DateTime Fin)
- {
-
- using (GourmetEntities db = new GourmetEntities())
- {
- var li = db.tblMaestroVentas.Include(x => x.tblDetalleVentas).Where(x => x.FechaVenta >= Inicio && x.FechaVenta <= Fin);
-
- return (List<VentasEntreFechasDTO>)li;
- }
- }
-
- }
- }
this code apparently doesn't show me any error, but when I try to load it to a datagridview it shows me an error
- private void BtnBuscar_Click(object sender, EventArgs e)
- {
- if(VerificarRangoFechas())
- {
- DataGridViewVentaEntreFechas.DataSource = VentasEntreFechasDTO.Ventas(DtpDesde.Value.Date, DtpHasta.Value.Date);
- }
- }
Please how can I solve this error since I need to visualize sales between date ranges
please help
Roberto Melgar