public static bool IsOccurrenceInRange(string valueToParse, DateTime start, DateTime end) { RecurrencePattern pattern = new RecurrencePattern(); if (RecurrencePatternHelper.TryParseRecurrencePattern(valueToParse, out pattern)) { return(pattern.GetOccurrences(start, start, end).Count() > 0); } return(false); }
private IRecurrenceRule GetRecurrenceRule(string pattern) { if (string.IsNullOrEmpty(pattern)) { return(null); } var recurrenceRuleGenerator = this as IObjectGenerator <IRecurrenceRule>; var recurrenceRule = recurrenceRuleGenerator != null?recurrenceRuleGenerator.CreateNew() : this.CreateDefaultRecurrenceRule(); var recurrencePattern = new RecurrencePattern(); RecurrencePatternHelper.TryParseRecurrencePattern(pattern, out recurrencePattern); recurrenceRule.Pattern = recurrencePattern; foreach (SqlExceptionOccurrence exception in this.SqlExceptionOccurrences) { recurrenceRule.Exceptions.Add(exception); } return(recurrenceRule); }