/// <summary> /// Charge les statistiques associées à une édition de tournoi. /// </summary> /// <param name="edition">Edition de tournoi.</param> /// <exception cref="ArgumentNullException">L'argument <paramref name="edition"/> est <c>Null</c>.</exception> public void LoadEditionsStatistics(Edition edition) { if (edition == null) { throw new ArgumentNullException(nameof(edition)); } if (edition.StatisticsAreCompute) { return; } string query = "select * from edition_player_stats where edition_ID = @edition"; using (DataTableReader subReader = SqlTools.ExecuteReader(query, new SqlParam("@edition", DbType.UInt32, edition.ID))) { while (subReader.Read()) { ulong playerId = subReader.GetUint64("player_ID"); for (int i = 0; i < subReader.FieldCount; i++) { string columnName = subReader.GetName(i); if (columnName == "edition_ID" || columnName == "player_ID") { continue; } edition.AddPlayerStatistics(playerId, Tools.GetEnumValueFromSqlMapping <StatType>(columnName), Convert.ToUInt32(subReader[columnName])); } if (Config.GetBool(AppKey.ComputeStatisticsWhileLoading)) { _dataLoadingProgressEventHandler?.Invoke(new DataLoadingProgressEvent(100 * ++_currentDataCount / _totalDataCount)); } } } }