예제 #1
0
        public int? SavePhone(string number, int personId, int numbertypeValueId, string extension = null, bool isSystem = false, bool isMessagingEnabled = false, 
                bool isUnlisted = false, string description = null, string countryCode = "1", string foreignId = null, int? phoneNumberId = null )
        {
            PhoneNumber phone = null;
            PhoneNumberController controller = new PhoneNumberController( Service );

            if ( phoneNumberId != null )
            {
                phone = controller.GetById( (int)phoneNumberId );

                if ( phone == null )
                {
                    return null;
                }
            }
            else
            {
                phone = new PhoneNumber();
            }

            string cleanPhone = PhoneNumber.CleanNumber( number );

            phone.PersonId = personId;
            phone.Number = cleanPhone;
            phone.Extension = extension;
            phone.CountryCode = countryCode;
            phone.NumberTypeValueId = numbertypeValueId;
            phone.IsSystem = isSystem;
            phone.IsMessagingEnabled = isMessagingEnabled;
            phone.IsUnlisted = isUnlisted;
            phone.Description = description;
            phone.ForeignId = foreignId;
            var ncc = phone.NumberFormattedWithCountryCode;
            //phone.NumberFormatted = System.Text.RegularExpressions.Regex.Replace( cleanPhone, @"^(\d{3})(\d{3})(\d{4})$", @"($1) $2-$3" );

            return SavePhone( phone );
        }
예제 #2
0
        private PhoneNumber GetPhoneById( int id )
        {
            PhoneNumberController controller = new PhoneNumberController( Service );

            return controller.GetById( id );
        }