public List <Estadisticas> cantidadClientes() { List <Estadisticas> salida = new List <Estadisticas>(); int total = 0; float importe = 0f; string cliente = ""; SqlConnection conn = new SqlConnection(cadena); conn.Open(); SqlCommand comm = new SqlCommand("exec topClientes", conn); SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { cliente = dr.GetString(0); total = dr.GetInt32(1); importe = (float)dr.GetDouble(2); Estadisticas est = new Estadisticas(); est.cliente = cliente; est.cant_por_cliente = total; est.precio_por_cliente = importe; salida.Add(est); } conn.Close(); return(salida); }
public List <Estadisticas> cantidadCiudades() { List <Estadisticas> salida = new List <Estadisticas>(); int total = 0; string ciudad = ""; SqlConnection conn = new SqlConnection(cadena); conn.Open(); SqlCommand comm = new SqlCommand("exec topCiudades", conn); SqlDataReader dr = comm.ExecuteReader(); while (dr.Read()) { ciudad = dr.GetString(0); total = dr.GetInt32(1); Estadisticas est = new Estadisticas(); est.ciudad = ciudad; est.cantidad_ciudades = total; salida.Add(est); } conn.Close(); return(salida); }