/// <summary> /// Evalates the ExDate component, and excludes each specified DateTime or /// Period from the <see cref="DateTimes"/> collection. /// </summary> /// <param name="FromDate">The beginning date of the range to evaluate.</param> /// <param name="ToDate">The end date of the range to evaluate.</param> virtual protected void EvaluateExDate(Date_Time FromDate, Date_Time ToDate) { // Handle EXDATEs if (ExDate != null) { foreach (RDate exdate in ExDate) { ArrayList Items = exdate.Evaluate(DTStart, FromDate, ToDate); foreach (object obj in Items) { Date_Time dt = null; if (obj is Period) { dt = ((Period)obj).StartTime; } else if (obj is Date_Time) { dt = (Date_Time)obj; } if (dt != null) { while (DateTimes.Contains(dt)) { DateTimes.Remove(dt); } } } } } }
/// <summary> /// Evalates the RDate component, and adds each specified DateTime or /// Period to the <see cref="DateTimes"/> collection. /// </summary> /// <param name="FromDate">The beginning date of the range to evaluate.</param> /// <param name="ToDate">The end date of the range to evaluate.</param> virtual protected void EvaluateRDate(Date_Time FromDate, Date_Time ToDate) { // Handle RDATEs if (RDate != null) { foreach (RDate rdate in RDate) { ArrayList Items = rdate.Evaluate(DTStart, FromDate, ToDate); foreach (object obj in Items) { Date_Time dt = null; if (obj is Period) { dt = ((Period)obj).StartTime; } else if (obj is Date_Time) { dt = (Date_Time)obj; } if (dt != null && !DateTimes.Contains(dt)) { DateTimes.Add(dt); } } } } }