def btn_click_saveFlight(
    save_Btn, user
):  #..............................................................................
    save_Btn.config(state='disabled')
    save_Btn.config(text="Flight Created!")

    date = global_year_entry + "-" + global_mon_entry + "-" + global_day_entry

    db.create_flights(global_airline_Name, date, global_time_entry,
                      global_from_Airport, global_to_Airport,
                      global_capacity_entry, global_fare_entry, 'ON-TIME')
import DB_UTIL as db
#import numpy as np

con = db.db_connect()

#"""
#Here, I simply test the functionality of the DB. Give it a shot
db.create_flights('MANEMARS', '3030-30-30', '22:30:30', 'Area51', 'MarsRover', 1, 0, 'ON-TIME')
a = db.get_Flights('To_Airport')
print(a)

#db.queryexec("DELETE FROM Cust_Flight;")
#con.commit()

#print(db.book_a_flight('paul', 1, 'GUI'))
#print(db.book_a_flight('paul', 420, 'SEARCH'))
db.cancel_flight_admin(420)

#Now check reservations
print('\n\n')
print(db.get_full_user_reservation('paul'))

db.cancel_reservation_passenger('paul', 420)
print(db.get_full_user_reservation('paul'))

#"""
#Lets test my new work here
#for i in range(1, 10):
#print(db.get_user_reservation('paul'))
#flight_from_jfk = db.queryexec("SELECT * FROM Flights WHERE From_Airport = 'KJFK-New York' ORDER BY Airline_Name ASC")
#print(flight_from_jfk)
예제 #3
0
import randdata as rd
conobj = DB_UTIL.db_connect() #Connect to the DB

#So now that we're connected, lets start adding things.

#for i in range(0, len(customers)):
#    DB_UTIL.create_customer(conobj, customers[i])

for i in range(0, len(rd.airports)):
    DB_UTIL.create_airports(rd.airports[i][0], rd.airports[i][1], rd.airports[i][2])

for i in range(0, len(rd.airlines)):
    DB_UTIL.create_airlines(rd.airlines[i])

for i in range(0, len(rd.flights)):
    DB_UTIL.create_flights(rd.flights[i][0], rd.flights[i][1], rd.flights[i][2], rd.flights[i][3], rd.flights[i][4], rd.flights[i][5], rd.flights[i][6], rd.flights[i][7])

#Now, lets see if we've successfully added all these to the DB.

print(DB_UTIL.queryexec('SELECT * FROM Flights')) #This is hardcoded SQL, not the best way to do this, but it'll give us a glimpse at whether this works or not. Do avoid sing this though.

"""
If console returns something like:
$ python ex1.py
2.6.0
[(1, 'Paul', 'Pluszczewicz'), (2, 'Martin', 'Sendrowicz'), (3, 'Mohammed', 'Rahat'), (4, 'Sateesh', 'Mane'), (5, 'Joe', 'Schmo'), (6, 'Duncan', 'Donut'), (7, 'Bill', 'Gates')]

This means all is working well. Excellent!
"""
#conobj.commit()
conobj.close()