/// <summary> /// Deletes the account and related memebership/profile information. /// </summary> /// <param name="principalId">The principal id.</param> public void DeleteAccount(Guid principalId) { Account acc = GetAccount(principalId); if (acc != null) { MembershipUser user = Membership.GetUser(new Guid(acc.ProviderKey)); if (user != null) { Membership.DeleteUser(user.UserName); } acc.Delete(); acc.AcceptChanges(); } }
/// <summary> /// Deletes the account and related memebership/profile information. /// </summary> /// <param name="providerKey">The providerKey.</param> public void DeleteAccount(string providerKey) { Account acc = GetAccount(providerKey); if (acc != null) { acc.Delete(); acc.AcceptChanges(); } MembershipUser user = Membership.GetUser(new Guid(providerKey)); if (user != null) { Membership.DeleteUser(user.UserName); } }
/// <summary> /// Creates Account for user. /// </summary> /// <returns></returns> public Account CreateAccountForUser(MembershipUser user) { if (user != null) { Account account = GetAccount(user.ProviderUserKey.ToString()); if (account == null) { // Now create an account in the ECF account = new Account(); account.ProviderKey = user.ProviderUserKey.ToString(); account.Name = user.UserName; account.State = 2; // active account.AcceptChanges(); return(account); } return(account); } return(null); }
/// <summary> /// Creates Account for user, if it doesn't exist yet. /// </summary> /// <returns></returns> public Account CreateAccountForUser() { if (this.Profile == null || this.Profile.Account != null) { return(null); } MembershipUser user = this.User; if (user != null) { // Now create an account in the ECF Account account = new Account(); account.ProviderKey = user.ProviderUserKey.ToString(); account.Name = user.UserName; account.AcceptChanges(); return(account); } return(null); }