/// <summary> /// Create a new aspnet_Users object. /// </summary> /// <param name="applicationId">Initial value of the ApplicationId property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="userName">Initial value of the UserName property.</param> /// <param name="loweredUserName">Initial value of the LoweredUserName property.</param> /// <param name="isAnonymous">Initial value of the IsAnonymous property.</param> /// <param name="lastActivityDate">Initial value of the LastActivityDate property.</param> public static aspnet_Users Createaspnet_Users(global::System.Guid applicationId, global::System.Guid userId, global::System.String userName, global::System.String loweredUserName, global::System.Boolean isAnonymous, global::System.DateTime lastActivityDate) { aspnet_Users aspnet_Users = new aspnet_Users(); aspnet_Users.ApplicationId = applicationId; aspnet_Users.UserId = userId; aspnet_Users.UserName = userName; aspnet_Users.LoweredUserName = loweredUserName; aspnet_Users.IsAnonymous = isAnonymous; aspnet_Users.LastActivityDate = lastActivityDate; return aspnet_Users; }
/// <summary> /// Deprecated Method for adding a new object to the aspnet_Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToaspnet_Users(aspnet_Users aspnet_Users) { base.AddObject("aspnet_Users", aspnet_Users); }
private void SavePropertyValues(TRIPS_UserEntities db, aspnet_Users user, ConModels.User profile) { SavePropertyValue(db, user, "LastName", profile.LastName); SavePropertyValue(db, user, "FirstName", profile.FirstName); SavePropertyValue(db, user, "BusinessEmailAddress", profile.BusinessEmail); SavePropertyValue(db, user, "HomeEmailAddress", profile.HomeEmail); SavePropertyValue(db, user, "AlternateEmailAddress", profile.AlternateEmail); SavePropertyValue(db, user, "Comment", profile.Comment); SavePropertyValue(db, user, "PrimaryContact", profile.Phone); SavePropertyValue(db, user, "Organization", profile.Organization); SavePropertyValue(db, user, "Title", profile.Title); }
// TODO: put this into a class and cache the Property IDs before saving/fetching private void SavePropertyValue(TRIPS_UserEntities db, aspnet_Users user, string name, string value) { var pp = db.ProfileProperties.Single(p => p.ProfilePropertyName == name); if (string.IsNullOrWhiteSpace(value)) { var ppv = user.ProfilePropertyValues.SingleOrDefault(p => p.ProfilePropertyID == pp.ProfilePropertyID); if (ppv != null) { // TODO: cannot just remove it. Why? ppv.ProfilePropertyValue1 = string.Empty; ppv.DateUpdated = DateTime.Now; } } else { var ppv = user.ProfilePropertyValues.SingleOrDefault(p => p.ProfilePropertyID == pp.ProfilePropertyID); if (ppv != null) { ppv.ProfilePropertyValue1 = value; ppv.DateUpdated = DateTime.Now; } else { user.ProfilePropertyValues.Add(new ProfilePropertyValue() { ProfileProperty = pp, ProfilePropertyValue1 = value, DateCreated = DateTime.Now, DateUpdated = DateTime.Now }); } } }
private ConModels.User GetUserModel(TRIPS_UserEntities db, aspnet_Users au) { string email = null; if (au.aspnet_Membership != null) { email = au.aspnet_Membership.Email; } var user = new ConModels.User() { Id = au.UserId, UserName = au.UserName, RecoveryEmail = email }; GetPropertyValues(db, au, user); return user; }
private void GetPropertyValues(TRIPS_UserEntities db, aspnet_Users user, ConModels.User profile) { profile.LastName = GetPropertyValue(db, user, "LastName"); profile.FirstName = GetPropertyValue(db, user, "FirstName"); profile.BusinessEmail = GetPropertyValue(db, user, "BusinessEmailAddress"); profile.HomeEmail = GetPropertyValue(db, user, "HomeEmailAddress"); profile.AlternateEmail = GetPropertyValue(db, user, "AlternateEmailAddress"); profile.Comment = GetPropertyValue(db, user, "Comment"); profile.Phone = GetPropertyValue(db, user, "PrimaryContact"); profile.Organization = GetPropertyValue(db, user, "Organization"); profile.Title = GetPropertyValue(db, user, "Title"); }
private string GetPropertyValue(TRIPS_UserEntities db, aspnet_Users user, string name) { var pp = db.ProfileProperties.Single(p => p.ProfilePropertyName == name); var ppv = user.ProfilePropertyValues.SingleOrDefault(p => p.ProfilePropertyID == pp.ProfilePropertyID); if (ppv != null) { return ppv.ProfilePropertyValue1.Trim(); } return null; }