Ejemplo n.º 1
0
 /// <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")));
 }
Ejemplo n.º 2
0
 /// <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))));
 }
Ejemplo n.º 3
0
        /// <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));
        }
Ejemplo n.º 4
0
        /// <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);
        }
Ejemplo n.º 5
0
        /// <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}")));
        }
Ejemplo n.º 6
0
        /// <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));
        }
Ejemplo n.º 7
0
 /// <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)
     });
 }
Ejemplo n.º 8
0
 /// <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()));
 }
Ejemplo n.º 9
0
 /// <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")));
 }
Ejemplo n.º 10
0
 /// <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));
 }
Ejemplo n.º 11
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")));
 }
Ejemplo n.º 12
0
 /// <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")));
 }
Ejemplo n.º 13
0
 /// <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")));
 }
Ejemplo n.º 14
0
 /// <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")));
 }