private void ConvertDeviceGPXInArchiveToGPXFile(GPS gps = null) { if (gps == null) { foreach (var item in DeviceGPXCollection) { //if(item.GPX=="") //{ // item.GPX = DeviceWaypointGPXes.getXML(item.RowID); //} var gpxFile = Entities.GPXFileViewModel.ConvertToGPXFile(item); AddToDictionary(gpxFile.GPS, gpxFile); } } else { List<GPXFile> gpxFiles = new List<GPXFile>(); if (ArchivedGPXFiles.Keys.Contains(gps) && ArchivedGPXFiles[gps].Count > 0) { gpxFiles = ArchivedGPXFiles[gps]; } foreach (var item in DeviceGPXCollection.Where(t => t.GPS.DeviceID == gps.DeviceID)) { if (item.GPX == "") { item.GPX = DeviceWaypointGPXes.getXML(item.RowID); } var gpxFile = Entities.GPXFileViewModel.ConvertToGPXFile(item); if (!gpxFiles.Contains(gpxFile)) { AddToDictionary(gpxFile.GPS, gpxFile); } } } }
public DeviceGPX GetDeviceGPX(DeviceGPX deviceGPX) { return(DeviceGPXCollection .Where(t => t.GPS.DeviceID == deviceGPX.GPS.DeviceID) .Where(t => t.Filename == deviceGPX.Filename) .FirstOrDefault()); }
public List<DateTime> GetMonthsInArchive(GPS gps) { return DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .OrderBy(t => t.TimeRangeStart) .GroupBy(t => t.TimeRangeStart.ToString("MMM-yyyy")) .Select(g => g.First().TimeRangeStart) .ToList(); }
public DeviceGPX GetDeviceGPX(GPS gps, string fileName) { var g = DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .Where(t => t.Filename == Path.GetFileName(fileName)) .FirstOrDefault(); return(g); }
public DeviceGPX GetDeviceGPX(int id) { var gpx = DeviceGPXCollection.Where(t => t.RowID == id).FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(id); } return gpx; }
public DeviceGPX GetDeviceGPX(GPS gps, DateTime month_year) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public bool AddRecordToRepo(DeviceGPX gpx) { int oldCount = DeviceGPXCollection.Count; if (gpx == null) { throw new ArgumentNullException("Error: The argument is Null"); } DeviceGPXCollection.Add(gpx); AddToDictionary(gpx.GPS, Entities.GPXFileViewModel.GetFile(gpx.GPS, gpx.Filename)); return(DeviceGPXCollection.Count > oldCount); }
public DeviceGPX GetDeviceGPX(GPS gps, string fileName) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .Where(t => t.Filename == Path.GetFileName(fileName)) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public DeviceGPX GetDeviceGPX(DeviceGPX deviceGPX) { var gpx = DeviceGPXCollection .Where(t => t.GPS.DeviceID == deviceGPX.GPS.DeviceID) .Where(t => t.Filename == deviceGPX.Filename) .FirstOrDefault(); if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } return gpx; }
public List<DeviceGPX> GetAllDeviceWaypointGPX() { var gpxes = DeviceGPXCollection.ToList(); foreach (var gpx in gpxes) { if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } } return gpxes; }
public List<DeviceGPX> GetAllDeviceWaypointGPX(GPS gps) { var gpxes = DeviceGPXCollection.Where(t => t.GPS.DeviceID == gps.DeviceID).ToList(); foreach (var gpx in gpxes) { if (gpx.GPX == "") { gpx.GPX = DeviceWaypointGPXes.getXML(gpx.RowID); } } return gpxes; }
public void DeleteRecordFromRepo(int rowID) { if (rowID == 0) throw new Exception("Record ID cannot be null"); int index = 0; while (index < DeviceGPXCollection.Count) { if (DeviceGPXCollection[index].RowID == rowID) { DeviceGPXCollection.RemoveAt(index); break; } index++; } }
public List<GPSDataSummary> GetGPSDataSummaries() { var list = new List<GPSDataSummary>(); var gpsUnits = Entities.GPSViewModel.GetAll(); foreach (var item in Entities.GPSViewModel.GetAll()) { int count500 = 0; int countLess500 = 0; var listTracks = DeviceGPXCollection .Where(t => t.GPS.DeviceID == item.DeviceID && t.GPXType == "track") .ToList(); foreach (var deviceGPX in listTracks) { foreach (var track in Entities.TrackViewModel.ReadTracksFromXML(deviceGPX)) { if (track.Statistics.Length <= 0.5) { ++countLess500; } else { ++count500; } } } var listWpts = DeviceGPXCollection .Where(t => t.GPS.DeviceID == item.DeviceID && t.GPXType == "waypoint") .ToList(); var summaryItem = new GPSDataSummary { GPS = item, NumberOfSavedTracks = listTracks.Count, NumberOfSavedWaypoints = listWpts.Count, NumberTrackLength500m = count500, NumberTrackLengthLess500m = countLess500 }; list.Add(summaryItem); } return list; }
public bool AddRecordToRepo(DeviceGPX gpx) { int oldCount = DeviceGPXCollection.Count; if (gpx == null) throw new ArgumentNullException("Error: The argument is Null"); DeviceGPXCollection.Add(gpx); if (_editSuccess) { GPXFile gpxFile = Entities.GPXFileViewModel.GetFile(gpx.GPS, gpx.Filename); if (gpxFile == null) { gpxFile = new GPXFile(gpx.Filename) { GPS = gpx.GPS, XML = gpx.GPX }; gpxFile.ComputeStats(gpx); Entities.GPXFileViewModel.Add(gpxFile); } AddToDictionary(gpx.GPS, gpxFile); } return DeviceGPXCollection.Count > oldCount; }
public List<DateTime> GetAllMonthYear(DateTime? startingDate = null) { DateTime earliest; if (startingDate == null) { earliest = DeviceGPXCollection.OrderBy(t => t.TimeRangeStart).First().TimeRangeStart; } else { earliest = (DateTime)startingDate; } var latest = DeviceGPXCollection.OrderByDescending(t => t.TimeRangeStart).First().TimeRangeStart; var dates = new List<DateTime>(); while (earliest <= latest) { dates.Add(new DateTime(earliest.Year, earliest.Month, 1)); earliest = earliest.AddMonths(1); } return dates; }
public DeviceGPX GetDeviceGPX(int id) { return(DeviceGPXCollection.Where(t => t.RowID == id).FirstOrDefault()); }
public DeviceGPX GetDeviceGPX(GPS gps) { return(DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .FirstOrDefault()); }
public DeviceGPX GetDeviceGPX(GPS gps, DateTime month_year) { return(DeviceGPXCollection .Where(t => t.GPS.DeviceID == gps.DeviceID) .FirstOrDefault()); }
public List <DeviceGPX> GetAllDeviceWaypointGPX() { return(DeviceGPXCollection.ToList()); }
public List <DeviceGPX> GetAllDeviceWaypointGPX(GPS gps) { return(DeviceGPXCollection.Where(t => t.GPS.DeviceID == gps.DeviceID).ToList()); }
public List<GPS> GetAllGPS() { return DeviceGPXCollection.GroupBy(t => t.GPS).Select(g => g.First().GPS).OrderBy(t => t.DeviceName).ToList(); }