public virtual Member ToModel(Member member)
        {
            if (member == null)
            {
                throw new ArgumentNullException(nameof(member));
            }

            member.Id           = Id;
            member.CreatedBy    = CreatedBy;
            member.CreatedDate  = CreatedDate;
            member.ModifiedBy   = ModifiedBy;
            member.ModifiedDate = ModifiedDate;
            member.MemberType   = MemberType;
            member.Name         = Name;
            member.OuterId      = OuterId;
            member.Status       = Status;

            member.Addresses = Addresses.OrderBy(x => x.Id).Select(x => x.ToModel(AbstractTypeFactory <Address> .TryCreateInstance())).ToList();
            member.Emails    = Emails.OrderBy(x => x.Id).Select(x => x.Address).ToList();
            member.Notes     = Notes.OrderBy(x => x.Id).Select(x => x.ToModel(new Note())).ToList();
            member.Phones    = Phones.OrderBy(x => x.Id).Select(x => x.Number).ToList();
            member.Groups    = Groups.OrderBy(x => x.Id).Select(x => x.Group).ToList();
            member.SeoInfos  = SeoInfos.Select(x => x.ToModel(AbstractTypeFactory <SeoInfo> .TryCreateInstance())).ToList();

            member.DynamicProperties = DynamicPropertyObjectValues.GroupBy(x => x.PropertyId).Select(x =>
            {
                var property    = AbstractTypeFactory <DynamicObjectProperty> .TryCreateInstance();
                property.Id     = x.Key;
                property.Name   = x.FirstOrDefault()?.PropertyName;
                property.Values = x.Select(v => v.ToModel(AbstractTypeFactory <DynamicPropertyObjectValue> .TryCreateInstance())).ToArray();
                return(property);
            }).ToArray();

            return(member);
        }
Exemplo n.º 2
0
 public bool Equals(Contact other)
 {
     if (object.ReferenceEquals(null, other))
     {
         return(false);
     }
     if (object.ReferenceEquals(this, other))
     {
         return(true);
     }
     return(FirstName == other.FirstName && LastName == other.LastName && Birth == other.Birth &&
            NotMappedProp == other.NotMappedProp && TestHelper.SequenceEqual(Phones.OrderBy(p => p.Alias), other.Phones.OrderBy(p => p.Alias)) &&
            TestHelper.SequenceEqual(Emails, other.Emails) && NullableLong == other.NullableLong);
 }
Exemplo n.º 3
0
        private void SortMethod(object obj)
        {
            switch (obj.ToString())
            {
            case "Manufacturer":
                Phones = new ObservableCollection <Phone>(Phones.OrderBy(x => x.Manufact));
                break;

            case "Model":
                Phones = new ObservableCollection <Phone>(Phones.OrderBy(x => x.Model));
                break;

            case "Price":
                Phones = new ObservableCollection <Phone>(Phones.OrderBy(x => x.Price));
                break;
            }
        }
        public virtual Member ToModel(Member member)
        {
            if (member == null)
            {
                throw new ArgumentNullException(nameof(member));
            }

            //preserve member type
            var memberType = member.MemberType;

            member.InjectFrom(this);
            member.MemberType = memberType;

            member.Addresses = Addresses.OrderBy(x => x.Id).Select(x => x.ToModel(AbstractTypeFactory <Address> .TryCreateInstance())).ToList();
            member.Emails    = Emails.OrderBy(x => x.Id).Select(x => x.Address).ToList();
            member.Notes     = Notes.OrderBy(x => x.Id).Select(x => x.ToModel(new Note())).ToList();
            member.Phones    = Phones.OrderBy(x => x.Id).Select(x => x.Number).ToList();
            member.Groups    = Groups.OrderBy(x => x.Id).Select(x => x.Group).ToList();

            return(member);
        }
Exemplo n.º 5
0
        public virtual Member ToModel(Member member)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            member.Id           = Id;
            member.CreatedBy    = CreatedBy;
            member.CreatedDate  = CreatedDate;
            member.ModifiedBy   = ModifiedBy;
            member.ModifiedDate = ModifiedDate;
            member.MemberType   = MemberType;
            member.Name         = Name;

            member.Addresses = Addresses.OrderBy(x => x.Id).Select(x => x.ToModel(AbstractTypeFactory <Address> .TryCreateInstance())).ToList();
            member.Emails    = Emails.OrderBy(x => x.Id).Select(x => x.Address).ToList();
            member.Notes     = Notes.OrderBy(x => x.Id).Select(x => x.ToModel(new Note())).ToList();
            member.Phones    = Phones.OrderBy(x => x.Id).Select(x => x.Number).ToList();
            member.Groups    = Groups.OrderBy(x => x.Id).Select(x => x.Group).ToList();

            return(member);
        }