コード例 #1
0
        public static void ForPrecedesDate(CompoundDateTimeService value, CompoundDateTimeService dateToPrecede, string parameterName)
        {
            if (value.DateTime >= dateToPrecede.DateTime)
            {
                throw new ArgumentOutOfRangeException(parameterName);
            }

            if (value.PersianDateTime >= dateToPrecede.PersianDateTime)
            {
                throw new ArgumentOutOfRangeException(parameterName);
            }
        }
コード例 #2
0
 public static DateTimeRange CreateOneWeekRange(CompoundDateTimeService startDay)
 => new DateTimeRange(startDay, new CompoundDateTimeService(startDay.DateTime.AddDays(7)));
コード例 #3
0
 public static DateTimeRange CreateOneDayRange(CompoundDateTimeService day)
 => new DateTimeRange(day, new CompoundDateTimeService(day.DateTime.AddDays(1)));
コード例 #4
0
 public DateTimeRange NewStart(CompoundDateTimeService newStart)
 => new DateTimeRange(newStart, this.End);
コード例 #5
0
 public DateTimeRange NewEnd(CompoundDateTimeService newEnd)
 => new DateTimeRange(this.Start, newEnd);
コード例 #6
0
 public DateTimeRange(CompoundDateTimeService start, TimeSpan duration) : this(start, start.Add(duration))
 {
 }
コード例 #7
0
 public DateTimeRange(CompoundDateTimeService start, CompoundDateTimeService end)
 {
     DateTimeGuard.ForPrecedesDate(start.DateTime, end.DateTime, "start");
     Start = start;
     End   = end;
 }