private void seat_select_button_Click_1(object sender, EventArgs e)
        {
            if (select_count > 1)
            {
                MessageBox.Show(select_count.ToString() + " seats selected. Please select only one seat");
            }
            else
            {
                SQLConnection.Instance.OpenConnection();

                MySqlCommand seatCommand     = new MySqlCommand("UPDATE Seat Set Available = 1 where FlightID = '" + flightNumber + "' AND classSeat = '" + Seat.getClassSeat() + "' AND Row = '" + jlocation + "' AND selectSeat = '" + ilocation + "';", SQLConnection.Instance.GetConnection());
                MySqlCommand findseatCommand = new MySqlCommand("select SeatID from Seat where FlightID = '" + flightNumber + "' AND classSeat = '" + Seat.getClassSeat() + "' AND Row = '" + jlocation + "' AND selectSeat = '" + ilocation + "';", SQLConnection.Instance.GetConnection());

                seatCommand.ExecuteNonQuery();
                Seat.setSeatPassenger(Convert.ToInt32(findseatCommand.ExecuteScalar()));

                //passengerID carrier //check
                MySqlCommand passengerEnter = new MySqlCommand("UPDATE Passenger Set SeatID = '" + Seat.getSeatPassenger() + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());
                passengerEnter.ExecuteNonQuery();

                //class into passenger table
                MySqlCommand passengerClass = new MySqlCommand("UPDATE Passenger Set Class = '" + Seat.getClassSeat() + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());
                passengerClass.ExecuteNonQuery();

                //updates flight to new flight
                MySqlCommand passengerFlight = new MySqlCommand("UPDATE Passenger Set FlightID = '" + flightNumber + "' where PassengerID = '" + PassengerID + "' ;", SQLConnection.Instance.GetConnection());
                passengerFlight.ExecuteNonQuery();

                SQLConnection.Instance.CloseConnection();

                //testing this
                //PassengerContainer.removePassengers();
                PassengerInfo.removePassengers();

                if (!PassengerInfo.emptyPassenger())
                {
                    this.Close();
                    Seating_Update another = new Seating_Update();
                }
                else
                {
                    Payment_Update payup = new Payment_Update();
                    this.Close();
                    //MessageBox.Show("Payment next");
                }
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            int seatID = Seat.randomSeat(Seat.getClassSeat(), airplaneTotaSeats, flightNumber);

            SQLConnection.Instance.OpenConnection();

            MySqlCommand seatCommand = new MySqlCommand("UPDATE Seat Set Available = 1 where SeatID = '" + seatID + "';", SQLConnection.Instance.GetConnection());

            seatCommand.ExecuteNonQuery();

            //passengerID carrier //check
            MySqlCommand passengerEnter = new MySqlCommand("UPDATE Passenger Set SeatID = '" + seatID + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());

            passengerEnter.ExecuteNonQuery();

            //class into passenger table
            MySqlCommand passengerClass = new MySqlCommand("UPDATE Passenger Set Class = '" + Seat.getClassSeat() + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());

            passengerClass.ExecuteNonQuery();

            //updates flight to new flight
            MySqlCommand passengerFlight = new MySqlCommand("UPDATE Passenger Set FlightID = '" + flightNumber + "' where PassengerID = '" + PassengerID + "' ;", SQLConnection.Instance.GetConnection());

            passengerFlight.ExecuteNonQuery();

            SQLConnection.Instance.CloseConnection();

            Price.Discount();

            PassengerInfo.removePassengers();

            if (!PassengerInfo.emptyPassenger())
            {
                this.Close();
                Seating_Update another = new Seating_Update();
            }
            else
            {
                Payment_Update payup = new Payment_Update();
                this.Close();
                //MessageBox.Show("Payment next");
            }
        }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            int seatID = Seat.randomSeat(Seat.getClassSeat(), airplaneTotaSeats, flightNumber);

            SQLConnection.Instance.OpenConnection();

            MySqlCommand seatCommand = new MySqlCommand("UPDATE Seat Set Available = 1 where SeatID = '" + seatID + "';", SQLConnection.Instance.GetConnection());

            //MySqlCommand findseatCommand = new MySqlCommand("select SeatID from Seat where FlightID = '" + FlightP.getFlightNumber() + "' AND classSeat = '" + Seat.getClassSeat() + "' AND Row = '" + jlocation + "' AND selectSeat = '" + ilocation + "';", SQLConnection.Instance.GetConnection());
            seatCommand.ExecuteNonQuery();
            //Seat.setSeatPassenger(Convert.ToInt32(findseatCommand.ExecuteScalar()));
            //Seat.setSeatPassenger(seatID);

            //passengerID carrier //check
            MySqlCommand passengerEnter = new MySqlCommand("UPDATE Passenger Set SeatID = '" + seatID + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());

            passengerEnter.ExecuteNonQuery();

            //class into passenger table
            MySqlCommand passengerClass = new MySqlCommand("UPDATE Passenger Set Class = '" + Seat.getClassSeat() + "'  where PassengerID = '" + PassengerID + "';", SQLConnection.Instance.GetConnection());

            passengerClass.ExecuteNonQuery();

            SQLConnection.Instance.CloseConnection();

            Price.Discount();

            PassengerContainer.removePassengers();

            if (!PassengerContainer.emptyPassenger())
            {
                this.Close();
                Seating nextperson = new Seating();
            }
            else
            {
                this.Close();
                Payment payhere = new Payment();
            }
        }