Beispiel #1
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            else if (Lastname.CompareTo(other.Lastname) == 0)
            {
                return(Firstname.CompareTo(other.Firstname));
            }

            else
            {
                return(Lastname.CompareTo(other.Lastname));
            }


            // long record of this:
            //else if (lastname.CompareTo(other.lastname) == 0)
            //{
            //    return firstname.CompareTo(other.firstname);
            //}

            //else
            //{
            //    return lastname.CompareTo(other.lastname);
            //}
        }
Beispiel #2
0
        public int CompareTo(PropertiesContact other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            if (Firstname == other.Firstname)
            {
                if (Lastname == other.Lastname)
                {
                    return(0);
                }
                else
                {
                    return(Lastname.CompareTo(other.Lastname));;
                }
            }
            else
            {
                return(Firstname.CompareTo(other.Firstname));
            }


            //return this.ToString().CompareTo(other.ToString());
        }
 public int CompareTo(ContactData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     return(Lastname.CompareTo(other.Lastname));
 }
 public int CompareTo(ContactData other)
 {
     if (Lastname.CompareTo(other.Lastname) == 0)
     {
         return(Firstname.CompareTo(other.Firstname));
     }
     return(Lastname.CompareTo(other.Lastname));
 }
 public int CompareTo(ContactFormData other)
 {
     if (other is null)
     {
         return(1);
     }
     return(Lastname.CompareTo(other.Lastname));
 }
        public int CompareTo(object obj)
        {
            int lastnames = Lastname.CompareTo(((Person)obj).Lastname);

            if (lastnames == 0)
            {
                return(Firstname.CompareTo(((Person)obj).Firstname));
            }
            return(lastnames);
        }
 public int CompareTo(AddressData other)
 {
     if (Lastname == other.Lastname)
     {
         return(Firstname.CompareTo(other.Firstname));
     }
     else
     {
         return(Lastname.CompareTo(other.Lastname));
     }
 }
Beispiel #8
0
        public int CompareTo(object obj)
        {
            Person CompareTo = (Person)obj;
            int    lastnames = Lastname.CompareTo(CompareTo.Lastname);

            if (lastnames == 0)
            {
                return(Firstname.CompareTo(CompareTo.Firstname));
            }
            return(lastnames);
        }
Beispiel #9
0
 public int CompareTo(ContactData other) //GroupData other - объект с которым сравниваем текущий
 {                                       //(вернёт 1, если текущий объект > other) (вернёт 0, если они равны) (вернёт -1, если текущий < other)
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Firstname.CompareTo(other.Firstname) == 0)
     {
         return(Lastname.CompareTo(other.Lastname));
     }
     return(Firstname.CompareTo(other.Firstname));
 }
Beispiel #10
0
        public int CompareTo(ContactData other)
        {
            if (other is null)
            {
                return(1);
            }
            if (Lastname == other.Lastname)
            {
                return(Firstname.CompareTo(other.Firstname));
            }

            return(Lastname.CompareTo(other.Lastname));
        }
Beispiel #11
0
 //Сравнивает текущий экземпляр с другим объектом того же типа и возвращает целое число,
 //которое показывает, расположен ли текущий экземпляр перед, после или на той же позиции в порядке сортировки, что и другой объект.
 public int CompareTo(ContactData other)
 {
     //условие сравнения
     if (object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Lastname.CompareTo(other.Lastname) == 0)
     {
         return(Firstname.CompareTo(other.Firstname));
     }
     return(Lastname.CompareTo(other.Lastname));
 }
Beispiel #12
0
        public int CompareTo(EntryData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            if (Firstname.CompareTo(other.Firstname) == 0)
            {
                return(Lastname.CompareTo(other.Lastname));
            }
            return(Firstname.CompareTo(other.Firstname));
        }
Beispiel #13
0
 public int CompareTo(ContactData other)
 {/*  сравнить сначала фамилии и если они равны,
   * то сравнить имена и возвратить результат
   * Иначе возвратить результат сравнения фамилий.*/
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Lastname.CompareTo(other.Lastname) == 0)
     {
         return(Firstname.CompareTo(other.Firstname));
     }
     return(Lastname.CompareTo(other.Lastname));
 }
Beispiel #14
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            int intLastName = Lastname.CompareTo(other.Lastname);

            if (intLastName == 0)
            {
                return(Firstname.CompareTo(other.Firstname));
            }
            return(intLastName);
        }
Beispiel #15
0
        public int CompareTo(ContactData other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(1);
            }
            int FirstnameCompare = Firstname.CompareTo(other.Firstname);
            int LastnameCompare  = Lastname.CompareTo(other.Lastname);

            if (FirstnameCompare == 0)
            {
                return(LastnameCompare);
            }
            return(FirstnameCompare);
        }
Beispiel #16
0
        public int CompareTo(ContactData other)
        {
            int result;

            if (Object.ReferenceEquals(other, null))
            {
                result = 1;
            }
            result = Lastname.CompareTo(other.Lastname);
            if (result == 0)
            {
                result = Firstname.CompareTo(other.Firstname);
            }
            return(result);
        }
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            int compared = Lastname.CompareTo(other.Lastname);

            if (compared == 0)
            {
                return(Name.CompareTo(other.Name));
            }
            return(compared);
        }
 public int CompareTo(ContactData otherContact)
 {
     if (Object.ReferenceEquals(otherContact, null))
     {
         return(1);
     }
     if (Lastname.CompareTo(otherContact.Lastname) == 0)
     {
         if (Firstname.CompareTo(otherContact.Firstname) == 0)
         {
             return(Firstname.CompareTo(otherContact.Firstname));
         }
     }
     return(Lastname.CompareTo(otherContact.Lastname));
 }
        public int CompareTo(PersonViewModel other)
        {
            var lastcomp = Lastname.CompareTo(other.Lastname);

            if (lastcomp != 0)
            {
                return(lastcomp);
            }

            if (Firstname == null)
            {
                return(-1);
            }
            return(Firstname.CompareTo(other.Firstname));
        }
Beispiel #20
0
 public int CompareTo(AddressData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Firstname.CompareTo(other.Firstname) == 0 && Lastname.CompareTo(other.Lastname) == 0)
     {
         return(0);
     }
     else
     {
         return(1);
     }
 }
Beispiel #21
0
        public int CompareTo(ContactData other)
        {
            if (ReferenceEquals(other, null))
            {
                return(1);
            }

            int result = Lastname.CompareTo(other.Lastname);

            if (result != 0)
            {
                return(result);
            }

            return(Firstname.CompareTo(other.Firstname));
        }
Beispiel #22
0
        /// <summary>
        /// Метод для сравнения
        /// Возвращает 1, если текущий объект this больше, чем переданный в качестве параметра объект ContactData other
        /// Возвращает 0, если объекты равны
        /// Возвращает -1, если текущий объект this меньше, чем переданный в качестве параметра объект ContactData other
        /// </summary>
        /// <param name="other">Второй объект типа ContactData, с которым сравниваем текущий объект</param>
        /// <returns></returns>
        public int CompareTo(ContactData other)
        {
            /// 1. Стандартная проверка. Если второй объект равен NULL
            if (ReferenceEquals(other, null))
            {
                /// Однозначно текущий объект больше
                return(1);
            }
            /// 2. Сравнение по смыслу. Сравниваем Name и Surname
            if (Equals(this.Lastname, other.Lastname))
            {
                return(FirstName.CompareTo(other.FirstName));
            }

            return(Lastname.CompareTo(other.Lastname));
        }
Beispiel #23
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            int compareResulL = Lastname.CompareTo(other.Lastname);

            if (compareResulL == 0)
            {
                return(Firstname.CompareTo(other.Firstname));
            }
            else
            {
                return(compareResulL);
            }
        }
Beispiel #24
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(0);
            }
            int srav = Lastname.CompareTo(other.Lastname);

            if (srav != 0)
            {
                return(srav);
            }
            else
            {
                return(Firstname.CompareTo(other.Firstname));
            }
        }
        public int CompareTo(ContactData other)
        {
            int resultCompare = 0;

            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            if (Lastname.CompareTo(other.Lastname) == 0)
            {
                return(FirstName.CompareTo(other.FirstName));
            }
            else
            {
                return(Lastname.CompareTo(other.Lastname));
            }
        }
Beispiel #26
0
        public int CompareTo(ContactData other)
        {
#pragma warning disable IDE0041 // Use 'is null' check
            if (Object.ReferenceEquals(other, null))
#pragma warning restore IDE0041 // Use 'is null' check
            {
                return(1);
            }
            if (Object.ReferenceEquals(other.Lastname, Lastname))
            {
                return(Firstname.CompareTo(other.Firstname));
            }
            else
            {
                return(Lastname.CompareTo(other.Lastname));
            }
        }
Beispiel #27
0
        public int CompareTo(ContactData other)
        {
            if (object.ReferenceEquals(other, null))
            {
                return(1);
            }

            if (Lastname.CompareTo(other.Lastname) == 0)
            {
                if (Firstname.CompareTo(other.Firstname) == 0)
                {
                    //System.Diagnostics.Debug.WriteLine("LastName -  OK;  Firstname - OK");
                    return(Lastname.CompareTo(other.Lastname) + Firstname.CompareTo(other.Firstname));
                }
            }
            //System.Diagnostics.Debug.WriteLine("LastName -  OK;   Firstname - IS NOT OK");
            return(Lastname.CompareTo(other.Lastname));
        }
Beispiel #28
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            else
            {
                int compareLN = Lastname.CompareTo(other.Lastname);

                if (0 == compareLN)
                {
                    int compareFN = Firstname.CompareTo(other.Firstname);
                    return(compareFN);
                }
                return(compareLN);
            }
        }
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            if (Firstname.CompareTo(other.Firstname) == 0)
            {
                MessageBox.Show("Compare Lastname for Contacts", "CompareTo");
                return(Lastname.CompareTo(other.Lastname));
            }
            else
            {
                //  return Firstname.CompareTo(other.Firstname);
                MessageBox.Show("Compare Lastname for Contacts", "CompareTo");
            }
            return(Lastname.CompareTo(other.Lastname));
        }
Beispiel #30
0
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            int fname = Firstname.CompareTo(other.Firstname);
            int lname = Lastname.CompareTo(other.Lastname);

            int result = 0;

            if (fname == 1 && lname == 1)
            {
                result = 1;
            }

            return(result);
        }