Exemplo n.º 1
0
 public void ChangeTo(PersonAddress address)
 {
     Landmark = address.Landmark;
     CountyId = address.CountyId;
     Lat      = address.Lat;
     Lng      = address.Lng;
 }
Exemplo n.º 2
0
        public PersonInfo GetPersonInfo()
        {
            var p = new PersonInfo();

            p.Id                 = Id;
            p.Gender             = Gender;
            p.BirthDate          = BirthDate;
            p.BirthDateEstimated = BirthDateEstimated;
            p.FirstName          = Names.FirstOrDefault()?.FirstName;
            p.MiddleName         = Names.FirstOrDefault()?.MiddleName;
            p.LastName           = Names.FirstOrDefault()?.LastName;
            p.MothersName        = Names.FirstOrDefault()?.MothersName;
            p.Addresses          = PersonAddress.GetAddressInfos(Addresses.ToList());
            p.Contacts           = PersonContact.GetContactInfos(Contacts.ToList());
            return(p);
        }
Exemplo n.º 3
0
        public static Person CreateClient(PersonInfo personInfo)
        {
            var person = new Person(personInfo.Id, personInfo.Gender, personInfo.BirthDate, personInfo.BirthDateEstimated);

            var personNames = PersonName.Create(personInfo);

            person.AddNames(personNames);

            var addresses = PersonAddress.Create(personInfo);

            person.AddAddresss(addresses);

            var contacts = PersonContact.Create(personInfo);

            person.AddContacts(contacts);

            return(person);
        }
Exemplo n.º 4
0
        public PersonAddress AssignAddress(PersonAddress address)
        {
            address.PersonId = Id;


            var personAddress = Addresses.FirstOrDefault(x => x.Source.ToLower() == address.Source.ToLower() &&
                                                         x.SourceRef.ToLower() == address.SourceRef.ToLower());

            if (null != personAddress)
            {
                Addresses.Remove(personAddress);
                personAddress.ChangeTo(address);
                Addresses.Add(personAddress);
                return(personAddress);
            }

            Addresses.Add(address);
            return(address);
        }
Exemplo n.º 5
0
        public void UpdateClient(PersonInfo personInfo)
        {
            Gender             = personInfo.Gender;
            BirthDate          = personInfo.BirthDate;
            BirthDateEstimated = personInfo.BirthDateEstimated;

            var personNames = PersonName.Create(personInfo);

            Names.Clear();
            AddNames(personNames);

            var addresses = PersonAddress.Create(personInfo);

            Addresses.Clear();
            AddAddresss(addresses);

            var contacts = PersonContact.Create(personInfo);

            Contacts.Clear();
            AddContacts(contacts);
        }
Exemplo n.º 6
0
 private void AddAddress(PersonAddress address)
 {
     address.PersonId = Id;
     Addresses.Add(address);
 }