コード例 #1
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 = airlineDAO.GetAirlines();
         return(airlines);
     }
     catch (AirlineDAOException ex)
     {
         throw new AirlineManagerException("Unable to get airlines", ex);
     }
 }
コード例 #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 List <Airline> GetAirLines()
        {
            List <Airline> airlines = null;

            try
            {
                DataSet ds = airlineDAO.GetAirlines();

                airlines = new List <Airline>();

                foreach (DataRow rw in ds.Tables[0].Rows)
                {
                    Airline airline = new Airline();

                    airline.Id   = Convert.ToInt32(rw["AirlineId"]);
                    airline.Name = rw["AirlineName"].ToString();
                    airline.Code = rw["AirlineCode"].ToString();
                    airline.Logo = rw["AirlineLogo"].ToString();

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

            return(airlines);
        }
コード例 #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 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);
     }
 }
コード例 #4
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 List <Airline> GetAirLines()
        {
            try
            {
                DataSet ds     = airlineDAO.GetAirlines();
                var     result = from airline in ds.Tables[0].AsEnumerable().Distinct()
                                 orderby airline["AirlineName"]

                                 select new Airline
                {
                    Id   = Convert.ToInt32(airline["AirlineId"]),
                    Name = airline["AirlineName"].ToString(),
                    Code = airline["AirlineCode"].ToString(),
                    Logo = airline["AirlineLogo"].ToString()
                };

                return(result.ToList <Airline>());
            }
            catch (AirlineDAOException ex)
            {
                throw new AirlineManagerException("Unable to get airlines", ex);
            }
        }