Esempio n. 1
0
        public static IEnumerable <SelectListItem> Routes()
        {
            var list = new List <SelectListItem>();

            routetDB = RouteDAO.GetRouteList();
            foreach (var item in routetDB)
            {
                var newItem = new SelectListItem()
                {
                    Value = item.RNo.ToString(), Text = string.Format("{0}-{1}: {2}({3}) -> {4}({5})", item.RAirline, item.RAircraft, item.DepartureAirport.AirportName, item.Departure, item.DestinationAirport.AirportName, item.Destination)
                };
                list.Add(newItem);
            }
            return(list);
        }
Esempio n. 2
0
        public static void InsertRoutes()
        {
            foreach (var distance in distanceDB)
            {
                var r       = new Route();
                var r2      = new Route();
                var randgen = new Random();

                r.RAircraft = RandomAircraft(distance.Distance).AircraftID.Trim();
                r.RAirline  = RandomAirline().AirlineID.Trim();

                r.Departure   = distance.AirportID1.Trim();
                r.Destination = distance.AirportID2.Trim();

                RouteDAO.AddRoute(r);

                r2.RAircraft = RandomAircraft(distance.Distance).AircraftID.Trim();
                r2.RAirline  = RandomAirline().AirlineID.Trim();

                r2.Departure   = distance.AirportID2.Trim();
                r2.Destination = distance.AirportID1.Trim();
                RouteDAO.AddRoute(r2);
            }
        }