public void DetermineStartingRecurrence(IPeriodList rdate, ref IDateTime referenceDateTime) { var evaluator = rdate.GetService <IEvaluator>(); var dt2 = referenceDateTime; foreach (var p in evaluator.Periods.Where(p => p.StartTime.LessThan(dt2))) { referenceDateTime = p.StartTime; } }
public void DetermineStartingRecurrence(IPeriodList rdate, ref IDateTime dt) { IEvaluator evaluator = rdate.GetService(typeof(IEvaluator)) as IEvaluator; if (evaluator == null) { // FIXME: throw a specific, typed exception here. throw new Exception("Could not determine starting recurrence: a period evaluator could not be found!"); } foreach (IPeriod p in evaluator.Periods) { if (p.StartTime.LessThan(dt)) dt = p.StartTime; } }
/// <summary> /// Determines the starting recurrence. /// </summary> /// <param name="periodList">The period list.</param> /// <param name="dt">The date time.</param> /// <exception cref="System.Exception">Could not determine starting recurrence: a period evaluator could not be found!</exception> public void DetermineStartingRecurrence(IPeriodList periodList, ref IDateTime dt) { var evaluator = periodList.GetService(typeof(IEvaluator)) as IEvaluator; if (evaluator == null) { // FIXME: throw a specific, typed exception here. throw new Exception("Could not determine starting recurrence: a period evaluator could not be found!"); } foreach (IPeriod p in evaluator.Periods) { if (p.StartTime.LessThan(dt)) { dt = p.StartTime; } } }