Beispiel #1
0
        private void AssertAllUpdateArguments(DateTime startDate, DateTime?endDate, RepeatEndStrategy repeatEndStrategy,
                                              RepeatInterval repeatInterval, int repeatOccurrenceNumber, string cronExpressionOverride)
        {
            AssertArguments(startDate > DateTime.MinValue, "A valid start date must be provided");

            AssertArguments(repeatEndStrategy != RepeatEndStrategy.OnEndDate || endDate >= startDate, "It makes no sense to have an EndDate that's before the StartDate");

            AssertArguments(repeatEndStrategy.DoesNotHaveEndStrategy() || repeatInterval.IsRepeating(),
                            $"a {nameof(RepeatEndStrategy)} with no {nameof(RepeatInterval)} doesn't make sense");

            AssertArguments(repeatEndStrategy != RepeatEndStrategy.AfterOccurrenceNumber || repeatOccurrenceNumber > 0,
                            $"{nameof(RepeatOccurrenceNumber)} must be > 0 if the {nameof(RepeatEndStrategy.AfterOccurrenceNumber)} {nameof(RepeatEndStrategy)} is being used");
        }
Beispiel #2
0
        public void Update(string domainName, DateTime startDate, DateTime?endDate, RepeatEndStrategy repeatEndStrategy,
                           RepeatInterval repeatInterval, int repeatOccurrenceNumber, string updatedBy, string cronExpressionOverride = null)
        {
            AssertAllUpdateArguments(startDate, endDate, repeatEndStrategy, repeatInterval, repeatOccurrenceNumber, cronExpressionOverride);

            StartAt                = startDate;
            EndAt                  = endDate;
            RepeatEndStrategy      = repeatEndStrategy;
            RepeatInterval         = repeatInterval;
            RepeatOccurrenceNumber = repeatOccurrenceNumber;
            DomainName             = domainName;
            CronExpressionOverride = cronExpressionOverride;
            SetUpdatedBy(updatedBy);
        }
Beispiel #3
0
 public static bool DoesNotHaveEndStrategy(this RepeatEndStrategy repeatEndStrategy) => !HasEndStrategy(repeatEndStrategy);
Beispiel #4
0
 public static bool HasEndStrategy(this RepeatEndStrategy repeatEndStrategy)
 => repeatEndStrategy != RepeatEndStrategy.Never && repeatEndStrategy != RepeatEndStrategy.NotUsed;