Ejemplo n.º 1
0
        /// <summary>
        /// Gets the flight routes
        /// </summary>
        /// <exception cref="RouteManagerException">Thrown when unable to get routes</exception>
        /// <returns>Returns a collection with all the route information</returns>
        public Route[] GetRoutes()
        {
            Route[] routes = null;

            try
            {
                routes = routeDAO.GetRoutes();
                return(routes);
            }
            catch (RouteDAOException ex)
            {
                throw new RouteManagerException("Unable to get routes", ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the flight routes
        /// </summary>
        /// <exception cref="RouteManagerException">Thrown when unable to get routes</exception>
        /// <returns>Returns a list with all the route information</returns>
        public List <Route> GetRoutes()
        {
            try
            {
                DataSet dsDS = routeDAO.GetRoutes();


                var routes = from route in dsDS.Tables[0].AsEnumerable().Distinct()
                             orderby route["DistanceInKms"]
                             select new Route
                {
                    ID            = Convert.ToInt64(route["RouteId"]),
                    FromCity      = CityDAOFactory.GetInstance().CreateCity().GetCityById(Convert.ToInt64(route["FromCityId"])),
                    ToCity        = CityDAOFactory.GetInstance().CreateCity().GetCityById(Convert.ToInt64(route["ToCityId"])),
                    DistanceInKms = Convert.ToDouble(route["DistanceInKms"]),
                    IsActive      = Convert.ToBoolean(route["Status"])
                };

                return(routes.ToList <Route>());
            }
            catch (RouteDAOException ex)
            {
                throw new RouteManagerException("Unable to get routes", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the flight routes
        /// </summary>
        /// <exception cref="RouteManagerException">Thrown when unable to get routes</exception>
        /// <returns>Returns a list with all the route information</returns>
        public List <Route> GetRoutes()
        {
            List <Route> routes = null;

            try
            {
                DataSet dsDS = routeDAO.GetRoutes();

                routes = new List <Route>();
                foreach (DataRow rw in dsDS.Tables[0].Rows)
                {
                    Route r = new Route();

                    r.ID            = Convert.ToInt64(rw["RouteId"]);
                    r.FromCity      = CityDAOFactory.GetInstance().CreateCity().GetCityById(Convert.ToInt64(rw["FromCityId"]));
                    r.ToCity        = CityDAOFactory.GetInstance().CreateCity().GetCityById(Convert.ToInt64(rw["ToCityId"]));
                    r.DistanceInKms = Convert.ToDouble(rw["DistanceInKms"]);
                    r.IsActive      = Convert.ToBoolean(rw["Status"]);

                    routes.Add(r);
                }

                return(routes);
            }
            catch (RouteDAOException ex)
            {
                throw new RouteManagerException("Unable to get routes", ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the flight routes
        /// </summary>
        /// <exception cref="RouteManagerException">Thrown when unable to get routes</exception>
        /// <returns>Returns a collection with all the route information</returns>
        public List <Route> GetRoutes()
        {
            List <Route> routes1 = null;

            try
            {
                routes1 = routeDAO.GetRoutes().ToList();

                routes1.Sort();

                return(routes1);
            }
            catch (RouteDAOException ex)
            {
                throw new RouteManagerException("Unable to get routes", ex);
            }
        }