private void changePayment(int num)
        {
            string ticket = ReserveP.getTicketID();
            int    total  = Price.getReserveAmount(ticket);
            int    fareID = Price.getReserveFareID(ticket);
            string seatclass;

            SQLConnection.Instance.OpenConnection();

            MySqlCommand sclass = new MySqlCommand("Select Class from Passenger where PassengerID = '" + num + "';", SQLConnection.Instance.GetConnection());

            seatclass = (string)sclass.ExecuteScalar();

            seatclass = getClassName(seatclass);

            int          flight;
            MySqlCommand findflight = new MySqlCommand("Select FlightID from Fare where FareID = '" + fareID + "';", SQLConnection.Instance.GetConnection());

            flight = Convert.ToInt32(findflight.ExecuteScalar());

            int          subtotal;
            MySqlCommand findClass = new MySqlCommand("Select " + seatclass + " from Flight where FlightID = '" + flight + "';", SQLConnection.Instance.GetConnection());

            subtotal = Convert.ToInt32(findClass.ExecuteScalar());

            total = total - subtotal;

            MySqlCommand updateFare = new MySqlCommand("UPDATE Fare set Amount = '" + total + "' where FareID = '" + fareID + "';", SQLConnection.Instance.GetConnection());

            updateFare.ExecuteNonQuery();

            SQLConnection.Instance.CloseConnection();
        }
Ejemplo n.º 2
0
        private static void deleteReservation()
        {
            PassengerInfo.loadPassengersReserve(ticketID);
            fareID = Price.getReserveFareID(ticketID);

            SQLConnection.Instance.OpenConnection();

            fillPassengers();
            removeReservation(ticketID);
            removeFare(fareID);

            SQLConnection.Instance.CloseConnection();


            MessageBox.Show("Reservation Succesfully Removed.");
        }
Ejemplo n.º 3
0
        private void next_payment_button_Click(object sender, EventArgs e)
        {
            int fareID = Price.getReserveFareID(ticket);

            SQLConnection.Instance.OpenConnection();

            MySqlCommand updateFare = new MySqlCommand("UPDATE Fare set Amount = '" + totalPayment + "' where FareID = '" + fareID + "';", SQLConnection.Instance.GetConnection());

            updateFare.ExecuteNonQuery();

            MySqlCommand updateReserve = new MySqlCommand("UPDATE Reserve set FlightID = '" + FlightP.getFlightNumber() + "' where ticketNo = '" + ticket + "';", SQLConnection.Instance.GetConnection());

            updateReserve.ExecuteNonQuery();

            SQLConnection.Instance.CloseConnection();

            fillEmail();
            MessageBox.Show("Email Confirmation of Flight Change will be shortly send");

            Account back = new Account();

            this.Close();
        }