/// <summary> /// Gets user information from the data source based on the unique identifier for the membership user. Provides an option to update the last-activity date/time stamp for the user. /// </summary> /// <param name="providerUserKey">The unique identifier for the membership user to get information for.</param> /// <param name="userIsOnline">true to update the last-activity date/time stamp for the user; false to return user information without updating the last-activity date/time stamp for the user.</param> /// <returns>A MembershipUser object populated with the specified user's information from the data source.</returns> public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) { //validate the provider user key if ((providerUserKey == null) || (!(providerUserKey is int))) { return(null); } User user = UserDataSource.Load((int)providerUserKey); if (user == null) { return(null); } return(new MembershipUser(this.Name, user.UserName, user.UserId, user.Email, user.PasswordQuestion, user.Comment, user.IsApproved, user.IsLockedOut, user.CreateDate, user.LastLoginDate, user.LastActivityDate, user.Passwords[0].CreateDate, user.LastLockoutDate)); }
/// <summary> /// Save this wishlist for the given user /// </summary> /// <param name="userID">Id of the user for which to save this wishlist</param> /// <returns><b>SaveResult</b> enumeration that represents the result of save operation</returns> public SaveResult SaveForUser(int userID) { User user = UserDataSource.Load(userID); //MAKE SURE A USER ACCOUNT EXISTS if (user != null) { this.UserId = user.UserId; return(this.BaseSave()); } else { //associate with an anonymous user return(this.Save()); } }
/// <summary> /// Updates information about a user in the data source. /// </summary> /// <param name="user">A MembershipUser object that represents the user to update and the updated information for the user.</param> public override void UpdateUser(MembershipUser user) { User acUser = UserDataSource.Load((int)user.ProviderUserKey); if (acUser != null) { acUser.Comment = user.Comment; acUser.CreateDate = user.CreationDate; acUser.UserName = user.UserName; acUser.Email = user.Email; acUser.IsApproved = user.IsApproved; acUser.IsLockedOut = user.IsLockedOut; //TODO: ISONLINE? acUser.LastActivityDate = user.LastActivityDate; acUser.LastLockoutDate = user.LastLockoutDate; acUser.LastLoginDate = user.LastLoginDate; acUser.LastPasswordChangedDate = user.LastPasswordChangedDate; acUser.PasswordQuestion = user.PasswordQuestion; acUser.Save(); } }
public static User Load(Int32 userId) { return(UserDataSource.Load(userId, true)); }