/// <summary> /// Creates a <see cref="GridPointPivot"/> instance. /// </summary> /// <param name="reader">Opened <see cref="MySqlDataReader"/>.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="GridPointPivot"/>.</returns> internal static GridPointPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new GridPointPivot(reader.Get <uint>("level_id"), reader.Get <uint>("round_id"), reader.Get <uint>("points"), reader.Get <uint>("participation_points"))); }
/// <summary> /// Creates a <see cref="RankingVersionPivot"/> instance. /// </summary> /// <param name="reader">Opened <see cref="MySqlDataReader"/>.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="RankingVersionPivot"/>.</returns> internal static RankingVersionPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new RankingVersionPivot(reader.Get <uint>("id"), reader.Get <DateTime>("creation_date"), reader.IsDBNull("rules_concat") ? new List <uint>() : reader.GetString("rules_concat").Split(',').Select(me => Convert.ToUInt32(me)))); }
/// <summary> /// Creates an instance of <see cref="SlotPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="SlotPivot"/>.</returns> internal static SlotPivot Create(MySqlDataReader reader, params object[] otherParameters) { var mandatoryByte = reader.GetNull <byte>("mandatory"); return(new SlotPivot(reader.Get <uint>("id"), reader.GetString("name"), reader.Get <uint>("display_order"), reader.Get <uint>("level_id"), mandatoryByte.HasValue ? mandatoryByte.Value > 0 : (bool?)null)); }
/// <summary> /// Creates an instance of <see cref="ConfigurationPivot"/> /// </summary> /// <param name="reader"></param> /// <returns></returns> internal static ConfigurationPivot Initialize(MySqlDataReader reader) { _default = new ConfigurationPivot { BestPerformancesCountForRanking = reader.Get <uint>("best_performances_count_for_ranking"), RankingWeeksCount = reader.Get <uint>("ranking_weeks_count") }; return(_default); }
/// <summary> /// Creates an instance of <see cref="SetPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="setNo">Set numero.</param> /// <returns>Instance of <see cref="SetPivot"/>. <c>Null</c> if there is no data for this set.</returns> internal static SetPivot Create(MySqlDataReader reader, int setNo) { uint?wGame = reader.Get <uint>($"w_set_{setNo}"); uint?lGame = reader.Get <uint>($"l_set_{setNo}"); if (!lGame.HasValue || !wGame.HasValue) { return(null); } return(new SetPivot(wGame.Value, lGame.Value, reader.GetNull <uint>($"tb_set_{setNo}"))); }
/// <summary> /// Creates an instance of <see cref="TournamentPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="TournamentPivot"/>.</returns> internal static TournamentPivot Create(MySqlDataReader reader, params object[] otherParameters) { IEnumerable <string> codes = reader.GetString("known_codes") .Split(';') .Where(c => !string.IsNullOrWhiteSpace(c)) .Select(c => c.Trim().ToUpperInvariant()); return(new TournamentPivot(reader.Get <uint>("id"), reader.GetString("name"), codes)); }
/// <summary> /// Creates an instance of <see cref="MatchPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="MatchPivot"/>.</returns> internal static MatchPivot Create(MySqlDataReader reader, object[] otherParameters) { return(new MatchPivot(reader.Get <uint>("id"), reader.Get <uint>("edition_id"), reader.Get <uint>("match_num"), reader.Get <uint>("best_of"), reader.Get <uint>("round_id"), reader.GetNull <uint>("minutes"), reader.Get <uint>("winner_id"), reader.GetNull <uint>("winner_seed"), reader.GetNull <uint>("winner_entry_id"), reader.GetNull <uint>("winner_rank"), reader.GetNull <uint>("winner_rank_points"), reader.Get <uint>("loser_id"), reader.GetNull <uint>("loser_seed"), reader.GetNull <uint>("loser_entry_id"), reader.GetNull <uint>("loser_rank"), reader.GetNull <uint>("loser_rank_points"), reader.Get <byte>("walkover") > 0, reader.Get <byte>("retirement") > 0, reader.Get <byte>("disqualification") > 0, reader.Get <byte>("unfinished") > 0, reader.IsDBNull("super_tb") ? null : reader.GetString("super_tb")) { Sets = Enumerable.Range(1, 5) .Select(me => SetPivot.Create(reader, me)) .ToList(), WinnerStatistics = STATISTIC_COLUMNS .Select(me => new { me.Key, Value = reader.GetNull <uint>(string.Concat("w_", me.Value)) }) .ToDictionary(me => me.Key, me => me.Value), LoserStatistics = STATISTIC_COLUMNS .Select(me => new { me.Key, Value = reader.GetNull <uint>(string.Concat("l_", me.Value)) }) .ToDictionary(me => me.Key, me => me.Value) }); }
/// <summary> /// Creates an instance of <see cref="PlayerPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters (in that case, path to player's profile picture base folder.).</param> /// <returns>Instance of <see cref="PlayerPivot"/>.</returns> internal static PlayerPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new PlayerPivot(reader.Get <uint>("id"), reader.GetString("first_name"), reader.GetString("last_name"), reader.IsDBNull("hand") ? null : reader.GetString("hand"), reader.GetNull <DateTime>("birth_date"), reader.GetString("country"), reader.GetNull <uint>("height"), otherParameters[0].ToString())); }
/// <summary> /// Creates an instance of <see cref="RoundPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="RoundPivot"/>.</returns> internal static RoundPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new RoundPivot(reader.Get <uint>("id"), reader.GetString("code"), reader.GetString("name"), reader.Get <uint>("players_count"), reader.Get <uint>("importance"))); }
/// <summary> /// Creates an instance of <see cref="LevelPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="LevelPivot"/>.</returns> internal static LevelPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new LevelPivot(reader.Get <uint>("id"), reader.GetString("code"), reader.GetString("name"), reader.Get <uint>("display_order"), reader.Get <byte>("mandatory") > 0)); }
/// <summary> /// Creates an instance of <see cref="EditionPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="EditionPivot"/>.</returns> internal static EditionPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new EditionPivot(reader.Get <uint>("id"), reader.Get <uint>("year"), reader.GetString("name"), reader.Get <uint>("tournament_id"), reader.GetNull <uint>("slot_id"), reader.GetNull <uint>("draw_size"), reader.GetNull <uint>("surface_id"), reader.Get <byte>("indoor") > 0, reader.Get <uint>("level_id"), reader.Get <DateTime>("date_begin"), reader.Get <DateTime>("date_end"))); }
/// <summary> /// Creats an instance of <see cref="RankingPivot"/>. /// </summary> /// <param name="reader">Opened <see cref="MySqlDataReader"/>.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="RankingPivot"/>.</returns> internal static RankingPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new RankingPivot(reader.Get <uint>("version_id"), reader.Get <uint>("player_id"), reader.Get <DateTime>("date"), reader.Get <uint>("points"), reader.Get <uint>("ranking"), reader.Get <uint>("editions"))); }
/// <summary> /// Creates an instance of <see cref="EntryPivot"/>. /// </summary> /// <param name="reader">Opened data reader.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="EntryPivot"/>.</returns> internal static EntryPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new EntryPivot(reader.Get <uint>("id"), reader.GetString("code"), reader.GetString("name"))); }
/// <summary> /// Creates a <see cref="QualificationPointPivot"/> instance. /// </summary> /// <param name="reader">Opened <see cref="MySqlDataReader"/>.</param> /// <param name="otherParameters">Other parameters.</param> /// <returns>Instance of <see cref="QualificationPointPivot"/>.</returns> internal static QualificationPointPivot Create(MySqlDataReader reader, params object[] otherParameters) { return(new QualificationPointPivot(reader.Get <uint>("level_id"), reader.Get <uint>("draw_size_min"), reader.Get <uint>("points"))); }