Class Calendar
OptimaJet.Workflow.Core.Runtime.Calendars.Calendar
Represents a work calendar.
Namespace: OptimaJet.Workflow.Core.Runtime.Calendars
public class Calendar : ICalendarInheritance
- Object
Implemented Interfaces
Properties
Name
Type
Name #StringGets or sets the calendar name.
WorkingHours #TimeSpanGets or sets the default working duration for a workday.
StartOfWork #TimeSpanGets 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
dayDateTimeThe date to evaluate.
Returns
Type
Description
Booleantrue 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
datetimeDateTimeThe date and time to evaluate.
Returns
Type
Description
Booleantrue 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
dayDateTimeThe date and time to evaluate.
Returns
Type
Description
TimeSpanThe 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
dayDateTimeThe date used to resolve individual workday settings.
Returns
Type
Description
TimeSpanThe 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
searchFromDateTimeThe exclusive lower bound for the search.
Returns
Type
Description
DateTimeThe 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
searchFromDateTimeThe exclusive lower bound for the search.
Returns
Type
Description
DateTimeThe 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
searchFromDateTimeThe date and time to evaluate.
Returns
Type
Description
DateTimesearchFrom 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
fromDateTimeThe exclusive lower bound of the range.
toDateTimeThe 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
nameStringThe calendar name.
Returns
Type
Description
Calendarpublic override bool Equals(object obj) #Determines whether the specified object is equal to this calendar.
Parameters
Name
Type
Description
objObjectThe object to compare with the current calendar.
Returns
Type
Description
Booleantrue 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
Int32A hash code for this instance.