Esempio n. 1
0
        public int CompareTo(IncidentItem other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            var assignmentComparison = IsUnitAssignedToTask.CompareTo(other.IsUnitAssignedToTask);

            if (assignmentComparison != 0)
            {
                return(-assignmentComparison);
            }

            var blueComparison = Blue.CompareTo(other.Blue);

            if (blueComparison != 0)
            {
                return(-blueComparison);
            }

            var priorityComparison = Priority.CompareTo(other.Priority);

            if (priorityComparison != 0)
            {
                return(-priorityComparison);
            }

            var typeComparison = Nullable.Compare(Type, other.Type);

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

            return(string.Compare(Info, other.Info, StringComparison.OrdinalIgnoreCase));
        }