Beispiel #1
0
        /// <summary>
        /// Gets a list of flight objects of all current flights in the database.
        /// </summary>
        /// <returns></returns>
        public List <clsFlight> GetAllFlights()
        {
            List <clsFlight> flights = new List <clsFlight>();

            try
            {
                DataSet ds   = new DataSet();
                int     iRet = 0;

                ds = clsData.ExecuteSQLStatement(sql.GetAllFlights(), ref iRet);

                for (int i = 0; i < iRet; ++i)
                {
                    clsFlight flight = new clsFlight();
                    flight.FlightID   = Convert.ToInt32(ds.Tables[0].Rows[i][0].ToString());
                    flight.FlightNum  = Convert.ToInt32(ds.Tables[0].Rows[i][1].ToString());
                    flight.FlightType = ds.Tables[0].Rows[i][2].ToString();
                    flights.Add(flight);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "." + MethodInfo.GetCurrentMethod().Name + " -> " + ex.Message);
            }

            return(flights);
        }
        private void cbChooseFlight_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                selFlight = (clsFlight)cbChooseFlight.SelectedItem;

                cbChoosePassenger.IsEnabled  = true;
                gPassengerCommands.IsEnabled = true;
                if (selFlight.FlightID == 1)
                {
                    CanvasA380.Visibility = Visibility.Hidden;
                    Canvas767.Visibility  = Visibility.Visible;
                }
                else
                {
                    Canvas767.Visibility  = Visibility.Hidden;
                    CanvasA380.Visibility = Visibility.Visible;
                }
                cbChoosePassenger.ItemsSource = null;
                cbChoosePassenger.ItemsSource = Flightman.GetFlightPassengers(selFlight.FlightID);

                //colorSeats(selFlight.FlightID);
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Gets the flight information from the database and returns a list of LFight objects
        /// </summary>
        /// <returns></returns>
        public List <clsFlight> GetFlights()
        {
            try
            {
                DataSet   ds;
                clsFlight FlightOne;

                string sSQL;
                int    iCount = 0;

                // Get the Flight information from the database.
                sSQL = "Select * FROM Flight";
                ds   = db.ExecuteSQLStatement(sSQL, ref iCount);

                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    FlightOne               = new clsFlight();
                    FlightOne.FlightID      = ((int)ds.Tables[0].Rows[i][0]);
                    FlightOne.Flight_Number = ds.Tables[0].Rows[i][1].ToString();
                    FlightOne.Aircraft_Type = ds.Tables[0].Rows[i][2].ToString();
                    Flights.Add(FlightOne);
                }// End For

                return(Flights);
            }
            catch (Exception ex)
            {
                throw new Exception(MethodInfo.GetCurrentMethod().DeclaringType.Name + "-" + MethodInfo.GetCurrentMethod().Name + "->" + ex.Message);
            }
        }
        public MainWindow()
        {
            try
            {
                InitializeComponent();
                Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;

                wndAddPass = new wndAddPassenger();
                Flightman  = new clsFlightManager();
                selFlight  = new clsFlight();
                cbChooseFlight.ItemsSource = Flightman.GetFlights();
            }
            catch (Exception ex)
            {
                HandleError(MethodInfo.GetCurrentMethod().DeclaringType.Name,
                            MethodInfo.GetCurrentMethod().Name, ex.Message);
            }
        }