Exemplo n.º 1
0
        /// <summary>
        /// Method to sort list of airlines
        /// </summary>
        /// <param name="airlinesList"></param>
        /// <returns>A sorted custom collection</returns>
        private Airlines SortAirlines(List <Airline> airlineList)
        {
            //CSPRBUG18.3 - Implementing Custom Collection
            //Airlines - Custom Collection also Sorted with needed Interfaces
            Airlines airlines = new Airlines();

            foreach (Airline a in airlineList)
            {
                airlines.Add(a);
            }

            airlines.Sort();

            return(airlines);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets all the airlines from the database
 /// </summary>
 /// <exception cref="AirlineManagerException">Throws the exception when airlines is not available</exception>
 /// <returns>Returns the list of airlines</returns>
 public Airline[] GetAirLines()
 {
     //Airline[] airlines = null;
     try
     {
         Airlines airlines = new Airlines();
         airlines.AllAirlines = new List <Airline>();
         airlines.AllAirlines = airlineDAO.GetAirlines().ToList();
         airlines.AllAirlines.Sort();
         return(airlines.AllAirlines.ToArray());
     }
     catch (AirlineDAOException ex)
     {
         throw new AirlineManagerException("Unable to get airlines", ex);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Gets all the airlines from the database
        /// </summary>
        /// <exception cref="AirlineManagerException">Throws the exception when airlines is not available</exception>
        /// <returns>Returns the collection of airlines</returns>
        public Airlines GetSortedAirLines()
        {
            //CSPRBUG18.3 - Implementing Custom Collection
            //Airlines - Custom Collection also Sorted with needed Interfaces
            Airlines airlines = null;

            try
            {
                Airline[] airlineArray = airlineDAO.GetAirlines();

                airlines = SortAirlines(airlineArray.ToList());

                return(airlines);
            }
            catch (AirlineDAOException ex)
            {
                throw new AirlineManagerException("Unable to get airlines", ex);
            }
        }