示例#1
0
 private TimeZone CreateTimeZone()
 {
     if (this._timeZoneService.GetTimeZone(_default) != null)
         return this._timeZoneService.GetTimeZone(_default);
     var timeZone = new TimeZone(_default);
     foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
     {
         if (dayOfWeek != DayOfWeek.Sunday && dayOfWeek != DayOfWeek.Saturday)
         {
             timeZone.AddRangeTime(dayOfWeek, 9, 12);
             timeZone.AddRangeTime(dayOfWeek, 13, 19);
             timeZone.RemoveRangeTime(dayOfWeek, 18.5, 19);
         }
     }
     timeZone.AddSpecialDay(DateTime.Now, 6, 12);
     timeZone.AddExceptionDay(DateTime.Now.AddDays(1));
     this._timeZoneService.Create(timeZone);
     return timeZone;
 }