예제 #1
0
        private TrackedRideDocument CreateTrackedRideForRide(Ride ride)
        {
            var tr = new TrackedRideDocument();
            tr.Device = ride.Vehicle.DeviceId;
            tr.StartTime = ride.StartDateTime;
            tr.EndTime = ride.EndDateTime;
            tr.DriverId = ride.DriverId;
            AddGpsPoints(tr);
            AddObds(tr);

            return tr;
        }
예제 #2
0
        private TrackedRideDocument GetOrCreateTrackedRide(Ride ride, IEnumerable<TrackedRideDocument> trackedRides)
        {
            var trackedRide = trackedRides.FirstOrDefault(tr => tr.DriverId == ride.DriverId
                && tr.StartTime <= ride.StartDateTime
                && tr.EndTime >= ride.EndDateTime
                && tr.Device == ride.Vehicle.DeviceId);

            return trackedRide ?? CreateTrackedRideForRide(ride);
        }