Example #1
0
        public DetailRouteViewModel(TimeTableModel route)
        {
            _viewId = Guid.NewGuid();
            db      = new BusStationContext();

            idRoute            = route.idRoute;
            isEdit             = false;
            NameDeparturePlace = route.DeparturePlace;
            NameArrivalPlace   = route.ArrivalPlace;
            CostRoute          = Convert.ToDecimal(route.Cost);

            timesList = new ObservableCollection <TimeSpan>();

            foreach (var item in route.DepartureTime.OrderBy(i => i))
            {
                timesList.Add(item);
            }

            selectedTime = timesList[0] == null ? default(TimeSpan) : timesList[0];

            stopsList = new ObservableCollection <Stop>();
            foreach (var item in route.StopList)
            {
                stopsList.Add(new Stop()
                {
                    Id   = item.Id,
                    Name = item.Name,
                    Cost = item.Cost
                });
            }
        }
        public PassengerViewModel()
        {
            _viewId = Guid.NewGuid();
            db      = new BusStationContext();
            Fio     = "";

            DateOfBirth = new DateTime(1980, 1, 1);
        }
Example #3
0
 public RolesRepository(BusStationContext busStationContext)
 {
     _busStationContext = busStationContext;
 }
Example #4
0
        public TimeTableViewModel()
        {
            //var db = new BusStationContext();
            //Route route = new Route();

            startCities = new List <Point>();
            endCities   = new ObservableCollection <Point>();
            endStations = new ObservableCollection <Point>();
            trips       = new ObservableCollection <TimeTableModel>();
            db          = new BusStationContext();
            foreach (var route in db.Route.ToList().Select(i => new TimeTableModel(i)).ToList())
            {
                trips.Add(route);
            }

            var allCities = db.Route.ToList();

            foreach (var city in allCities)
            {
                startCities.Add(new Point()
                {
                    Id     = city.IdRoute,
                    Name   = city.Departure_place,
                    isCity = true
                });

                endCities.Add(new Point()
                {
                    Id       = city.IdRoute,
                    Name     = city.Arrival_place,
                    isCity   = true,
                    DepPlace = city.Departure_place
                });
            }

            var allStation = db.Route_Station.ToList();

            foreach (var start in startCities)
            {
                foreach (var station in allStation)
                {
                    if (start.Name == station.Route.Departure_place)
                    {
                        endCities.Add(new Point()
                        {
                            Id       = station.IdRoute_FK,
                            Name     = station.Station.Name,
                            isCity   = false,
                            DepPlace = station.Route.Departure_place
                        });
                    }
                }
            }

            startCities     = startCities.Distinct(new CityComparer()).ToList();
            SelectStartCity = startCities[0];
            SelectEndCity   = EndCities[0];
            NameStop        = "";
            CostStop        = "";

            /*cities = new List<string>()
             *  {
             *      "Шуя", "Иваново", "Москва"
             *  };*/
            stops = new ObservableCollection <Stop>();
            times = new ObservableCollection <TimeSpan>();
        }
 public ReportViewModel()
 {
     db = new BusStationContext();
 }
 public JourneysController(BusStationContext context)
 {
     _context = context;
 }
Example #7
0
 public CitiesAPIController(BusStationContext context)
 {
     _context = context;
 }
 public RouteStopsRepository(BusStationContext context)
 {
     _busStationContext = context;
 }
Example #9
0
 public BusModelsController(BusStationContext context)
 {
     _context = context;
 }
Example #10
0
 public TimeTablesRepository(BusStationContext context)
 {
     _busStationContext = context;
 }
Example #11
0
 public ReservationsController(BusStationContext context)
 {
     _context = context;
 }
        public FindTicketViewModel()
        {
            availableTrips = new ObservableCollection <AvailableTrip>();
            _viewId        = Guid.NewGuid();
            startCities    = new List <Point>();
            endCities      = new ObservableCollection <Point>();
            endStations    = new ObservableCollection <Point>();

            passangers = new List <PassangerModel>();
            db         = new BusStationContext();
            var allCities = db.Route.ToList();
            int ind       = 0;

            foreach (var city in allCities)
            {
                startCities.Add(new Point()
                {
                    Id     = city.IdRoute,
                    Name   = city.Departure_place,
                    isCity = true
                });

                endCities.Add(new Point()
                {
                    Id       = city.IdRoute,
                    Name     = city.Arrival_place,
                    isCity   = true,
                    DepPlace = city.Departure_place
                });
            }

            //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).ToList())
            //{
            //    startCities.Add(cities);
            //}

            //.Join(db.Route_Station, r => r.IdRoute, rs => rs.IdRS, (r, rs) => new { route = r, routeStation = rs })
            //.Join(db.Station, rs => rs.routeStation.IdStation_Fk, s => s.IdStation, (rs, s) => new { rs = rs, stations = s })
            //.GroupBy(s => s.stations.Name)

            var allStation = db.Route_Station.ToList();

            foreach (var start in startCities)
            {
                foreach (var station in allStation)
                {
                    if (start.Name == station.Route.Departure_place)
                    {
                        endCities.Add(new Point()
                        {
                            Id       = station.IdRoute_FK,
                            Name     = station.Station.Name,
                            isCity   = false,
                            DepPlace = station.Route.Departure_place
                        });
                    }
                }
            }

            startCities     = startCities.Distinct(new CityComparer()).ToList();
            SelectStartCity = startCities[0];
            SelectEndCity   = EndCities[0];
            DepartureDate   = DateTime.Today;
            PassengerNumber = 1;
            //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).GroupBy(x => x.EndCities).Select(j => j.First()).ToList())
            //{
            //    endStations.Add(cities);
            //}

            //foreach (var cities in db.Route.ToList().Select(i => new FindTicketModel(i)).GroupBy(x => x.EndCities).Select(j => j.First()).ToList())
            //{
            //    endCities.Add(cities);
            //}

            //foreach (var item in endStations)
            //{
            //    endCities.Add(item);
            //}
        }
Example #13
0
 public TypeStopsRepository(BusStationContext busStationContext)
 {
     _busStationContext = busStationContext;
 }
Example #14
0
 public ClientsController(BusStationContext context)
 {
     _context = context;
 }
Example #15
0
 public UnitOfWorkService(string connectionString)
 {
     _busStationContext = new BusStationContext(connectionString);
 }
Example #16
0
 public OrdersRepository(BusStationContext context)
 {
     _busStationContext = context;
 }
Example #17
0
 public RoutesController(BusStationContext context)
 {
     _context = context;
 }
Example #18
0
 public UsersRepository(BusStationContext busStationContext)
 {
     _busStationContext = busStationContext;
 }