private void SaveStates() { SpotifyAccessLayer.SaveArtistsToDatabase(this._Artists, this._WKAtrtist); SpotifyAccessLayer.SaveTracksToDatabase(this._Tracks, this._WKTracks); SpotifyAccessLayer.SavePlaylistsToDatabase(this._Playlists, this._WKPlaylists); SpotifyAccessLayer.SaveStatesToDatabase(this._SpotifyStates, this._WKState); }
public static bool operator !=(SpotifyObjectBase obj1, SpotifyObjectBase obj2) { if (obj1.ID == 0) { SpotifyAccessLayer.UpdateObjectIDForSpotifyObject(obj1); } if (obj2.ID == 0) { SpotifyAccessLayer.UpdateObjectIDForSpotifyObject(obj2); } return(obj1.ID != obj2.ID); }
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 SpotifyPlaylistChangeManager GetUserForUserGuid(string sUserGuid, DateTime? dtLastSeen = null) { SpotifyPlaylistChange[] Changes = SpotifyAccessLayer.GetSpotifyUserForGuid(sUserGuid).Changes.ToArray(); SpotifyPlaylistChange[] ChangesFilteredWithDate; if (dtLastSeen != null) { ChangesFilteredWithDate = (from Change in Changes where Change.ChangedDate > dtLastSeen.Value.ToUniversalTime() select Change).ToArray(); } else { ChangesFilteredWithDate = Changes; } return new SpotifyPlaylistChangeManager(ChangesFilteredWithDate); }
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 UserManager() : base() { this._Users = SpotifyAccessLayer.GetSpotifyUsersAndTokens().ToArray <SpotifyUser>(); this._UserPlaylists = new Dictionary <Int64, List <SpotifyPlaylist> >(); this._iCurrentIndex = 0; }
protected SpotifyObjectBase(string sSpotifyID, string Name) { this.Name = Name; this.SpotifyID = sSpotifyID; SpotifyAccessLayer.UpdateObjectIDForSpotifyObject(this); }
public void DeleteUserSession(string sUserGuid) { long iUserID = SpotifyAccessLayer.GetSpotifyUserForGuid(sUserGuid).ID; SpotifyAccessLayer.DeleteSessionForUser(iUserID); }
public bool AuthenticateUserSession(string sUserGuid, string sSessionGuid) { return SpotifyAccessLayer.AuthenticateUserWithSession(sUserGuid, sSessionGuid); }
private void SaveAccessTokenToDatabase() { SpotifyAccessLayer.SaveAccessTokenForUserToDatabase(this.ID, this._AccessToken); }
private void SaveRefreshTokenToDatebase() { SpotifyAccessLayer.SaveRefreshTokenForUserToDatabase(this.ID, this._RefreshToken); }
private void SaveUserAndAuthToDatabase() { SpotifyAccessLayer.SaveUserAndAuthToDatabase(this); }
public long GetObjectIDForSpotifyID(string sSpotifyID) { return(SpotifyAccessLayer.GetObjectIDForSpotifyID(sSpotifyID)); }
public IEnumerable <SpotifyPlaylistChange> GetPlaylistChangesForUser(long iUserID, DateTime dtStart, DateTime dtEnd) { return(SpotifyAccessLayer.GetPlaylistChanges(iUserID, dtStart, dtEnd)); }