Пример #1
0
        public int CompareTo(ICetItem other)
        {
            // By definition, any object compares greater than a null reference
            if (other == null)
            {
                return 1;
            }

            int countryCompare = this.Country.ToString().CompareTo(other.Country.ToString());
            if (countryCompare != 0)
            {
                return countryCompare;
            }

            int domainCompare = this.Domain.CompareTo(other.Domain);
            if (domainCompare != 0)
            {
                return domainCompare;
            }

            int kindCompare = this.Kind.ToString().CompareTo(other.Kind.ToString());
            if (kindCompare != 0)
            {
                return kindCompare;
            }

            int categoryCompare = this.Category.CompareTo(other.Category);
            if (categoryCompare != 0)
            {
                return categoryCompare;
            }

            if (this.Subcategory != null)
            {
                int subcategoryCompare = ((byte)this.Subcategory).CompareTo(other.Subcategory);
                if (subcategoryCompare != 0)
                {
                    return subcategoryCompare;
                }
            }
            else
            {
                if (other.Subcategory != null)
                {
                    return -1;
                }
                else
                {
                    return 0;
                }
            }

            if (this.Specific != null)
            {
                int specificCompare = ((byte)this.Specific).CompareTo(other.Specific);
                if (specificCompare != 0)
                {
                    return specificCompare;
                }
            }
            else
            {
                if (other.Specific != null)
                {
                    return -1;
                }
                else
                {
                    return 0;
                }
            }

            if (this.Extra != null)
            {
                int extraCompare = ((byte)this.Extra).CompareTo(other.Extra);
                if (extraCompare != 0)
                {
                    return extraCompare;
                }
            }
            else
            {
                if (other.Extra != null)
                {
                    return -1;
                }
                else
                {
                    return 0;
                }
            }

            if (!string.IsNullOrEmpty(this.Description))
            {
                return this.Description.CompareTo(other.Description);
            }
            else
            {
                return 0;
            }
        }
Пример #2
0
        public int CompareTo(ICetItem other)
        {
            // By definition, any object compares greater than a null reference
            if (other == null)
            {
                return(1);
            }

            int countryCompare = this.Country.ToString().CompareTo(other.Country.ToString());

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

            int domainCompare = this.Domain.CompareTo(other.Domain);

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

            int kindCompare = this.Kind.ToString().CompareTo(other.Kind.ToString());

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

            int categoryCompare = this.Category.CompareTo(other.Category);

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

            if (this.Subcategory != null)
            {
                int subcategoryCompare = ((byte)this.Subcategory).CompareTo(other.Subcategory);
                if (subcategoryCompare != 0)
                {
                    return(subcategoryCompare);
                }
            }
            else
            {
                if (other.Subcategory != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }

            if (this.Specific != null)
            {
                int specificCompare = ((byte)this.Specific).CompareTo(other.Specific);
                if (specificCompare != 0)
                {
                    return(specificCompare);
                }
            }
            else
            {
                if (other.Specific != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }

            if (this.Extra != null)
            {
                int extraCompare = ((byte)this.Extra).CompareTo(other.Extra);
                if (extraCompare != 0)
                {
                    return(extraCompare);
                }
            }
            else
            {
                if (other.Extra != null)
                {
                    return(-1);
                }
                else
                {
                    return(0);
                }
            }

            if (!string.IsNullOrEmpty(this.Description))
            {
                return(this.Description.CompareTo(other.Description));
            }
            else
            {
                return(0);
            }
        }