private void ValidateTimes() { // If the pass is supposed to retain its own times, then it must have both start and end times specified if (AreTimesRetained && (!StartTime.HasValue || !EndTime.HasValue)) { throw new ArgumentException("Retain times flag set to true. Please set Pass Start and End Times"); } // Any pass should either have specified values or null values for both times if ((StartTime.HasValue && !EndTime.HasValue) || (!StartTime.HasValue && EndTime.HasValue)) { throw new ArgumentException("PassSalesAreaPriority StartTime/EndTime are not valid"); } if (!StartTime.HasValue && !EndTime.HasValue) { return; } // XGGT-17121: Request to allow midnight-to-midnight runs and passes var passStartTime = StartTime.Value; var passEndTime = EndTime.Value; if (passStartTime != new TimeSpan(0, 0, 0) && passEndTime != new TimeSpan(23, 59, 59)) { passStartTime = TimeHelper.ConvertToBroadcast(StartTime.Value); passEndTime = TimeHelper.ConvertToBroadcast(EndTime.Value); } if (passStartTime > passEndTime) { throw new ArgumentException("PassSalesAreaPriority StartTime is greater than EndTime"); } }