public GetPlayerIdResponse GetPlayerId()
        {
            var username = Utils.GetUserName(User);

            var response = new GetPlayerIdResponse();

            var connectionString = _settings.TournamentDB;

            using (var dataStore = new DataStore(new SqlConnection(connectionString)))
            {
                try
                {
                    if (username != null)
                    {
                        response.PlayerId = dataStore.GetPlayerIdFromUsername(username);
                    }
                    else
                    {
                        response.HasErrors = true;
                        response.Errors.Add("Could not get username from API Get call");
                    }
                }
                catch (Exception e)
                {
                    AddErrorToResponse(response, e.Message);
                }
            }
            return(response);
        }
 void InviteFriendToGameCallback(GetPlayerIdResponse getPlayerIdResponse)
 {
     //Debug.Log(getPlayerIdResponse.command);
     if (getPlayerIdResponse.command == GetPlayerIdCommandLog.succes)
     {
         //Debug.Log(getPlayerIdResponse.userName);
         chatListner.SendMessageCommand(getPlayerIdResponse.userId, "</From " + PhotonNetwork.LocalPlayer.UserId + " /Name " + PhotonNetwork.LocalPlayer.NickName + " /Into " + PhotonNetwork.CurrentRoom.Name + " /Act " + ChatActionEnum.InvitationGame + " />");
     }
 }
    void ReaderHandlerGetPlayerId(string text, string _userName, SqlGetPlayerIdCallback callback)
    {
        GetPlayerIdCommandLog command = GetPlayerIdCommandLog.none;

        string[] lines = text.Split('|');

        GetPlayerIdResponse GetPlayerIdResponse = new GetPlayerIdResponse();

        if (GetPlayerIdCommandLog.TryParse(lines[0].Substring(0, lines[0].IndexOf(':')), out command))
        {
            GetPlayerIdResponse.command = command;
        }

        if (command == GetPlayerIdCommandLog.succes)
        {
            GetPlayerIdResponse.userId   = lines[1].Substring(lines[1].IndexOf(':') + 1);
            GetPlayerIdResponse.userName = _userName;
        }
        callback(GetPlayerIdResponse);
    }