Esempio n. 1
0
        /// <summary>
        /// Use this method to determine if a todo item has been completed.
        /// This takes into account recurrence items and the previous date
        /// of completion, if any.
        /// <note>
        /// This method evaluates the recurrence pattern for this TODO
        /// as necessary to ensure all relevant information is taken
        /// into account to give the most accurate result possible.
        /// </note>
        /// </summary>
        /// <returns>True if the todo item has been completed</returns>
        virtual public bool IsCompleted(IDateTime currDt)
        {
            if (Status == TodoStatus.Completed)
            {
                if (Completed == null ||
                    Completed.GreaterThan(currDt))
                {
                    return(true);
                }

                // Evaluate to the previous occurrence.
                m_Evaluator.EvaluateToPreviousOccurrence(Completed, currDt);

                foreach (Period p in m_Evaluator.Periods)
                {
                    if (p.StartTime.GreaterThan(Completed) &&   // The item has recurred after it was completed
                        currDt.GreaterThanOrEqual(p.StartTime)) // and the current date is after or on the recurrence date.
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 /// <summary>
 /// Returns 'True' if the todo item is Active as of <paramref name="currDt"/>.
 /// An item is Active if it requires action of some sort.
 /// </summary>
 /// <param name="currDt">The date and time to test.</param>
 /// <returns>True if the item is Active as of <paramref name="currDt"/>, False otherwise.</returns>
 public virtual bool IsActive(IDateTime currDt)
 {
     if (DtStart == null)
     {
         return(!IsCompleted(currDt) && !IsCancelled());
     }
     if (currDt.GreaterThanOrEqual(DtStart))
     {
         return(!IsCompleted(currDt) && !IsCancelled());
     }
     return(false);
 }
Esempio n. 3
0
 /// <summary>
 /// Returns 'True' if the todo item is Active as of <paramref name="currDt"/>.
 /// An item is Active if it requires action of some sort.
 /// </summary>
 /// <param name="currDt">The date and time to test.</param>
 /// <returns>True if the item is Active as of <paramref name="currDt"/>, False otherwise.</returns>
 virtual public bool IsActive(IDateTime currDt)
 {
     if (DTStart == null)
         return !IsCompleted(currDt) && !IsCancelled();
     else if (currDt.GreaterThanOrEqual(DTStart))
         return !IsCompleted(currDt) && !IsCancelled();
     else return false;
 }
Esempio n. 4
0
        /// <summary>
        /// Use this method to determine if a todo item has been completed.
        /// This takes into account recurrence items and the previous date
        /// of completion, if any.        
        /// <note>
        /// This method evaluates the recurrence pattern for this TODO
        /// as necessary to ensure all relevant information is taken
        /// into account to give the most accurate result possible.
        /// </note>
        /// </summary>
        /// <param name="DateTime">The date and time to test.</param>
        /// <returns>True if the todo item has been completed</returns>
        virtual public bool IsCompleted(IDateTime currDt)
        {
            if (Status == TodoStatus.Completed)
            {
                if (Completed == null ||
                    Completed.GreaterThan(currDt))
                    return true;

                // Evaluate to the previous occurrence.
                m_Evaluator.EvaluateToPreviousOccurrence(Completed, currDt);

                foreach (Period p in m_Evaluator.Periods)
                {
                    if (p.StartTime.GreaterThan(Completed) && // The item has recurred after it was completed
                        currDt.GreaterThanOrEqual(p.StartTime))     // and the current date is after or on the recurrence date.
                        return false;
                }
                return true;
            }
            return false;
        }
Esempio n. 5
0
        /// <summary>
        ///     Use this method to determine if a todo item has been completed.
        ///     This takes into account recurrence items and the previous date
        ///     of completion, if any.
        ///     <note>
        ///         This method evaluates the recurrence pattern for this TODO
        ///         as necessary to ensure all relevant information is taken
        ///         into account to give the most accurate result possible.
        ///     </note>
        /// </summary>
        /// <returns>True if the todo item has been completed</returns>
        public virtual bool IsCompleted(IDateTime currDt)
        {
            if (Status == TodoStatus.Completed)
            {
                if (Completed == null ||
                    Completed.GreaterThan(currDt))
                {
                    return(true);
                }

                // Evaluate to the previous occurrence.
                _evaluator.EvaluateToPreviousOccurrence(Completed, currDt);

                // The item has recurred after it was completed
                // and the current date is after or on the recurrence date.
                return(_evaluator.Periods.Cast <Period>( ).All(p => !p.StartTime.GreaterThan(Completed) || !currDt.GreaterThanOrEqual(p.StartTime)));
            }
            return(false);
        }
Esempio n. 6
0
        /// <summary>
        /// Use this method to determine if a todo item has been completed.
        /// This takes into account recurrence items and the previous date
        /// of completion, if any.
        /// <note>
        /// This method evaluates the recurrence pattern for this TODO
        /// as necessary to ensure all relevant information is taken
        /// into account to give the most accurate result possible.
        /// </note>
        /// </summary>
        /// <returns>True if the todo item has been completed</returns>
        public virtual bool IsCompleted(IDateTime currDt)
        {
            if (Status == TodoStatus.Completed)
            {
                if (Completed == null || Completed.GreaterThan(currDt))
                {
                    return(true);
                }

                // Evaluate to the previous occurrence.
                _mEvaluator.EvaluateToPreviousOccurrence(Completed, currDt);

                return(_mEvaluator.Periods.Cast <Period>().All(p => !p.StartTime.GreaterThan(Completed) || !currDt.GreaterThanOrEqual(p.StartTime)));
            }
            return(false);
        }