Beispiel #1
0
 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);
 }
Beispiel #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));
        }
Beispiel #4
0
 public bool HasPrimaryStress()
 {
     return(Phones.Any(x => x.HasPrimaryStress()));
 }