WorkingTimeExtensions

Ecng.ComponentModel

Extension methods for WorkingTime.

Métodos

DecodeToPeriods
public static IEnumerable<WorkingTimePeriod> DecodeToPeriods(string input)
result = WorkingTimeExtensions.DecodeToPeriods(input)

Decode from string to Periods.

input
Encoded string.

Devuelve: Schedule validity periods.

DecodeToSpecialDays
public static IDictionary<DateTime, Range<TimeSpan>[]> DecodeToSpecialDays(string input)
result = WorkingTimeExtensions.DecodeToSpecialDays(input)

Decode from string to SpecialDays.

input
Encoded string.

Devuelve: Special working days and holidays.

EncodeToString
public static string EncodeToString(IEnumerable<WorkingTimePeriod> periods)
result = WorkingTimeExtensions.EncodeToString(periods)

Encode Periods to string.

periods
Schedule validity periods.

Devuelve: Encoded string.

EncodeToString
public static string EncodeToString(IDictionary<DateTime, Range<TimeSpan>[]> specialDays)
result = WorkingTimeExtensions.EncodeToString(specialDays)

Encode SpecialDays to string.

specialDays
Special working days and holidays.

Devuelve: Encoded string.

GetPeriod
public static WorkingTimePeriod GetPeriod(WorkingTime workingTime, DateTime date)
result = WorkingTimeExtensions.GetPeriod(workingTime, date)

Gets the first period where Till is greater than or equal to the specified date.

workingTime
Working time settings.
date
The date to check.

Devuelve: The matching period, or null if none found.

IsWorkingDate
public static bool IsWorkingDate(WorkingTime workingTime, DateTime date, bool checkHolidays)
result = WorkingTimeExtensions.IsWorkingDate(workingTime, date, checkHolidays)

Determines whether the specified date is a working date.

workingTime
Working time settings.
date
The date to check.
checkHolidays
Whether to check for holidays and weekends.

Devuelve: true if the date is a working date; otherwise, false.

IsWorkingTime
public static bool IsWorkingTime(WorkingTime workingTime, DateTime dateTime, bool? isWorkingDay, WorkingTimePeriod period)
result = WorkingTimeExtensions.IsWorkingTime(workingTime, dateTime, isWorkingDay, period)

Determines whether the specified date/time falls within working hours.

workingTime
Working time settings.
dateTime
The date/time to check.
isWorkingDay
Output: true if the day is a working day, false if holiday, null if not determined.
period
Output: the matching period.

Devuelve: true if the specified time is within working hours; otherwise, false.