示例#1
0
        public static int Compare(MyPerson myPerson1,MyPerson myPerson2)
        {
            int result = 0;
            if (myPerson1.FirstName.CompareTo (myPerson2.FirstName) != 0)
            {
                result = myPerson1.FirstName.CompareTo (myPerson2.FirstName);

            } else
            {
                if (myPerson1.LastName.CompareTo (myPerson2.LastName) != 0)
                {
                    result = myPerson1.LastName.CompareTo (myPerson2.LastName);
                }
            }
            return result;
        }
示例#2
0
 public static void getMyPersonWithPhoneNumber(ABAddressBook addressBook,List<MyPerson> ContactsWithPhoneNumber)
 {
     try{
     ABPerson[] people = addressBook.GetPeople();
     foreach(var x in people)
     {
         ABMultiValue<string> PhoneNumbers=x.GetPhones();
         foreach(var y in PhoneNumbers)
         {
             if(!String.IsNullOrEmpty(y.Value)&&y.Label.ToString().ToLower().Contains("mobile"))
             {
                 MyPerson newMyPerson=new MyPerson();
                 newMyPerson.FirstName=String.IsNullOrEmpty(x.FirstName)?"":x.FirstName;
                 newMyPerson.LastName=String.IsNullOrEmpty(x.LastName)?"":x.LastName;
                 newMyPerson.Phone=y.Value;
                 ContactsWithPhoneNumber.Add(newMyPerson);
                 continue;
             }
         }
     }
     }
     catch(Exception e){
         Insights.Report(e);
     }
 }
示例#3
0
 public static void getMyPersonWithEmail(ABAddressBook addressBook,List<MyPerson> ContactsWithEmail)
 {
     ABPerson[] people = addressBook.GetPeople();
     foreach(var x in people)
     {
         ABMultiValue<string> Emails=x.GetEmails();
         foreach(var y in Emails)
         {
             if(!String.IsNullOrEmpty(y.Value))
             {
                 MyPerson newMyPerson=new MyPerson();
                 newMyPerson.FirstName=String.IsNullOrEmpty(x.FirstName)?"":x.FirstName;
                 newMyPerson.LastName=String.IsNullOrEmpty(x.LastName)?"":x.LastName;
                 newMyPerson.Email=y.Value;
                 ContactsWithEmail.Add(newMyPerson);
                 continue;
             }
         }
     }
 }