Exemplo n.º 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();
 }
Exemplo n.º 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)));
        }
Exemplo n.º 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();
 }
Exemplo n.º 4
0
        private async Task CacheStopPoint(CachedStopPoint stopPoint)
        {
            _stopPointCache.TryAdd(stopPoint.TriasIdStopPoint, stopPoint);
            var entity = new StopPoints
            {
                TriasIdStopPoint = stopPoint.TriasIdStopPoint,
                StopPointName    = stopPoint.StopPointName,
                Longitude        = stopPoint.Longitude,
                Latitude         = stopPoint.Latitude
            };

            await _databaseAdapter.InsertStopPoint(entity).ConfigureAwait(false);
        }
Exemplo n.º 5
0
 public Task InsertStopPoint(StopPoints entity) => DbOperation(async context =>
 {
     await context.StopPoints.AddAsync(entity).ConfigureAwait(false);
     await context.SaveChangesAsync().ConfigureAwait(false);
 });