/// <summary> /// Inserts gamer into bracket /// </summary> /// /// <param name="gamer"> /// Gamer object to be inserted /// </param> /// /// <param name="bracketID"> /// BracketID associated with bracket, where the gamer will be inserted /// </param> /// /// <returns> /// BracketPlayer object if insertion successful; null if not /// </returns> public BracketPlayer InsertGamerToBracket(GamerInfo gamer, BracketInfo bracket) { try { DatabaseQuery databaseQuery = new DatabaseQuery(); TournamentBracketDatabaseQuery tournamentBracketDatabaseQuery = new TournamentBracketDatabaseQuery(); GamerInfo tempGamer = databaseQuery.GetGamerInfo(gamer); BracketPlayer bracketPlayer = new BracketPlayer(); bracketPlayer.BracketID = bracket.BracketID; bracketPlayer.HashedUserID = tempGamer.HashedUserID; bracketPlayer.StatusCode = 1; bracketPlayer.Claim = null; bracketPlayer.Reason = null; bool insertionResult = tournamentBracketDatabaseQuery.InsertBracketPlayer(bracketPlayer); if (insertionResult) { tournamentBracketDatabaseQuery.UpdateBracketPlayerCount(bracket.BracketID, 1); return(bracketPlayer); } return(null); } catch (Exception e) { Console.WriteLine(e); return(null); } }
/// <summary> /// Gets gamer info associated with user /// </summary> /// /// <param name="gamer"> /// Gamer object /// </param> /// /// <returns> /// Gamer info /// </returns> public GamerInfo GetGamerInfo(GamerInfo gamer) { DatabaseQuery databaseQuery = new DatabaseQuery(); return(databaseQuery.GetGamerInfo(gamer)); }