Beispiel #1
0
        /// <summary>
        /// Combines events based on if their the same Jurisdiction and (Same duty status or both are considered off duty status)
        /// </summary>
        /// <param name="statusEvent">Status event to combine</param>
        /// <returns>True if combined, False if not</returns>
        public bool CombineDutyStatusEvents(DutyStatusEvent statusEvent)
        {
            if (statusEvent.DutyStatusJursidiction.JurisdictionId == DutyStatusJursidiction.JurisdictionId && (statusEvent.DutyStatus == DutyStatus || statusEvent.IsOffDutyStatus && IsOffDutyStatus))
            {
                if (!TimeRange.OverlapsWith(statusEvent.TimeRange) && TimeRange.IntersectsWith(statusEvent.TimeRange))
                {
                    if (StartDateTime > statusEvent.StartDateTime)
                    {
                        StartDateTime = statusEvent.StartDateTime;
                        return(true);
                    }
                    else
                    {
                        EndDateTime = statusEvent.EndDateTime;
                        return(true);
                    }
                }
            }

            return(false);
        }
 /// <summary>
 /// Sets current split sleeper events for duty status event being processed
 /// </summary>
 /// <param name="firstSplit">First Split Sleeper Event that occurs</param>
 /// <param name="secondSplit">Second Split Sleeper Event that occurs</param>
 /// <param name="eventStartDateTime"></param>
 /// <param name="i"></param>
 internal void SetSplitSleeper(DutyStatusEvent firstSplit, DutyStatusEvent secondSplit, DateTimeOffset eventStartDateTime, int i)
 {
     FirstSleeperSplit  = firstSplit;
     SecondSleeperSplit = secondSplit;
     RetroactiveIndex   = firstSplit.EndDateTime == eventStartDateTime ? i : RetroactiveIndex;
 }