public void UpdateFleetCompleteData(FleetComplete.Asset a) { try { if (dataSource == "AVL" && DateTime.Now.Subtract(dateLastCommunicated).TotalSeconds < 60) { // If we've had a location from the GIS system in the last 60 seconds, // we should ignore this location because it's not as precise // as our GIS location. return; } if (a.Position.Longitude == 0 || a.Position.Latitude == 0) { // we didn't get a location for this unit so let's not do anything. return; } isChanged = true; dateLastCommunicated = a.LastUpdatedTimeStampLocal; dateUpdated = a.LastUpdatedTimeStampLocal; latitude = a.Position.Latitude; longitude = a.Position.Longitude; direction = (int)a.Position.Direction; velocityMPH = a.Position.Speed ?? 0; } catch (Exception ex) { new ErrorLog(ex, "UpdateFleetCompleteData"); } }
public UnitTracking(FleetComplete.Asset a) { isChanged = true; unitcode = a.AssetTag; assetTag = a.AssetTag; dataSource = "FC"; dateLastCommunicated = a.LastUpdatedTimeStampLocal; dateUpdated = a.LastUpdatedTimeStampLocal; try { if (a.Position != null && a.Position.Latitude != 0) { latitude = a.Position.Latitude; longitude = a.Position.Longitude; direction = (int)a.Position.Direction; velocityMPH = a.Position.Speed ?? 0; } } catch (Exception ex) { new ErrorLog(ex, "Updating FleetComplete UnitTracking"); return; } }