private bool ShouldBeMarkedExecuted(ProcessScheduledEvent existingPSE, ScheduledEvent.ExecutedCalculationType executedCalculationType, DateTime eventDate, DateTime cutoffDate)
 {
     switch (executedCalculationType)
     {
         case ScheduledEvent.ExecutedCalculationType.UsePreviousValue:
             //Note - use previous value only if the eventDate has not been changed!
             if (existingPSE == null || !Utility.DateHelper.SameDay(existingPSE.EventDate,eventDate))
                 return (eventDate < cutoffDate);
             return existingPSE.Executed;
         case ScheduledEvent.ExecutedCalculationType.SetAsNotExecuted:
             return false;
         case ScheduledEvent.ExecutedCalculationType.SetAsExecuted:
             return true;
         case ScheduledEvent.ExecutedCalculationType.UseGracePeriod:
             return (eventDate < cutoffDate);
         default:
             throw new ArgumentOutOfRangeException("Invalid value for executedCalculationType argument: " + executedCalculationType.ToString());
     }
 }
示例#2
0
		private static bool IncludeEvent(ProcessScheduledEvent processScheduledEvent, bool includeExecuted, int gracePeriod)
		{
			if (includeExecuted)
				return true;
			if (!(processScheduledEvent.Executed))
				return true;
			if (gracePeriod > 0)
			{
				return processScheduledEvent.EventDate > DateTime.Today.AddDays(-1 * gracePeriod);
			}
			else
			{
				return false;
			}
		}