Пример #1
0
        List <GeoLocationModel> GetData()
        {
            DateTime sdate = DateTime.Today;
            DateTime edate;

            if (txtdate.Text != "")
            {
                sdate = Utility.ConvertToDate(txtdate.Text);
            }
            edate = sdate.AddDays(1);
            List <GeoLocationModel> list = new System.Collections.Generic.List <GeoLocationModel>();

            using (var db = new SQLite.SQLiteConnection(pathToDatabase, true))
            {
                var geos = db.Table <GeoLocation> ().Where(x => x.Date >= sdate && x.Date <= edate).OrderBy(x => x.Date).ToList();
                foreach (var geo in geos)
                {
                    GeoLocationModel m = new GeoLocationModel();
                    m.Altitude = geo.Altitude;
                    m.Date     = geo.Date.ToString("dd-MM-yy hh:mm tt");
                    m.lat      = geo.lat;
                    m.lng      = geo.lng;
                    m.Desc     = geo.Date.ToString("dd-MM-yy hh:mm tt");
                    list.Add(m);
                }
            }

            return(list);
        }
Пример #2
0
        List<GeoLocationModel> GetData()
        {
            DateTime sdate =DateTime.Today;
            DateTime edate;
            if (txtdate.Text!="")
              sdate = Utility.ConvertToDate (txtdate.Text);
            edate = sdate.AddDays (1);
            List<GeoLocationModel> list= new System.Collections.Generic.List<GeoLocationModel>();
            using (var db = new SQLite.SQLiteConnection(pathToDatabase, true))
            {
                var geos = db.Table<GeoLocation> ().Where (x => x.Date >= sdate && x.Date <= edate).OrderBy (x => x.Date).ToList();
                    foreach(var geo in geos){
                    GeoLocationModel m = new GeoLocationModel ();
                    m.Altitude = geo.Altitude;
                    m.Date = geo.Date.ToString ("dd-MM-yy hh:mm tt");
                    m.lat = geo.lat;
                    m.lng = geo.lng;
                    m.Desc= geo.Date.ToString ("dd-MM-yy hh:mm tt");
                    list.Add (m);
                    }
            }

            return list;
        }