Work calendar
Inheritance
↳ object
↳ Calendar
Implements
ICalendar
Inherited Members
Equals(object, object)
GetType()
MemberwiseClone()
ReferenceEquals(object, object)
ToString()
Namespace: OptimaJet.Workflow.Core.Runtime.Calendars
Assembly: OptimaJet.Workflow.Core.dll
Syntax
public class Calendar : ICalendar
Properties
Name
Name of the calendar
Declaration
public string Name { get; set; }
Property value
WorkingHours
Working hours. Default 8 hours.
Declaration
public TimeSpan WorkingHours { get; set; }
Property value
StartOfWork
The beginning of the work day
Declaration
public TimeSpan StartOfWork { get; set; }
Property value
Weekends
Days of the week for weekends
Declaration
public List<DayOfWeek> Weekends { get; set; }
Property value
Type | Description |
---|
List<DayOfWeek> | |
Years
Settings for years Year
Declaration
public Dictionary<int, Year> Years { get; set; }
Property value
Type | Description |
---|
Dictionary<int, Year> | |
Methods
IsWorkday(DateTime)
Checking whether the day is a working day
Declaration
public bool IsWorkday(DateTime day)
Parameters
Type | Name | Description |
---|
DateTime | day | DateTime instance |
Returns
Type | Description |
---|
bool | true if day is workday, false otherwise |
IsWorkTime(DateTime)
Checking whether the specified date and time fall within working hours
Declaration
public bool IsWorkTime(DateTime datetime)
Parameters
Type | Name | Description |
---|
DateTime | datetime | The date and time to check |
Returns
Type | Description |
---|
bool | <code>true</code> if the time is withing working hours on a workday; otherwise <code>false</code> |
GetRestOfWorkday(DateTime)
Get the rest of the workday
Declaration
public TimeSpan GetRestOfWorkday(DateTime day)
Parameters
Type | Name | Description |
---|
DateTime | day | DateTime instance |
Returns
Type | Description |
---|
TimeSpan | TimeSpan with the rest of the work day |
GetStartOfWorkday(DateTime)
Get the start of the workday
Declaration
public TimeSpan GetStartOfWorkday(DateTime day)
Parameters
Type | Name | Description |
---|
DateTime | day | DateTime instance |
Returns
Type | Description |
---|
TimeSpan | Start of the workday |
FindWorkDayStart(DateTime)
Finds the next start of a workday beginning from the specified date and time
Declaration
public DateTime FindWorkDayStart(DateTime searchFrom)
Parameters
Type | Name | Description |
---|
DateTime | searchFrom | The date and time to start searching from |
Returns
Type | Description |
---|
DateTime | The date and time representing the start of the next workday |
FindWorkDayEnd(DateTime)
Finds the next end of a workday beginning from the specified date and time
Declaration
public DateTime FindWorkDayEnd(DateTime searchFrom)
Parameters
Type | Name | Description |
---|
DateTime | searchFrom | The date and time to start searching from |
Returns
Type | Description |
---|
DateTime | The date and time representing the end of the next workday |
FindWorkDayTime(DateTime)
Returns the given time if it falls within working hours,
or the start of the next workday otherwise
Declaration
public DateTime FindWorkDayTime(DateTime searchFrom)
Parameters
Type | Name | Description |
---|
DateTime | searchFrom | The date and time to start searching from |
Returns
Type | Description |
---|
DateTime | A date and time that falls withing working hours |
GetWorkDaysInRange(DateTime, DateTime)
Returns a list of workdays between two dates, using the start time of each workday
Declaration
public List<DateTime> GetWorkDaysInRange(DateTime from, DateTime to)
Parameters
Type | Name | Description |
---|
DateTime | from | The start date of the range |
DateTime | to | The end date of the range |
Returns
Type | Description |
---|
List<DateTime> | A list of dates representing the start of each workday in the specified range |
Create(string)
Create instance of the calendar
Declaration
public static Calendar Create(string name)
Parameters
Type | Name | Description |
---|
string | name | Name of the calendar |
Returns
Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|
object | obj | |
Returns
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Extension Methods