public virtual IEnumerable <CustomerContact> FindContactsByEmail(string email) { if (string.IsNullOrWhiteSpace(email)) { Logger.Warning("Vipps.Login: could not load contacts for empty email"); return(Enumerable.Empty <CustomerContact>()); } IEnumerable <CustomerContact> byEmail; try { byEmail = BusinessManager .List(ContactEntity.ClassName, new[] { new FilterElement( ContactEntity.FieldEmail, FilterElementType.Equal, email ) }, new SortingElement[0], 0, 2) .OfType <CustomerContact>(); } catch (Exception ex) { Logger.Error("Vipps.Login: could not load contacts by email", ex); byEmail = Enumerable.Empty <CustomerContact>(); } var byUserKey = CustomerContext.Current.GetContactByUserId(_mapUserKey.ToTypedString(email)); if (byUserKey != null) { return(new[] { byUserKey } .Union(byEmail)); } return(byEmail); }
public virtual CustomerContact GetContactByUsername(string username) { return(CustomerContext.Current.GetContactByUserId(_mapUserKey.ToTypedString(username))); }