void IStormContext.LogoutUser() { if (StormPersisted.BasketId != null) { var basket = repository.GetBasket(StormPersisted.BasketId.Value, null, CultureCode, CurrencyId); if (basket != null) { var key = Guid.NewGuid(); var customer = new Customers.Customer { Key = key, Account = new Customers.Account { Key = key }, DeliveryAddresses = new Customers.AddressList(), Companies = new Customers.CompanyList() }; if (basket.Id.HasValue) { repository.UpdateBuyer(basket.Id.Value, customer, StormPersisted.AccountId, PriceListIdSeed, CultureCode, CurrencyId); } } } StormPersisted.LoginName = null; StormPersisted.AccountId = null; StormPersisted.CompanyId = null; StormPersisted.CustomerId = null; }
public override MembershipUser CreateUser(string loginName, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { var u = GetUser(loginName, false); if (u == null) { var customer = new Customers.Customer { Account = new Customers.Account { Name = loginName, LoginName = loginName }, FirstName = loginName, Email = email, }; var createdCustomer = repository.CreateCustomer(customer); status = MembershipCreateStatus.Success; return(GetUser(createdCustomer)); } status = MembershipCreateStatus.DuplicateUserName; return(null); }
private MembershipUser GetUser(Customers.Customer customer) { return(customer == null ? null : new MembershipUser(this.Name, customer.Email, customer.Key, customer.Email, null, null, true, false, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.MinValue, DateTime.MinValue)); }