Class Year
OptimaJet.Workflow.Core.Runtime.Calendars.Year
Represents workday settings for a calendar year.
Namespace: OptimaJet.Workflow.Core.Runtime.Calendars
public class YearProperties
public int YearNumber { get; } #Gets the calendar year number.
public List<MonthDay> Holidays { get; } #Gets the holidays configured for the year.
public List<Workday> Workdays { get; } #Gets the individual workdays configured for the year.
Methods
public bool IsWorkday(DateTime day, bool weekend) #Determines whether the specified day is a working day.
Parameters
Name
Type
Description
dayDateTimeThe day to check.
weekendBooleantrue if the day is a weekend in the base calendar; otherwise, false.Returns
Type
Description
Booleantrue if the day is a working day; otherwise, false.public TimeSpan? GetDayTime(DateTime day) #Gets the configured end time of a working day.
Parameters
Name
Type
Description
dayDateTimeThe day to query.
Returns
Type
Description
Nullable<TimeSpan>The end time for the working day on the given date, or
null if no matching workday is configured.public static Year Create(int year) #Creates a new Year instance.
Parameters
Name
Type
Description
yearInt32The year number.
Returns
Type
Description
YearA new Year for the specified year.
public Year SetHolidays(params MonthDay[] holidays) #Adds holidays to this year.
Parameters
Name
Type
Description
holidaysMonthDay[]The holidays to add.
Returns
Type
Description
YearThis Year to support fluent configuration.
Exceptions
Type
Description
ExceptionThrown when a holiday overlaps an explicitly configured workday.
public Year SetHoliday(Months month, int day) #Adds a holiday to this year.
Parameters
Name
Type
Description
monthMonthsThe month that contains the holiday.
dayInt32The day number in
month.Returns
Type
Description
YearThis Year to support fluent configuration.
Exceptions
Type
Description
ArgumentOutOfRangeExceptionThrown when
day is not valid for month in this year.ExceptionThrown when the holiday overlaps an explicitly configured workday.
public Year SetWorkdays(params Workday[] workdays) #Adds individual workdays to this year.
Parameters
Name
Type
Description
workdaysWorkday[]The workday definitions to add.
Returns
Type
Description
YearThis Year to support fluent configuration.
Exceptions
Type
Description
ExceptionThrown when a workday overlaps a holiday.
public Year SetWorkday(Months month, int day, TimeSpan startTimeOfDay, TimeSpan workingHours) #Adds a single workday definition to this year.
Parameters
Name
Type
Description
monthMonthsThe month that contains the workday.
dayInt32The day number in
month.startTimeOfDayTimeSpanThe start time of the workday.
workingHoursTimeSpanThe working duration for the day.
Returns
Type
Description
YearThis Year to support fluent configuration.
Exceptions
Type
Description
ArgumentExceptionThrown when the workday inputs are invalid.
ArgumentOutOfRangeExceptionThrown when
day or time values are outside valid ranges.ExceptionThrown when the new workday overlaps an existing holiday.
public override bool Equals(object obj) #Determines whether the specified object is equal to this Year.
Parameters
Name
Type
Description
objObjectThe object to compare with this instance.
Returns
Type
Description
Booleantrue if the specified object is a Year and has the same year number, holidays, and workdays; otherwise, false.