private void BuildTracks(XElement lapElement, Lap lap) { foreach (var trackElement in lapElement.Descendants(TrackName)) { var track = new Track { Lap = lap, }; BuildTrackpoints(trackElement, track); _tracks.Add(track); } }
private void BuildTrackpoints(XElement trackElement, Track track) { foreach (var trackpointElement in trackElement.Descendants(TrackpointName)) { var positionElement = trackpointElement.Element("Position"); var trackpoint = new Trackpoint { AltitudeMeters = RoundIntValueOrDefault(trackpointElement, "AltitudeMeters", MetersMultiplyBy), DistanceMeters = RoundIntValueOrDefault(trackpointElement, "DistanceMeters", MetersMultiplyBy), HeartRateBpm = RoundIntValueOrDefault(trackpointElement, "HeartRateBpm"), LatitudeDegrees = GetPositionValueOrDefault(positionElement, "LatitudeDegrees", DegreesMultiplyBy), LongitudeDegrees = GetPositionValueOrDefault(positionElement, "LongitudeDegrees", DegreesMultiplyBy), SensorState = GetValueOrDefault(trackpointElement, "SensorState"), Time = GetDateTimeValueOrDefault(trackpointElement, "Time"), Track = track, }; _trackPoints.Add(trackpoint); } }
partial void UpdateTrack(Track instance);
partial void DeleteTrack(Track instance);
partial void InsertTrack(Track instance);