Class CalendarExtensions
OptimaJet.Workflow.Core.Runtime.Calendars.CalendarExtensions
Provides extension methods for configuring Calendar instances and calculating intervals using workflow calendar rules.
Namespace: OptimaJet.Workflow.Core.Runtime.Calendars
public static class CalendarExtensionsInheritance
- 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
calendarICalendarCalendar settings used for working-time values.
valueStringA timer expression string.
startDateTimeDateTimeThe start point for the interval calculation.
Returns
Type
Description
TimeSpanA 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
calendarCalendarCalendar instance to update.
workingHoursTimeSpanWorking hours to configure.
Returns
Type
Description
CalendarThe 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
calendarCalendarCalendar instance to update.
startTimeOfDayTimeSpanTime of day when the working period starts.
Returns
Type
Description
CalendarThe 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
calendarCalendarCalendar instance to update.
weekendsDayOfWeek[]Weekday values to add as weekends.
Returns
Type
Description
CalendarThe updated
calendar.