Esempio n. 1
0
        public static bool ParcePhone(PhoneNumberDictionaryEntryType phone, out string type, out string value)
        {
            value = phone.Value;
            type  = PhoneTypesAttribute.Cell;
            switch (phone.Key)
            {
            case PhoneNumberKeyType.BusinessPhone:
            case PhoneNumberKeyType.PrimaryPhone:
                type = PhoneTypesAttribute.Business1;
                break;

            case PhoneNumberKeyType.BusinessPhone2:
                type = PhoneTypesAttribute.Business2;
                break;

            case PhoneNumberKeyType.OtherTelephone:
                type = PhoneTypesAttribute.Business3;
                break;

            case PhoneNumberKeyType.AssistantPhone:
                type = PhoneTypesAttribute.BusinessAssistant1;
                break;

            case PhoneNumberKeyType.HomeFax:
                type = PhoneTypesAttribute.HomeFax;
                break;

            case PhoneNumberKeyType.BusinessFax:
                type = PhoneTypesAttribute.BusinessFax;
                break;

            case PhoneNumberKeyType.MobilePhone:
                type = PhoneTypesAttribute.Cell;
                break;

            case PhoneNumberKeyType.HomePhone:
                type = PhoneTypesAttribute.Home;
                break;

            case PhoneNumberKeyType.OtherFax:
            case PhoneNumberKeyType.HomePhone2:
            case PhoneNumberKeyType.CarPhone:
            case PhoneNumberKeyType.CompanyMainPhone:
            case PhoneNumberKeyType.Isdn:
            case PhoneNumberKeyType.Pager:
            case PhoneNumberKeyType.RadioPhone:
            case PhoneNumberKeyType.Telex:
            case PhoneNumberKeyType.Callback:
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
 public static IEnumerable <PhoneNumberDictionaryEntryType> PurgePhones(params PhoneNumberDictionaryEntryType[] existingTypes)
 {
     foreach (PhoneNumberKeyType type in new PhoneNumberKeyType[] { PhoneNumberKeyType.BusinessPhone, PhoneNumberKeyType.BusinessPhone2, PhoneNumberKeyType.OtherTelephone,
                                                                    PhoneNumberKeyType.AssistantPhone, PhoneNumberKeyType.BusinessFax, PhoneNumberKeyType.MobilePhone, PhoneNumberKeyType.HomePhone, PhoneNumberKeyType.HomeFax })
     {
         if (!existingTypes.Any(t => t.Key == type && !String.IsNullOrEmpty(t.Value)))
         {
             PhoneNumberDictionaryEntryType phone = new PhoneNumberDictionaryEntryType();
             phone.Key   = type;
             phone.Value = null;
             yield return(phone);
         }
     }
 }
Esempio n. 3
0
        public static PhoneNumberDictionaryEntryType ParcePhone(string type, string value)
        {
            PhoneNumberKeyType key = PhoneNumberKeyType.CompanyMainPhone;

            switch (type)
            {
            case PhoneTypesAttribute.Business1:
                key = PhoneNumberKeyType.BusinessPhone;
                break;

            case PhoneTypesAttribute.Business2:
                key = PhoneNumberKeyType.BusinessPhone2;
                break;

            case PhoneTypesAttribute.Business3:
                key = PhoneNumberKeyType.OtherTelephone;
                break;

            case PhoneTypesAttribute.BusinessAssistant1:
                key = PhoneNumberKeyType.AssistantPhone;
                break;

            case PhoneTypesAttribute.BusinessFax:
                key = PhoneNumberKeyType.BusinessFax;
                break;

            case PhoneTypesAttribute.HomeFax:
                key = PhoneNumberKeyType.HomeFax;
                break;

            case PhoneTypesAttribute.Cell:
                key = PhoneNumberKeyType.MobilePhone;
                break;

            case PhoneTypesAttribute.Home:
                key = PhoneNumberKeyType.HomePhone;
                break;
            }

            PhoneNumberDictionaryEntryType phone = new PhoneNumberDictionaryEntryType();

            phone.Key   = key;
            phone.Value = value;
            return(phone);
        }