/// <summary> /// 验证当前实例是否存在工作单元 /// </summary> /// <param name="throwException"></param> /// <returns></returns> /// protected virtual bool Validate(bool throwException) { if (BusinessDays.Any()) { return(true); } if (throwException) { throw new InvalidOperationException($"The {nameof(BusinessDays)} property must have at least one {nameof(BusinessDay)}."); } return(false); }
/// <summary> /// 判断指定时间点是否处于工作时间 /// </summary> /// <param name="date"></param> /// <returns></returns> public bool IsBusinessDay(DateTime date) { return(BusinessDays.Any(day => day.IsBusinessDay(date))); }