Class Calendar
OptimaJet.Workflow.Core.Runtime.Calendars.Calendar
Work calendar
Namespace: OptimaJet.Workflow.Core.Runtime.Calendars
public class Calendar : ICalendarInheritance
- System.Object
Implemented Interfaces
Properties
Name
Type
Name #StringName of the calendar
WorkingHours #TimeSpanWorking hours. Default 8 hours.
StartOfWork #TimeSpanThe beginning of the work day
Weekends #List<DayOfWeek>Days of the week for weekends
Years #Dictionary<Year>Settings for years Year
Methods
public bool IsWorkday(DateTime day) #Checking whether the day is a working day
Parameters
Name
Type
Description
dayDateTimeDateTime instance
Returns
Type
Description
Booleantrue if day is workday, false otherwise
public bool IsWorkTime(DateTime datetime) #Checking whether the specified date and time fall within working hours
Parameters
Name
Type
Description
datetimeDateTimeThe date and time to check
Returns
Type
Description
Booleantrue if the time is withing working hours on a workday; otherwise falsepublic TimeSpan GetRestOfWorkday(DateTime day) #Get the rest of the workday
Parameters
Name
Type
Description
dayDateTimeDateTime instance
Returns
Type
Description
TimeSpanTimeSpan with the rest of the work day
public TimeSpan GetStartOfWorkday(DateTime day) #Get the start of the workday
Parameters
Name
Type
Description
dayDateTimeDateTime instance
Returns
Type
Description
TimeSpanStart of the workday
public DateTime FindWorkDayStart(DateTime searchFrom) #Finds the next start of a workday beginning from the specified date and time
Parameters
Name
Type
Description
searchFromDateTimeThe date and time to start searching from
Returns
Type
Description
DateTimeThe date and time representing the start of the next workday
public DateTime FindWorkDayEnd(DateTime searchFrom) #Finds the next end of a workday beginning from the specified date and time
Parameters
Name
Type
Description
searchFromDateTimeThe date and time to start searching from
Returns
Type
Description
DateTimeThe date and time representing the end of the next workday
public DateTime FindWorkDayTime(DateTime searchFrom) #Returns the given time if it falls within working hours, or the start of the next workday otherwise
Parameters
Name
Type
Description
searchFromDateTimeThe date and time to start searching from
Returns
Type
Description
DateTimeA date and time that falls withing working hours
public List<DateTime> GetWorkDaysInRange(DateTime from, DateTime to) #Returns a list of workdays between two dates, using the start time of each workday
Parameters
Name
Type
Description
fromDateTimeThe start date of the range
toDateTimeThe end date of the range
Returns
Type
Description
List<DateTime>A list of dates representing the start of each workday in the specified range
public static Calendar Create(string name) #Create instance of the calendar
Parameters
Name
Type
Description
nameStringName of the calendar
Returns
Type
Description
Calendarpublic override bool Equals(object obj) #Parameters
Name
Type
Description
objObjectReturns
Type
Description
Booleanpublic override int GetHashCode() #Returns
Type
Description
Int32