// set defaults from profile public CurrentLocationState(Models.TestProfile p) { this.CurrentLocation = new Location(); this.PreviousLocation = new Location(); // set the current and previous locations Models.Location PrevLocation = new Models.Location(); Models.Location currLocation = new Models.Location(); currLocation.EngineHours = p.startingEngineHours; currLocation.Latitude = p.travelProfile.startingLatitude; currLocation.Longitude = p.travelProfile.startingLongitude; currLocation.LocationRecordedDateTime = p.StartingDateTime; currLocation.OdometerReading = p.startingOdometer; currLocation.ReducedGPSPrecision = false; currLocation.LocationRecordedDateTime = p.StartingDateTime; PrevLocation.EngineHours = p.startingEngineHours; PrevLocation.Latitude = p.travelProfile.startingLongitude; PreviousLocation.Longitude = p.travelProfile.startingLongitude; PrevLocation.LocationRecordedDateTime = p.StartingDateTime; PrevLocation.OdometerReading = p.startingOdometer; PrevLocation.ReducedGPSPrecision = false; PreviousLocation.LocationRecordedDateTime = p.StartingDateTime; this.CurrentLocation = currLocation; this.PreviousLocation = PrevLocation; }
private Models.EventSet getDefaultEventSet() { Models.TestProfile p = new Models.TestProfile(); p.LoadTripSegments(); p.profileSegments[0].DurationSeconds = 122 * 3600; // 122 hours of driving at 60MPH will take us all the the way around... p.PollingIntervalSeconds = 3600; // each hour Models.EventSet es = EventGenerator.GenerateEvents(p); return(es); }
public CurrentVehicleState(Models.TestProfile p) { SetDefaults(); }
private Models.EventSet GetEventSet(string id) { // get the profile and segments... Data.ELDTestDataEntities db = new ELDTestDataEntities(); db.Configuration.LazyLoadingEnabled = false; var dbTestProfile = db.TestProfiles.Include("TestProfileSegments").SingleOrDefault(x => x.ProfileId == id); Models.EventSet es = new Models.EventSet(); if (dbTestProfile != null) { // create the local current state objects Models.TestProfile p = new Models.TestProfile(); p.DefaultCurrentTripState.BluetoothId = dbTestProfile.BluetoothId; p.DefaultCurrentTripState.CarrierUSDOTNumber = dbTestProfile.CarrierUSDOTNumber; p.DefaultCurrentTripState.CMVTrailerNumbers = dbTestProfile.CMVTrailerNumbers; p.DefaultCurrentTripState.CMVUnitNumber = dbTestProfile.CMVUnitNumber; p.PollingIntervalSeconds = dbTestProfile.PollingIntervalSeconds.Value; p.ProfileId = dbTestProfile.ProfileId; p.ProfileName = dbTestProfile.ProfileName; p.StartingDateTime = dbTestProfile.StartingDateTime.Value; p.startingEngineHours = dbTestProfile.StartingEngineHours.Value; p.startingOdometer = dbTestProfile.StartingOdometer.Value; p.travelProfile = new Models.TravelProfile(); foreach (var seg in dbTestProfile.TestProfileSegments) { Models.TestProfileSegment tps = new Models.TestProfileSegment(); tps.ActionId = seg.ActionId; tps.CommentAnnotation = seg.CommentAnnotation; tps.DateOfCertifiedRecord = seg.DateOfCertifiedRecord; tps.DriversLocationDesc = seg.DriversLocationDesc; tps.DurationSeconds = seg.DurationSeconds.HasValue ? seg.DurationSeconds.Value : 0; tps.MPH = seg.MPH.HasValue ? seg.MPH.Value : 0; tps.ProfileId = seg.ProfileId; tps.SegmentSeqNum = seg.SegmentSeqNum; p.profileSegments.Add(tps); } p.DefaultCurrentTripState.CurrentDriverId = dbTestProfile.Driver1Id; Models.CurrentDriverState cds = new Models.CurrentDriverState(); cds.CarrierMultiDayBasis = dbTestProfile.CarrierMultiDayBasis; cds.DeviceId = dbTestProfile.DeviceId; cds.DriverDayStartHour = (byte)(dbTestProfile.Driver1DayStartHour.HasValue ? dbTestProfile.Driver1DayStartHour.Value : 0); cds.DriverFirstName = dbTestProfile.Driver1FirstName; cds.DriverId = dbTestProfile.Driver1Id; cds.DriverIsExempt = dbTestProfile.Driver1IsExempt; cds.DriverLastName = dbTestProfile.Driver1LastName; cds.DriverLicenseIssuingStateCode = dbTestProfile.Driver1DriverLicenseIssuingStateCode; cds.DriverLicenseNumber = dbTestProfile.Driver1DriverLicenseNumber; cds.IsUnidentifiedDriver = false; cds.PersonalUseOfCMVAllowed = dbTestProfile.Driver1PersonalUseOfCMVAllowed; cds.PersonalUseOfCMVInEffect = false; cds.TimeZoneId = dbTestProfile.Driver1TimeZoneId; cds.YardMovesAllowed = dbTestProfile.Driver1YardMovesAllowed; p.DefaultCurrentTripState.Drivers.Add(cds); es = EventGenerator.GenerateEvents(p); } return(es); }