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; }
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); } }
public static TimeTypes Create(TimeIncrements Increment, DateTime Start, DateTime Stop, int StartId, int StopId) { return(new TimeTypes(Increment, Start, Stop, StartId, StopId)); }
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); }
public SegmentedBlock(TimeIncrements Increment, int StartId, int StopId, DateTime Start, DateTime Stop) : base(Increment, Start, Stop, StartId, StopId) { CreateSegments(); }