예제 #1
0
        protected TimeBlockBase(TimeIncrements Increment, DateTime Start, DateTime Stop, int StartId, int StopId)
        {
            if (Stop < Start)
            {
                throw new ArgumentException("Stop Time cannot be greater than Start Time");
            }

            if (StartId.Equals(0) || StopId.Equals(0))
            {
                throw new ArgumentException("Start Id and/or Stop Id cannot be 0");
            }

            this.StartId  = StartId;
            this.StopId   = StopId;
            this.Start    = Start;
            this.Stop     = Stop;
            TimeIncrement = Increment;
            StartInterval = DailyTimeIntervals.GetDailyTimeIntervalFromId(StartId);
            StopInterval  = DailyTimeIntervals.GetDailyTimeIntervalFromId(StopId);

            this.Start = Start.Add(StartInterval.TotalTimeSpan);
            this.Stop  = Stop.Add(StopInterval.TotalTimeSpan);

            Duration = this.Stop - this.Start;
        }
예제 #2
0
 private TimeTypes(TimeIncrements Increment, string Start, string Stop, int StartId, int StopId)
 {
     if (DateTime.TryParse(Start, out DateTime StartResult) && DateTime.TryParse(Stop, out DateTime StopResult))
     {
         Id    = nameof(TimeTypeEnum.Segmented);
         Name  = nameof(TimeTypeEnum.Segmented);
         Block = new SegmentedBlock(Increment, StartId, StopId, StartResult, StopResult);
     }
 }
예제 #3
0
 public static TimeTypes Create(TimeIncrements Increment, DateTime Start, DateTime Stop, int StartId, int StopId)
 {
     return(new TimeTypes(Increment, Start, Stop, StartId, StopId));
 }
예제 #4
0
 private TimeTypes(TimeIncrements Increment, DateTime Start, DateTime Stop, int StartId, int StopId)
 {
     Id    = nameof(TimeTypeEnum.Segmented);
     Name  = nameof(TimeTypeEnum.Segmented);
     Block = new SegmentedBlock(Increment, StartId, StopId, Start, Stop);
 }
예제 #5
0
 public SegmentedBlock(TimeIncrements Increment, int StartId, int StopId, DateTime Start, DateTime Stop) : base(Increment, Start, Stop, StartId, StopId)
 {
     CreateSegments();
 }