Example #1
0
        public int CompareTo(object obj)
        {
            var newObj = obj as Book;

            if (ReferenceEquals(this, newObj))
            {
                return(0);
            }
            else if (newObj == null)
            {
                return(1);
            }

            var cmp = string.Compare(Isbn, newObj.Isbn, StringComparison.Ordinal);

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

            cmp = Authors.OrderBy(t => t).SequenceEqual(newObj.Authors.OrderBy(t => t)) ? 1 : 0;
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Name, newObj.Name, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(PubCity, newObj.PubCity, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(PubName, newObj.PubName, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = PubYear.CompareTo(newObj.PubYear);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Note, newObj.Note, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = CountPages.CompareTo(newObj.CountPages);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = Price.CompareTo(newObj.Price);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = CountCopies.CompareTo(newObj.CountCopies);
            if (cmp != 0)
            {
                return(cmp);
            }

            return(0);
        }
Example #2
0
        public int CompareTo(object obj)
        {
            var newObj = obj as Patent;

            if (ReferenceEquals(this, newObj))
            {
                return(0);
            }
            else if (newObj == null)
            {
                return(1);
            }


            var cmp = DateTime.Compare(PubDate, newObj.PubDate);

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

            cmp = Inventors.OrderBy(t => t).SequenceEqual(newObj.Inventors.OrderBy(t => t)) ? 1 : 0;
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = DateTime.Compare(AppDate, newObj.AppDate);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Country, newObj.Country, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Name, newObj.Name, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = RegNumber.CompareTo(newObj.RegNumber);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Note, newObj.Note, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = CountPages.CompareTo(newObj.CountPages);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = Price.CompareTo(newObj.Price);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = PubYear.CompareTo(newObj.PubYear);
            if (cmp != 0)
            {
                return(cmp);
            }

            return(0);
        }
Example #3
0
        public int CompareTo(object obj)
        {
            var newObj = obj as Paper;

            if (ReferenceEquals(this, newObj))
            {
                return(0);
            }
            else if (newObj == null)
            {
                return(1);
            }

            var cmp = string.Compare(Issn, newObj.Issn, StringComparison.Ordinal);

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

            cmp = DateTime.Compare(Date, newObj.Date);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Name, newObj.Name, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(PubCity, newObj.PubCity, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(PubName, newObj.PubName, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = Number.CompareTo(newObj.Number);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = CountCopies.CompareTo(newObj.CountCopies);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = string.Compare(Note, newObj.Note, StringComparison.Ordinal);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = CountPages.CompareTo(newObj.CountPages);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = Price.CompareTo(newObj.Price);
            if (cmp != 0)
            {
                return(cmp);
            }

            cmp = PubYear.CompareTo(newObj.PubYear);
            if (cmp != 0)
            {
                return(cmp);
            }

            return(0);
        }