WorkingTimeExtensions
Ecng.ComponentModel
Extension methods for WorkingTime.
メソッド
DecodeToPeriods
public static IEnumerable<WorkingTimePeriod> DecodeToPeriods(string input)
result = WorkingTimeExtensions.DecodeToPeriods(input)
Decode from string to Periods.
- input
- Encoded string.
戻り値: 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.
戻り値: 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.
戻り値: 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.
戻り値: 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.
戻り値: 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.
戻り値: 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.
戻り値: true if the specified time is within working hours; otherwise, false.