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"); } }
private void SFlight_Click(object sender, EventArgs e) { if (FlightP.getFlightNumber() == 0) { getFirst(); } int newflight = FlightP.getFlightNumber(); ReserveP.setFlightNumber(ReserveP.getTicketID()); int oldflight = ReserveP.getFlightNumber(); //MessageBox.Show("Selected: 3:" + newflight.ToString() + " Reservation: 1:" + oldflight.ToString()); //keep user from entering same flight again if (newflight == oldflight) { MessageBox.Show("Please select a different flight."); Arrival_combobox.SelectedIndex = -1; Depart_Date.Value = System.DateTime.Now; int zero = 0; FlightP.setFlightNumber(zero); } else { // clear reservation seats from previous flight // load passengers to pick new seat on this flight clearSeats(); PassengerInfo.loadPassengersReserve(ReserveP.getTicketID()); Price.loadPrices(FlightP.getFlightNumber()); Price.resetDiscount(); Seating_Update newseats = new Seating_Update(); this.Close(); } }