Example #1
0
        private static IEnumerable<Shape> GetShapes(string id, Route route)
        {
            List<Shape> shapes = new List<Shape>();

            string query = string.Format("select distinct ShapeId from (select *, (select top 1 t.RouteId from dbo.Trips t where t.ShapeId = s.ShapeId) as RouteId from dbo.Shapes s) z where z.RouteId = '{0}'", id);
            DataTable shapeTable = Database.SelectQuery(query);

            foreach (DataRow row in shapeTable.Rows)
            {
                string shapeId = Convert.ToString(row["ShapeId"]);
                Shape shape = new Shape(shapeId, route.Id);
                shape.Trips = GetTrips(shapeId, shape).ToList();

                shapes.Add(shape);
            }

            return shapes;
        }
Example #2
0
 public bool Equals(Route other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Id.EqualsIgnoreCase(Id);
 }
Example #3
0
        private static IEnumerable<Route> GetRoutes()
        {
            List<Route> routes = new List<Route>();

            const string query = "select * from dbo.Routes";
            DataTable routeTable = Database.SelectQuery(query);

            foreach (DataRow row in routeTable.Rows)
            {
                string id = Convert.ToString(row["RouteId"]);
                Route route = new Route(id);
                route.Shapes = GetShapes(id, route).ToList();

                routes.Add(route);
            }

            return routes;
        }