예제 #1
0
파일: Person.cs 프로젝트: Fonsaca/EasyVan
 private bool ValidatePhones()
 {
     if (Phones == null || !Phones.Any())
     {
         this.Notification.AddMessage(false, NotificationMessageType.ERROR, "Informe pelo menos um numero para contato");
     }
     else
     {
         return(true);
     }
     return(false);
 }
예제 #2
0
        private Contact ExtractContact()
        {
            Contact contact = new Contact()
            {
                FormattedName      = FormattedName,
                Name1              = Prefix,
                Name2              = Surname,
                Name3              = GivenName,
                Name4              = MiddleName,
                NickName           = GivenName,
                Sortstring         = SortString,
                Birthday           = Birthday,
                Title              = Title,
                Organization       = Org,
                Note               = Note,
                EmailProgram       = Mailer,
                GlobalPositionning = Geocodage,
                LastRevision       = LastRevision,
                Logo               = Logo,
                Occupation         = Occupation,
                Photo              = Photo,
                Sound              = Sound,
                UniqueIdentifier   = UniqueIdentifier,
                Url       = Url,
                Category  = Category,
                TimeZone  = TimeZone,
                PublicKey = Key,
                Version   = Version,
            };

            if (Phones != null && Phones.Any())
            {
                contact.Phones = Phones.ToList();
            }
            if (Addresses != null && Addresses.Any())
            {
                contact.Addresses = Addresses.ToList();
            }
            if (Emails != null && Emails.Any())
            {
                contact.Mails = Emails.ToList();
            }
            contact.GeneratePhoto();
            return(contact);
        }
        public Result <bool> AddPhone(GroupPhone groupPhone, string number)
        {
            var errors = new List <string>();

            if (Phones.Any(phone => phone.Number.Equals(number, StringComparison.OrdinalIgnoreCase)))
            {
                errors.Add("This number already exists");
            }

            if (errors.Any())
            {
                return(Result <bool> .Fail(errors));
            }

            var result = Phone.Create(groupPhone, number);

            PhoneInternal.Add(result.Value);
            return(Result <bool> .Success(true));
        }
예제 #4
0
 public bool HasPrimaryStress()
 {
     return(Phones.Any(x => x.HasPrimaryStress()));
 }