Exemple #1
0
 public BusinessWeek(string instanceName, TimeSpan startTime, TimeSpan endTime, params DayOfWeek[] dayOfWeeks) : this(instanceName)
 {
     if (dayOfWeeks != null)
     {
         for (int i = 0; i < dayOfWeeks.Length; i++)
         {
             BusinessDays.Add(new BusinessDay(dayOfWeeks[i], startTime, endTime));
         }
     }
 }
Exemple #2
0
 /// <summary>
 /// 添加工作单元
 /// </summary>
 /// <param name="businessDay"></param>
 public void AddBusinessDay(BusinessDay businessDay)
 {
     if (InstanceName == nameof(Default))
     {
         throw new InvalidOperationException($"Operation is forbidden as the default instance.");
     }
     if (businessDay != null)
     {
         BusinessDays.Add(businessDay);
     }
 }
Exemple #3
0
 /// <summary>
 /// 批量添加工作单元
 /// </summary>
 /// <param name="businessDays"></param>
 public void AddBusinessDays(IList <BusinessDay> businessDays)
 {
     if (InstanceName == nameof(Default))
     {
         throw new InvalidOperationException($"Operation is forbidden as the default instance.");
     }
     if (businessDays != null)
     {
         foreach (var item in businessDays)
         {
             BusinessDays.Add(item);
         }
     }
 }