Esempio n. 1
0
        public static IMatchupEntry Create(IMatchupEntry entity, MySqlConnection dbConn)
        {
            string query = "INSERT INTO MatchupEntries (matchup_entry_id, matchup_id, tournament_entry_id, score) VALUES (NULL, @matchId, @entryId, @score)";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@matchId", entity.MatchupId.ToString());
            param.Add("@entryId", entity.TournamentEntryId.ToString());
            param.Add("@score", entity.Score.ToString());

            var resultsPK = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            entity.MatchupEntryId = resultsPK;
            return(entity);
        }
Esempio n. 2
0
        public static IMatchupEntry Delete(IMatchupEntry entity, MySqlConnection dbConn)
        {
            string query = "DELETE FROM MatchupEntries WHERE matchup_entry_id = @Id";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@Id", entity.MatchupEntryId.ToString());

            var result = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            if (result != 0)
            {
                return(entity);
            }

            return(null);
        }
Esempio n. 3
0
        public static IMatchupEntry Update(IMatchupEntry entity, MySqlConnection dbConn)
        {
            string query = "UPDATE MatchupEntries SET matchup_id = @matchupId, tournament_entry_id = @teId, score = @score WHERE matchup_entry_id = @id";
            Dictionary <string, string> param = new Dictionary <string, string>();

            param.Add("@matchupId", entity.MatchupId.ToString());
            param.Add("@teId", entity.TournamentEntryId.ToString());
            param.Add("@id", entity.MatchupEntryId.ToString());
            param.Add("@score", entity.Score.ToString());

            var result = DatabaseHelper.GetNonQueryCount(query, dbConn, param);

            if (result != 0)
            {
                return(entity);
            }

            return(null);
        }
Esempio n. 4
0
        private static void Email(IMatchupEntry matchupEntry, string competitor, string opponent, string tournamentName, int roundNum, bool finals)
        {
            foreach (var members in matchupEntry.TheTeam.Members)
            {
                string matchupString = "Your next matchup is against: " + opponent;

                if (finals)
                {
                    matchupString = "Welcome to the finals against: " + opponent;
                }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
                sendEmail(members.Email,
                          $"{members.FirstName} {members.LastName}",
                          $"{tournamentName} Tournament: Round {roundNum} ready to start",
                          $"Hello {competitor}!" +
                          $"\nRound {roundNum} is ready to start.\n" +
                          matchupString +
                          ".\nPlease report to the scorers table for location information.");
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            }
        }
Esempio n. 5
0
 public bool addWinnerToNextRound(IRound round, IMatchupEntry winner)
 {
     return(false);
 }