Workflow Engine .NET

Assembly: OptimaJet.Workflow.Core

Class Calendar

OptimaJet.Workflow.Core.Runtime.Calendars.Calendar

Represents a work calendar.

public class Calendar : ICalendar

Inheritance

  • Object

Implemented Interfaces

Properties

Name
Type
Name #
String
Gets or sets the calendar name.
WorkingHours #
TimeSpan
Gets or sets the default working duration for a workday.
StartOfWork #
TimeSpan
Gets or sets the default start time of the workday.
Weekends #
List<DayOfWeek>
Gets or sets the days of week that are weekends.
Years #
Dictionary<Int32, Year>
Gets or sets year-specific calendar settings.

Methods

public bool IsWorkday(DateTime day) #
Determines whether the specified date is a workday.

Parameters

Name
Type
Description
day
DateTime
The date to evaluate.

Returns

Type
Description
Boolean
true if the date is a workday; otherwise, false.
public bool IsWorkTime(DateTime datetime) #
Determines whether the specified date is a workday and its time has not passed the end of that workday.

Parameters

Name
Type
Description
datetime
DateTime
The date and time to evaluate.

Returns

Type
Description
Boolean
true if datetime is on a workday and is no later than the end of that workday; otherwise, false.
public TimeSpan GetRestOfWorkday(DateTime day) #
Gets the duration from the specified date and time to the configured end of its workday.

Parameters

Name
Type
Description
day
DateTime
The date and time to evaluate.

Returns

Type
Description
TimeSpan
The duration until the configured workday end. The value is negative when day is later than that time.
public TimeSpan GetStartOfWorkday(DateTime day) #
Gets the configured start time of the workday for the specified date.

Parameters

Name
Type
Description
day
DateTime
The date used to resolve individual workday settings.

Returns

Type
Description
TimeSpan
The individual start time configured for the date, or the default start time.
public DateTime FindWorkDayStart(DateTime searchFrom) #
Finds the first workday start strictly later than the specified date and time.

Parameters

Name
Type
Description
searchFrom
DateTime
The exclusive lower bound for the search.

Returns

Type
Description
DateTime
The date and time when the matching workday starts.
public DateTime FindWorkDayEnd(DateTime searchFrom) #
Finds the first workday end strictly later than the specified date and time.

Parameters

Name
Type
Description
searchFrom
DateTime
The exclusive lower bound for the search.

Returns

Type
Description
DateTime
The date and time when the matching workday ends.
public DateTime FindWorkDayTime(DateTime searchFrom) #
Returns the specified date and time when it is accepted by ICalendar.IsWorkTime(DateTime); otherwise, finds the first subsequent workday start.

Parameters

Name
Type
Description
searchFrom
DateTime
The date and time to evaluate.

Returns

Type
Description
DateTime
searchFrom if it is accepted by ICalendar.IsWorkTime(DateTime); otherwise, the next workday start time.
public List<DateTime> GetWorkDaysInRange(DateTime from, DateTime to) #
Gets the workday start times strictly between the specified bounds.

Parameters

Name
Type
Description
from
DateTime
The exclusive lower bound of the range.
to
DateTime
The exclusive upper bound of the range.

Returns

Type
Description
List<DateTime>
The workday start times that are later than from and earlier than to, ordered chronologically.
public static Calendar Create(string name) #
Creates a new calendar instance.

Parameters

Name
Type
Description
name
String
The calendar name.

Returns

Type
Description
Calendar
A new Calendar with Calendar.Name set to name.
public override bool Equals(object obj) #
Determines whether the specified object is equal to this calendar.

Parameters

Name
Type
Description
obj
Object
The object to compare with the current calendar.

Returns

Type
Description
Boolean
true if the specified object is a calendar with matching settings; otherwise, false.
public override int GetHashCode() #
Returns a hash code for this calendar based on its configuration values.

Returns

Type
Description
Int32
A hash code for this instance.