List<SummonerRankedStatistics> GetSummonerRankedStatistics(Summoner summoner, int season, DbConnection connection) { using (var select = Command("select {0} from summoner_ranked_statistics where summoner_id = :summoner_id and season = :season", connection, SummonerRankedStatistics.GetFields())) { select.Set("summoner_id", summoner.Id); select.Set("season", season); using (var reader = select.ExecuteReader()) { List<SummonerRankedStatistics> output = new List<SummonerRankedStatistics>(); while (reader.Read()) { SummonerRankedStatistics statistics = new SummonerRankedStatistics(reader); output.Add(statistics); } return output; } } }
void LoadSummonerRankedStatistics(Summoner summoner, NpgsqlConnection database) { DatabaseCommand select = GetCommand("select {0} from summoner_ranked_statistics where summoner_id = :summoner_id", database, SummonerRankedStatistics.GetFields()); select.Set("summoner_id", summoner.Id); using (NpgsqlDataReader reader = select.ExecuteReader()) { while (reader.Read()) { SummonerRankedStatistics statistics = new SummonerRankedStatistics(reader); statistics.ChampionName = GetChampionName(statistics.ChampionId); summoner.RankedStatistics.Add(statistics); } summoner.RankedStatistics.Sort(); } }