Assembly: OptimaJet.Workflow.Core

Class Year

OptimaJet.Workflow.Core.Runtime.Calendars.Year

Represents workday settings for a calendar year.

public class Year

Properties

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
day
DateTime
The day to check.
weekend
Boolean
true if the day is a weekend in the base calendar; otherwise, false.

Returns

Type
Description
Boolean
true 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
day
DateTime
The 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
year
Int32
The year number.

Returns

Type
Description
Year
A new Year for the specified year.
public Year SetHolidays(params MonthDay[] holidays) #
Adds holidays to this year.

Parameters

Name
Type
Description
holidays
MonthDay[]
The holidays to add.

Returns

Type
Description
Year
This Year to support fluent configuration.

Exceptions

Type
Description
Exception
Thrown 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
month
Months
The month that contains the holiday.
day
Int32
The day number in month.

Returns

Type
Description
Year
This Year to support fluent configuration.

Exceptions

Type
Description
ArgumentOutOfRangeException
Thrown when day is not valid for month in this year.
Exception
Thrown when the holiday overlaps an explicitly configured workday.
public Year SetWorkdays(params Workday[] workdays) #
Adds individual workdays to this year.

Parameters

Name
Type
Description
workdays
Workday[]
The workday definitions to add.

Returns

Type
Description
Year
This Year to support fluent configuration.

Exceptions

Type
Description
Exception
Thrown 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
month
Months
The month that contains the workday.
day
Int32
The day number in month.
startTimeOfDay
TimeSpan
The start time of the workday.
workingHours
TimeSpan
The working duration for the day.

Returns

Type
Description
Year
This Year to support fluent configuration.

Exceptions

Type
Description
ArgumentException
Thrown when the workday inputs are invalid.
ArgumentOutOfRangeException
Thrown when day or time values are outside valid ranges.
Exception
Thrown 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
obj
Object
The object to compare with this instance.

Returns

Type
Description
Boolean
true if the specified object is a Year and has the same year number, holidays, and workdays; otherwise, false.
public override int GetHashCode() #
Returns a hash code for this Year.

Returns

Type
Description
Int32
A hash code based on the year number, holidays, and workday settings.