Exemple #1
0
 public void RangeTime()
 {
     var timeZone = new TimeZone("Default");
     timeZone.AddRangeTime(DayOfWeek.Monday, 9, 10);
     Assert.AreEqual(1, timeZone.WorkingDays.Count());
     var workingDay = timeZone.WorkingDays.FirstOrDefault();
     Assert.AreEqual(2, workingDay.WorkingHours.Count());
     timeZone.AddRangeTime(DayOfWeek.Monday, 9, 10);
     Assert.AreEqual(1, timeZone.WorkingDays.Count());
     workingDay = timeZone.WorkingDays.FirstOrDefault();
     Assert.AreEqual(2, workingDay.WorkingHours.Count());
 }
Exemple #2
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;
 }