Class RecurrenceRule
Implements the definition of a simple recurrence. There are two representations available for the recurrence definition. One is a simple text string that hold words defining the recurrence. The property Text holds this text string. The other representation is based on the ParseTokens enumerations along with some supporting integer properties. The enumerations are Every, On, and BeforeAfter. The supporting properties are EveryCount, OnCount and BeforeAfterCount.
Inheritance
Inherited Members
Namespace: Syncfusion.Schedule
Assembly: Syncfusion.Schedule.Base.dll
Syntax
public class RecurrenceRule
Remarks
It is important to understand that there are two ways to define a set of recurrences in a RecurrenceRule object. One is through the Text property. The other is through the ParseToken enumeration properties and their associated integer properties. The Text definition is easier to serialize and present to the user. The enumeration properties allow for straight-forward calculation support.
Constructors
RecurrenceRule()
Initializes a new instance of the RecurrenceRule class.
Declaration
public RecurrenceRule()
RecurrenceRule(String)
Initializes a new instance of the RecurrenceRule class. Accepts a string used in the recurrence defintion.
Declaration
public RecurrenceRule(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The string that defines this recurrence. |
Properties
BeforeAfter
Gets or sets after clause for this rule.
Declaration
public ParseTokens BeforeAfter { get; set; }
Property Value
Type |
---|
ParseTokens |
Remarks
The valid values for this property are: MON TUE WED THU FRI SAT SUN JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC NULL
If BeforeAfter has a value of ParseToken.NULL, then BeforeAfterCount should be positive and represent a date. For example, the string "Every month on Wed After 15" would pick out the first Wed of every month on or after the 15th of the month. In this case, the enumeration representation of this recurrence definition would have BeforeAfter = ParseToken.NULL and BeforeAfterCount = 15. Also, this is a required entry when specifying a recurrence definition.
BeforeAfterCount
Gets or sets an integer value used in conjunction with the BeforeAfter property to determine the After clause of the definition of this recurrence. So, if Text = "Every month After Wed:2", then this would tranlate into the BeforeAfter = ParseToken.WED and BeforeAfterCount = 2.
Declaration
public int BeforeAfterCount { get; set; }
Property Value
Type |
---|
System.Int32 |
BeforeAfterType
Gets or sets the BeforeAfterType which is not currently being used.
Declaration
public ParseTokens BeforeAfterType { get; set; }
Property Value
Type |
---|
ParseTokens |
Remarks
For the current implementation, this property should always have the value of ParseTokens.After.
Every
Gets or sets Every clause for this rule.
Declaration
public ParseTokens Every { get; set; }
Property Value
Type |
---|
ParseTokens |
Remarks
The valid values for this property are: DAY WEEK MONTH QUARTER YEAR WEEKDAY WEEKEND MON TUE WED THU FRI SAT SUN JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC NULL If Every = ParseTokens.NULL, then EveryCount must be positive. In this case, the EveryCount represents a date. So, the string Text = "Every 21" would result in Every = ParseTokens.NULL and EveryCount = 21. The recurrence definition would represent the 21st of every month. Please note that the month entries, normally have a non-zero value set for EveryCount. Also, this is a required entry when specifying a recurrence definition.
EveryCount
Gets or sets an integer value used in conjunction with the Every property to determine the Every clause of the definition of this recurrence. So, if Text = "Every Jan 20", then this would translate into the Every = ParseToken.JAN and EveryCount = 20.
Declaration
public int EveryCount { get; set; }
Property Value
Type |
---|
System.Int32 |
On
Gets or sets on clause for this rule.
Declaration
public ParseTokens On { get; set; }
Property Value
Type |
---|
ParseTokens |
Remarks
The valid values for this property are: WEEKDAY WEEKEND MON TUE WED THU FRI SAT SUN JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC
OnCount
Gets or sets an integer value used in conjunction with the On property to determine the On clause of the definition of this recurrence. So, if Text = "Every month On Wed:2", then this would tranlate into the On = ParseToken.WED and OnCount = 2.
Declaration
public int OnCount { get; set; }
Property Value
Type |
---|
System.Int32 |
Text
Gets a string representation of a recurrence definition.
Declaration
public string Text { get; }
Property Value
Type |
---|
System.String |
Remarks
Here are some examples:
-
Every Month On 13
-
Every Month On Wed:2
-
Every Year On Apr 15
-
Every Apr 15
-
Every Year On weekday After Apr 15
-
Every Year On Tue After Apr 15
-
Every Week on Thu
-
Every Week:2 On Wed
-
Every Week On Thu
-
Every Month On 13
Many of the example strings are self explanatory. In the second example, the Wed:2 indicates the second Wed. In the 8th example, Week:2 indicates every 2 weeks. Examples 3 and 4 define exactly the same recurrence. Examples 5 and 6 have After clauses in addition to Every and On clauses. From the examples, you can see that a Text rule that defines a recurrence can contain an Every clause, an On clause and an After clause. The only piece that is required is the Every clause (as seen in example 4). The order and case of these clause does not matter. So, On 'Apr 15 Every Year' is valid and the same as 'EVERY year ON apr 15'. See the indivdual ParseToken properties (Every, On and BeforeAfter) for a discussion of the valid forms of these clauses. The words used in a Text definition of a recurrence rule can be localized through the ParseableStrings property.
Methods
ToString()
An Overridden method that returns a string holding the RecurrenceRule object.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of this object. |