private void AddRouteDetail(RouteDetail routeDetail, Route route)
        {
            var stops = from stop in db.Stops
                        from routeStop in db.RouteStops
                        orderby routeStop.StopSequence
                        where (routeStop.StopID == stop.ID) && (routeStop.RouteID == route.ID)
                        select stop;

            foreach (var stop in stops)
            {
                routeDetail.Stops.Add(new StopSummary(stop));
            }

            var shapes = from shape in db.Shapes
                        orderby shape.Sequence
                        where (shape.RouteID == route.ID)
                        select shape;

            foreach (var shape in shapes)
            {
                var coordinate = new Location();
                coordinate.Lat = shape.Lat;
                coordinate.Lon = shape.Lon;
                routeDetail.RoutePath.Add(coordinate);
            }
        }
        private void AddRouteDetail(RouteDetail routeDetail, Route route)
        {
            var stops = from stop in db.Stops
                        from routeStop in db.RouteStops
                        orderby routeStop.StopSequence
                        where (routeStop.StopID == stop.ID) && (routeStop.RouteID == route.ID)
                        select stop;

            foreach (var stop in stops)
            {
                // Use arrival times if available
                var stopWithArrivalTime = StopArrivalTime.GetStopSummaryWithArrivalTimes(stop.ID);
                if (stopWithArrivalTime != null)
                {
                    routeDetail.Stops.Add(stopWithArrivalTime);
                }
                else
                {
                    routeDetail.Stops.Add(new StopSummary(stop));
                }
            }

            var shapes = from shape in db.Shapes
                        orderby shape.Sequence
                        where (shape.RouteID == route.ID)
                        select shape;

            foreach (var shape in shapes)
            {
                var coordinate = new Location();
                coordinate.Lat = shape.Lat;
                coordinate.Lon = shape.Lon;
                routeDetail.RoutePath.Add(coordinate);
            }
        }
 public RouteSummary(Route route)
 {
     this.ID = route.ID;
     this.ShortName = route.ShortName;
     this.LongName = route.LongName;
     this.Description = route.Description;
     this.FlagStopsOnly = route.FlagStopsOnly;
 }
        public RouteDetail(Route route)
        {
            this.ID = route.ID;
            this.ShortName = route.ShortName;
            this.LongName = route.LongName;
            this.Description = route.Description;
            this.FlagStopsOnly = route.FlagStopsOnly;

            this.RoutePath = new List<Location>();
            this.Stops = new List<StopSummary>();
        }
        /// <summary>
        /// Create sorted route list, with first item representing null entry choice as ID=-1
        /// </summary>
        /// <param name="nullLabel"></param>
        /// <returns></returns>
        private List<Route> RouteSelectList(string nullLabel)
        {
            var routeList = db.Routes.OrderBy(r => r.ShortName).ToList();

            var nullRoute = new Route();
            nullRoute.ID = -1;
            nullRoute.ShortName = nullLabel;
            routeList.Insert(0, nullRoute);
            return routeList;
        }