Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Class CalendarExtensions

OptimaJet.Workflow.Core.Runtime.Calendars.CalendarExtensions

Provides extension methods for configuring Calendar instances and calculating intervals using workflow calendar rules.

public static class CalendarExtensions

Inheritance

  • Object

Methods

public static TimeSpan GetInterval(this ICalendar calendar, string value, DateTime startDateTime) #
Gets the interval represented by value, optionally applying calendar-specific working-day rules.

Parameters

Name
Type
Description
calendar
ICalendar
Calendar settings used for working-time values.
value
String
A timer expression string.
startDateTime
DateTime
The start point for the interval calculation.

Returns

Type
Description
TimeSpan
A TimeSpan value that can be added to startDateTime to get the target time.
public static Calendar SetWorkingHours(this Calendar calendar, TimeSpan workingHours) #
Sets the total working hours per workday and returns the same Calendar instance.

Parameters

Name
Type
Description
calendar
Calendar
Calendar instance to update.
workingHours
TimeSpan
Working hours to configure.

Returns

Type
Description
Calendar
The updated calendar.
public static Calendar SetStartOfWork(this Calendar calendar, TimeSpan startTimeOfDay) #
Sets the start time of the workday and returns the same Calendar instance.

Parameters

Name
Type
Description
calendar
Calendar
Calendar instance to update.
startTimeOfDay
TimeSpan
Time of day when the working period starts.

Returns

Type
Description
Calendar
The updated calendar.
public static Calendar SetWeekends(this Calendar calendar, params DayOfWeek[] weekends) #
Adds the specified weekend days to Calendar.Weekends and returns the same Calendar instance.

Parameters

Name
Type
Description
calendar
Calendar
Calendar instance to update.
weekends
DayOfWeek[]
Weekday values to add as weekends.

Returns

Type
Description
Calendar
The updated calendar.
public static Calendar SetYears(this Calendar calendar, params Year[] years) #
Adds year-level settings to the calendar and returns the same Calendar instance.

Parameters

Name
Type
Description
calendar
Calendar
Calendar instance to update.
years
Year[]
Year objects to register by year number.

Returns

Type
Description
Calendar
The updated calendar.