Пример #1
0
        public new int CompareTo(object obj)
        {
            if (obj is GradeWin)
            {
                GradeWin other = obj as GradeWin;

                //oldest grades are shown first
                int compare = Date.Date.CompareTo(other.Date.Date);

                if (compare == 0)
                {
                    //dropped items go after
                    if (IsDropped && !other.IsDropped)
                    {
                        return(1);
                    }

                    //undropped items go before anything dropped
                    if (!IsDropped && other.IsDropped)
                    {
                        return(-1);
                    }

                    //more recently created items appear first if on same day
                    return(DateCreated.CompareTo((obj as GradeWin).DateCreated));
                }

                return(compare);
            }

            return(0);
        }
Пример #2
0
        public GradeWin CopyForWhatIf(WeightCategoryWin newParent)
        {
            GradeWin g = new GradeWin()
            {
                GradeReceived     = GradeReceived,
                GradeTotal        = GradeTotal,
                Name              = Name,
                Details           = Details,
                Date              = Date,
                Updated           = Updated,
                Parent            = newParent,
                IndividualWeight  = IndividualWeight,
                IsDropped         = IsDropped,
                AppIsInWhatIfMode = !IsGraded && !IsDropped //if it hasn't been graded and isn't dropped, it's in dream mode
            };

            return(g);
        }