Skip to main content

Introducing Formengine - The New Formbuilder, try for FREE formengine.io.

Class Calendar

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
TypeDescription
string

WorkingHours

Working hours. Default 8 hours.

Declaration
public TimeSpan WorkingHours { get; set; }
Property value
TypeDescription
TimeSpan

StartOfWork

The beginning of the work day

Declaration
public TimeSpan StartOfWork { get; set; }
Property value
TypeDescription
TimeSpan

Weekends

Days of the week for weekends

Declaration
public List<DayOfWeek> Weekends { get; set; }
Property value
TypeDescription
List<DayOfWeek>

Years

Settings for years Year

Declaration
public Dictionary<int, Year> Years { get; set; }
Property value
TypeDescription
Dictionary<int, Year>

Methods

IsWorkday(DateTime)

Checking whether the day is a working day

Declaration
public bool IsWorkday(DateTime day)
Parameters
TypeNameDescription
DateTimedayDateTime instance
Returns
TypeDescription
booltrue 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
TypeNameDescription
DateTimedatetimeThe date and time to check
Returns
TypeDescription
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
TypeNameDescription
DateTimedayDateTime instance
Returns
TypeDescription
TimeSpanTimeSpan with the rest of the work day

GetStartOfWorkday(DateTime)

Get the start of the workday

Declaration
public TimeSpan GetStartOfWorkday(DateTime day)
Parameters
TypeNameDescription
DateTimedayDateTime instance
Returns
TypeDescription
TimeSpanStart 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
TypeNameDescription
DateTimesearchFromThe date and time to start searching from
Returns
TypeDescription
DateTimeThe 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
TypeNameDescription
DateTimesearchFromThe date and time to start searching from
Returns
TypeDescription
DateTimeThe 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
TypeNameDescription
DateTimesearchFromThe date and time to start searching from
Returns
TypeDescription
DateTimeA 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
TypeNameDescription
DateTimefromThe start date of the range
DateTimetoThe end date of the range
Returns
TypeDescription
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
TypeNameDescription
stringnameName of the calendar
Returns
TypeDescription
Calendar

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
TypeNameDescription
objectobj
Returns
TypeDescription
bool

GetHashCode()

Declaration
public override int GetHashCode()
Returns
TypeDescription
int

Extension Methods