Exemple #1
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());
        }
Exemple #2
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);
            //}
        }
 public int CompareTo(ContactData other)
 {
     if (Lastname.CompareTo(other.Lastname) == 0)
     {
         return(Firstname.CompareTo(other.Firstname));
     }
     return(Lastname.CompareTo(other.Lastname));
 }
 public int CompareTo(ContactData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     return(Firstname.CompareTo(other.Firstname));
 }
        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));
     }
 }
Exemple #7
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);
        }
Exemple #8
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));
 }
Exemple #9
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));
 }
        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));
        }
Exemple #11
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));
        }
Exemple #12
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));
 }
Exemple #13
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);
        }
Exemple #14
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);
     }
 }
Exemple #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);
        }
        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));
        }
 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));
 }
Exemple #18
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 (ReferenceEquals(other, null))
            {
                return(1);
            }

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

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

            return(Firstname.CompareTo(other.Firstname));
        }
Exemple #20
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)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }
            int compareResulL = Lastname.CompareTo(other.Lastname);

            if (compareResulL == 0)
            {
                return(Firstname.CompareTo(other.Firstname));
            }
            else
            {
                return(compareResulL);
            }
        }
Exemple #22
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));
            }
        }
Exemple #23
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);
            }
        }
Exemple #24
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));
        }
Exemple #25
0
 public int CompareTo(ContactData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Lastname.CompareTo(other.Lastname) != 0)
     {
         if (Lastname.CompareTo(other.Lastname) > 0)
         {
             return(1);
         }
         else
         {
             return(-1);
         }
     }
     return(Firstname.CompareTo(other.Firstname));
 }
        public int CompareTo(ContactData other)
        {
            if (Object.ReferenceEquals(other, null))
            {
                return(1);
            }

            int compareFirstname = Firstname.CompareTo(other.Firstname);

            if (compareFirstname == 0 || string.IsNullOrWhiteSpace(Firstname))
            {
                if (string.IsNullOrWhiteSpace(Lastname))
                {
                    return(0);
                }
                return(Lastname.CompareTo(other.Lastname));
            }
            return(compareFirstname);
        }
Exemple #27
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);
        }
        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));
        }
Exemple #29
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }

            if (obj is Customer other)
            {
                int result = Firstname.CompareTo(other.Firstname);
                if (result != 0)
                {
                    return(result);
                }
                return(Lastname.CompareTo(other.Lastname));
            }
            else
            {
                throw new ArgumentException("Object is not a Customer");
            }
        }
 //сравнение
 public int CompareTo(ContactData other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(1);
     }
     if (Object.ReferenceEquals(this, null))
     {
         return(-1);
     }
     if (Lastname.CompareTo(other.Lastname) == 0 && Firstname.CompareTo(other.Firstname) == 0)
     {
         return(0);
     }
     else if (Lastname.CompareTo(other.Lastname) == 1 && Firstname.CompareTo(other.Firstname) == 0 || Firstname.CompareTo(other.Firstname) == 1 || Firstname.CompareTo(other.Firstname) == -1)
     {
         return(1);
     }
     else if (Lastname.CompareTo(other.Lastname) == -1 && Firstname.CompareTo(other.Firstname) == 0 || Firstname.CompareTo(other.Firstname) == 1 || Firstname.CompareTo(other.Firstname) == -1)
     {
         return(-1);
     }
     return(-1);
 }