Пример #1
0
        // get all the info for stops at a particular stations
        public IReadOnlyList<Stops> getAllStopsbyLocation(double latitude, double longitude)
        {
            List<Stops> stops = new List<Stops>();

              var query = from stop in m_CTA.Stops
                      where stop.Latitude == latitude && stop.Longitude == longitude
                      select stop;

              // if we did retrieve data
              if (query != null)
              {
            //format the data that was retrieved and add it to the list lines
            foreach (var row in query)
            {
              Stops newAdd = new Stops(Convert.ToInt32(row.StopID), Convert.ToInt32(row.StationID), Convert.ToString(row.Name), Convert.ToString(row.Direction), Convert.ToInt32(row.ADA), Convert.ToInt32(row.Latitude), Convert.ToInt32(row.Longitude));
              stops.Add(newAdd);
            }

            return stops;
              }

              return null;
        }
Пример #2
0
        // get all the info for stops at a particular stations
        public IReadOnlyList<Stops> getAllStopsbyStationID(int stationID)
        {
            // list that will contain stop objects
            List<Stops> stops = new List<Stops>();

            // query all stops' info
            var query = from stop in m_CTA.Stops
                        where stop.StationID == stationID
                        select stop;

            // if we did retrieve data
            if(query != null)
            {
                //format the data that was retrieved and add it to the list lines
                foreach (var row in query)
                {
                    Stops newAdd = new Stops(Convert.ToInt32(row.StopID), Convert.ToInt32(row.StationID), Convert.ToString(row.Name), Convert.ToString(row.Direction), Convert.ToInt32(row.ADA), Convert.ToInt32(row.Latitude), Convert.ToInt32(row.Longitude));
                    stops.Add(newAdd);
                }

                // return list
                return stops;
            }

            return null;
        }
Пример #3
0
        // get a particular stop's info by its stop id
        public Stops getStopInfo(int stopID)
        {
            var query = from stop in m_CTA.Stops
                        where stop.StopID == stopID
                        select stop;

            Stops stopInfo;

            if (query != null)
            {
                //format the data that was retrieved
                foreach (FinalProject.Stop row in query)
                {
                    stopInfo = new Stops(Convert.ToInt32(row.StopID), Convert.ToInt32(row.StationID), Convert.ToString(row.Name), Convert.ToString(row.Direction), Convert.ToInt32(row.ADA), Convert.ToDouble(row.Latitude), Convert.ToDouble(row.Longitude));
                    return stopInfo;
                }
            }
            return null;
        }