Пример #1
0
 public void TestQueryWithId(string idToFind)
 {
     var saQuery     = StopAreas.Where(obj => obj.Id == idToFind).ToList();
     var linesQuery  = Lines.Where(obj => obj.Id == idToFind).ToList();
     var routesQuery = Routes.Where(obj => obj.Id == idToFind).ToList();
     var spQuery     = StopPoints.Where(obj => obj.Id == idToFind).ToList();
 }
Пример #2
0
        public void TestQueryWithStopAreaId(string idToFind)
        {
            var saQuery     = StopAreas.Where(obj => obj.Id == idToFind).ToList();
            var linesQuery  = Lines.Where(obj => obj.Routes != null && obj.Routes.Any(r => r.Direction.StopArea.Id == idToFind)).ToList();
            var routesQuery = Routes.Where(obj => obj.Direction.StopArea.Id == idToFind).ToList();
            var spQuery     = StopPoints.Where(obj => obj.StopArea.Id == idToFind).ToList();

            var routeSchedulesQueryFromMemory = LineRouteSchedules.SelectMany(rs => rs.Value).Where(rs => rs.Table.Rows.Any(r => r.StopPoint.StopArea.Id == idToFind)).ToList();

            List <Table>             tables         = new List <Table>();
            List <List <StopPoint> > listStopPoints = new List <List <StopPoint> >();
            HashSet <StopPoint>      stopPoints     = new HashSet <StopPoint>();

            foreach (RouteSchedule routeSchedule in routeSchedulesQueryFromMemory)
            {
                // Get all stop points. Line is stopping at stop area
                var stopPointsQuery = routeSchedule.Table.Rows.Select(r => r.StopPoint);

                stopPoints.UnionWith(stopPointsQuery);
                listStopPoints.Add(new List <StopPoint>(stopPointsQuery));
                tables.Add(routeSchedule.Table);
            }
            HashSet <string> journeys = new HashSet <string>();

            routeSchedulesQueryFromMemory.ForEach(rs => journeys.UnionWith(ExtractVehiculeJourneysFromRouteSchedule(rs)));
        }
Пример #3
0
 public void TestQueryWithStopName(string str2Find)
 {
     var saQuery     = StopAreas.Where(obj => obj.Name.ToUpper().Contains(str2Find)).ToList();
     var spQuery     = StopPoints.Where(obj => obj.Name.ToUpper().Contains(str2Find)).ToList();
     var linesQuery  = Lines.Where(obj => obj.Routes != null && obj.Routes.Any(r => r.Direction.Name.ToUpper().Contains(str2Find))).ToList();
     var routesQuery = Routes.Where(obj => obj.Direction.Name.ToUpper().Contains(str2Find)).ToList();
 }
Пример #4
0
        public Dictionary <string, HashSet <StopPoint> > GetAllStopPointsForLinesStoppingAtStopArea(string idToFind)
        {
            var saQuery = StopAreas.Where(obj => obj.Id == idToFind).ToList();

            Debug.Assert(saQuery.Any(), "No stop area with this Id !");

            //var routeSchedulesQueryFromMemory = LineRouteSchedules.SelectMany(rs => rs.Value).Where(rs => rs.Table.Rows.Any(r => r.StopPoint.StopArea.Id == idToFind)).ToList();

            Dictionary <string, HashSet <StopPoint> > v_ret = new Dictionary <string, HashSet <StopPoint> >();
            List <Table>             tables         = new List <Table>();
            List <List <StopPoint> > listStopPoints = new List <List <StopPoint> >();
            HashSet <StopPoint>      stopPoints     = new HashSet <StopPoint>();

            foreach (KeyValuePair <string, List <RouteSchedule> > routeSchedulesByLineId in LineRouteSchedules)
            {
                foreach (RouteSchedule routeSchedule in routeSchedulesByLineId.Value)
                {
                    if (routeSchedule.Table.Rows.Any(r => r.StopPoint.StopArea.Id == idToFind))
                    {
                        // Get all stop points. Line is stopping at stop area
                        var stopPointsQuery = routeSchedule.Table.Rows.Select(r => r.StopPoint);

                        stopPoints.UnionWith(stopPointsQuery);
                        listStopPoints.Add(new List <StopPoint>(stopPointsQuery));
                        tables.Add(routeSchedule.Table);

                        if (!v_ret.ContainsKey(routeSchedulesByLineId.Key))
                        {
                            v_ret.Add(routeSchedulesByLineId.Key, new HashSet <StopPoint>());
                        }
                        v_ret[routeSchedulesByLineId.Key].UnionWith(stopPoints);
                    }
                }
            }

            return(v_ret);
        }