Esempio n. 1
0
        public void SaveTrackToDB(Android.Locations.Location location)
        {
            if (location == null)
            {
                return;
            }

            DateTime dtDateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
            dtDateTime = dtDateTime.AddMilliseconds(location.Time).ToLocalTime();

            var track = new Tracks();
            track.Latitude = location.Latitude.ToString();
            track.Longitude = location.Longitude.ToString();
            track.Imei = DeviceIMEI.GetDeviceId(this);
            track.GpsTime = dtDateTime;
            track.Speed = System.Math.Round(1.9438444924406D * (double)location.Speed).ToString();
            track.Head = "0";
            track.Valid = "1";
            track.Accuracy = location.Accuracy.ToString();
            track.Altitude = location.Altitude.ToString();
            track.Bearing = location.Bearing.ToString();
            TracksRepository.SaveTrack(track);


        }
 public static int SaveTrack(Tracks item)
 {
     return me.db.SaveTrack(item);
 }
Esempio n. 3
0
 //        public int DeleteTracks(int id)
 //        {
 //            lock (locker) {
 //                return Delete<Tracks> (new Tracks () { Id = id });
 //            }
 //        }
 public int DeleteTrack(Tracks Tracks)
 {
     lock (locker)
     {
         return Delete<Tracks>(Tracks.Id);
     }
 }
 public static int DeleteTrack(Tracks item)
 {
     return me.db.DeleteTrack(item);
 }
Esempio n. 5
0
 public int SaveTrack(Tracks item)
 {
     lock (locker)
     {
         if (item.Id != 0)
         {
             Update(item);
             return item.Id;
         }
         else
         {
             return Insert(item);
         }
     }
 }