private Venta_grupo buildVentas(MySqlDataReader data) { Venta_grupo item = new Venta_grupo( data.GetString("tipo"), data.GetDouble("monto") ); return(item); }
public List <Venta_grupo> get_ventas() { DateTime thisDay = DateTime.Today; string query = "select tbadetticket.total as monto, tbagrupo.grupo as tipo from tbadetticket inner join tbaproductos on tbadetticket.id_producto=tbaproductos.id inner join tbagrupo on tbaproductos.grupo=tbagrupo.id inner join tbatickets on tbadetticket.id_ticket=tbatickets.id where tbatickets.id_usuario='"+ inicial.id_usario + "' and tbatickets.fecha like '%" + thisDay.ToString("yyyy-MM-dd") + "%' "; MySqlDataReader data = runQuery(query); List <Venta_grupo> result = new List <Venta_grupo>(); if (data.HasRows) { while (data.Read()) { Venta_grupo item = buildVentas(data); result.Add(item); } } return(result); }