/// <summary>
 /// returns if a game is owned by user
 /// </summary>
 /// <param name="gameId">id of game</param>
 /// <param name="userId">id of user</param>
 /// <returns></returns>
 public static bool GameOwnedByUser(int gameId, int userId)
 {
     return(DalHelper.RowExists($"SELECT Game FROM UserGames WHERE Game = {gameId} AND [User] = {userId}"));
 }
 /// <summary>
 /// Checks that a game code hasn't been used yet
 /// </summary>
 /// <param name="code">16 char string of game code</param>
 /// <returns>true if code hasn't been used, else false</returns>
 public static bool CodeUnredeemed(string code)
 {
     return(DalHelper.RowExists($"SELECT Code FROM GameCodes WHERE Code = '{code}' AND Used = False"));
 }
Beispiel #3
0
 /// <summary>
 /// checks if exists a friend connection, including a sent request between 2 users
 /// </summary>
 /// <param name="user1">id of user 1</param>
 /// <param name="user2">id of user 2</param>
 /// <returns></returns>
 public static bool ExistsConnection(int user1, int user2)
 {
     return(DalHelper.RowExists(
                $"SELECT [User 1] FROM UserFriends WHERE (([User 1] = {user1} AND [User 2] = {user2}) " +
                $"OR ([User 1] = {user2} AND [User 2] = {user1}))"));
 }
Beispiel #4
0
 /// <summary>
 ///     check if a friend request exists
 /// </summary>
 /// <param name="user1">user that sent the request</param>
 /// <param name="user2">user that accepted the request</param>
 /// <returns>if friend request exists</returns>
 public static bool ExistsFriendRequest(int user1, int user2)
 {
     return(DalHelper.RowExists(
                $"SELECT [User 1] FROM UserFriends WHERE [User 1] = {user1} AND [User 2] = {user2}"));
 }
Beispiel #5
0
 /// <summary>
 /// checks if 2 users are friends
 /// </summary>
 /// <param name="user1">id of user 1</param>
 /// <param name="user2">id of user 2</param>
 /// <returns>true if user1 and user2 are friends</returns>
 public static bool AreFriends(int user1, int user2)
 {
     return(DalHelper.RowExists(
                $"SELECT [User 1] FROM UserFriends WHERE (([User 1] = {user1} AND [User 2] = {user2}) " +
                $"OR ([User 1] = {user2} AND [User 2] = {user1})) AND Type = TRUE"));
 }