Exemple #1
0
        public static void AddEdgesToDatabase(IEnumerable <MTR.BusinessLogic.Common.POCO.StopRouteStopEdge> edgeList)
        {
            using (var db = new EF_GtfsDbContext())
            {
                foreach (var edge in edgeList)
                {
                    var source      = db.Stops.First(s => s.Id == edge.StopId);
                    var destination = db.Stops.First(s => s.Id == edge.nextStopId);
                    var route       = db.Routes.First(r => r.Id == edge.RouteId);

                    db.StopEdges.Add(new EF_StopRouteStopEdge {
                        SourceStop      = source,
                        ViaRoute        = route,
                        DestinationStop = destination
                    });
                }
                db.SaveChanges();
            }
        }
Exemple #2
0
        public static void AddEdgesToDatabase(IEnumerable<MTR.BusinessLogic.Common.POCO.StopRouteStopEdge> edgeList)
        {
            using (var db = new EF_GtfsDbContext())
            {
                foreach (var edge in edgeList)
                {
                    var source = db.Stops.First(s => s.Id == edge.StopId);
                    var destination = db.Stops.First(s => s.Id == edge.nextStopId);
                    var route = db.Routes.First(r => r.Id == edge.RouteId);

                    db.StopEdges.Add(new EF_StopRouteStopEdge {
                        SourceStop = source,
                        ViaRoute = route,
                        DestinationStop = destination
                    });
                }
                db.SaveChanges();
            }
        }
Exemple #3
0
        public static void UpdateStopGroups(IEnumerable <MTR.BusinessLogic.Common.POCO.StopGroup> groups)
        {
            using (var db = new EF_GtfsDbContext())
            {
                var allStops = db.Stops.ToList();

                int i = 0;
                foreach (var sg in groups)
                {
                    i++;
                    foreach (var stop in sg.GetStops())
                    {
                        var subject = allStops.First(db_stop => db_stop.Id == stop.DbId);
                        subject.GroupId = i;
                        Console.WriteLine("stop.DbId = " + stop.DbId + " | group = " + i + " --> subject.GroupId = " + subject.GroupId);
                    }
                }
                db.SaveChanges();
            }
        }
Exemple #4
0
        public static void UpdateStopGroups(IEnumerable<MTR.BusinessLogic.Common.POCO.StopGroup> groups)
        {
            using (var db = new EF_GtfsDbContext())
            {
                var allStops = db.Stops.ToList();

                int i = 0;
                foreach (var sg in groups)
                {
                    i++;
                    foreach (var stop in sg.GetStops()) {
                        var subject = allStops.First(db_stop => db_stop.Id == stop.DbId);
                        subject.GroupId = i;
                        Console.WriteLine("stop.DbId = " + stop.DbId + " | group = " + i + " --> subject.GroupId = " + subject.GroupId);
                    }
                }
                db.SaveChanges();
            }
        }