public SpotifyUser(string sProfileID, string sAuthCode, string sAccessCode, string sRefreshCode, string sAccessTokenType, int iExpiresIn, DateTime dtToken, DateTime dtAuth) { this._SpotifyID = sProfileID; this._Name = sProfileID; this._ID = SpotifyAccessLayer.GetObjectIDForSpotifyID(this._SpotifyID); this._UserAuth = new SpotifyUserAuth(sAuthCode, dtAuth); SaveUserAndAuthToDatabase(); this._RefreshToken = new SpotifyUserRefreshToken(sRefreshCode, dtToken); SaveRefreshTokenToDatebase(); this._AccessToken = new SpotifyUserAccessToken(sAccessCode, sAccessTokenType, iExpiresIn, dtToken); SaveAccessTokenToDatabase(); this._UserGuid = SpotifyAccessLayer.GetUserGuidForUserID(this._ID); }
public SpotifyUser(DataRow drUser) { this._ID = Convert.ToInt64(drUser["UserID"].ToString()); this._Name = drUser["Name"].ToString(); this._UserGuid = drUser["UserGuid"].ToString(); string sAuthCode = drUser["AuthCode"].ToString(); DateTime dtAuth = Convert.ToDateTime(drUser["AuthDate"].ToString()); string sAccessCode = drUser["AccessTokenCode"].ToString(); string sRefreshCode = drUser["RefreshTokenCode"].ToString(); string sAccessTokenType = drUser["AccessTokenTokenType"].ToString(); int iAccessExpiresIn = Convert.ToInt32(drUser["AccessTokenExpiresIn"].ToString()); DateTime dtToken = Convert.ToDateTime(drUser["AccessTokenCreatedDate"].ToString()); this._UserAuth = new SpotifyUserAuth(sAuthCode, dtAuth); this._RefreshToken = new SpotifyUserRefreshToken(sRefreshCode, dtToken); this._AccessToken = new SpotifyUserAccessToken(sAccessCode, sAccessTokenType, iAccessExpiresIn, dtToken); }
public SpotifyUser(PrivateProfile oPrivateProfile, string sAuthCode, Token oToken) { this._SpotifyID = oPrivateProfile.Id; this._Name = oPrivateProfile.Id; this._ID = SpotifyAccessLayer.GetObjectIDForSpotifyID(this._SpotifyID); string sAccessCode = oToken.AccessToken; string sRefreshCode = oToken.RefreshToken; string sAccessTokenType = oToken.TokenType; int iAccessExpiresIn = oToken.ExpiresIn; DateTime dtToken = oToken.CreateDate.ToUniversalTime(); DateTime dtAuth = oToken.CreateDate.ToUniversalTime(); this._UserAuth = new SpotifyUserAuth(sAuthCode, dtAuth); SaveUserAndAuthToDatabase(); this._RefreshToken = new SpotifyUserRefreshToken(sRefreshCode, dtToken); SaveRefreshTokenToDatebase(); this._AccessToken = new SpotifyUserAccessToken(sAccessCode, sAccessTokenType, iAccessExpiresIn, dtToken); SaveAccessTokenToDatabase(); this._UserGuid = SpotifyAccessLayer.GetUserGuidForUserID(this._ID); }
public static void SaveAuthTokenForUserToDatabase(Int64 iUserID, SpotifyUserAuth oSpotifyUserAuth) { RelationalDatabase.ExecuteNonQuery("UpSertAuthTokenForSpotifyUser", CommandType.StoredProcedure, new SqlParameter("iUserID", iUserID), new SqlParameter("sCode", oSpotifyUserAuth.Code), new SqlParameter("dtAuth", oSpotifyUserAuth.AuthDate) ); }