Exemple #1
0
 public MatchRead(GpsRead read)
 {
     Included = true;
     Read = read;
 }
        public List<GpsRead> GetPoints(string device, DateTime start, DateTime end)
        {
            List<GpsRead> points = new List<GpsRead>();

            DataTable pointTable = Database.StoredProcedure("GetGpsCapture", new SqlParameter("DeviceName", device),
                                                                             new SqlParameter("StartDate", start),
                                                                             new SqlParameter("EndDate", end));

            foreach (DataRow row in pointTable.Rows)
            {
                DateTime date = Convert.ToDateTime(row["Date"]);
                string stopName = row["StopId"].ToString();
                double distance = Convert.ToDouble(row["Distance"]);
                double latitude = Convert.ToDouble(row["Latitude"]);
                double longitude = Convert.ToDouble(row["Longitude"]);

                GpsRead point = new GpsRead(date, stopName, distance, new Point(latitude, longitude));
                points.Add(point);
            }

            return points;
        }