Exemplo n.º 1
0
 def dropTable(self):
     print("----Drop Table----")
     with DatabaseUtils() as db:
         if(db.dropTable()):
             print("dropped successfully.")
         else:
             print("didn't drop.")
Exemplo n.º 2
0
 def listCars(self):
     print("--- Cars ---")
     print("{:<15} {}".format("carId", "Make"))
     with DatabaseUtils() as db:
         for person in db.getCars():
             #print("{:<15} {}".format(person[0]))
             print(person)
Exemplo n.º 3
0
 def deletePerson(self):
     print("--- Delete Person ---")
     id = input("Enter the person's ID: ")
     with DatabaseUtils() as db:
         if(db.deletePerson(id)):
             print("{} deleted successfully.".format(id))
         else:
             print("{} failed to delete user.".format(id))
Exemplo n.º 4
0
 def insertPerson(self):
     print("--- Insert Person ---")
     name = input("Enter the person's name: ")
     with DatabaseUtils() as db:
         if(db.insertPerson(name)):
             print("{} inserted successfully.".format(name))
         else:
             print("{} failed to be inserted.".format(name))
Exemplo n.º 5
0
 def deleteCar(self):
     print("--- Delete Car ---")
     id = input("Enter the car's ID: ")
     with DatabaseUtils() as db:
         if(db.deleteCar(id)):
             print("{} deleted successfully.".format(id))
         else:
             print("{} failed to delete car.".format(id))
Exemplo n.º 6
0
 def insertCar(self):
     print("--- Insert Car ---")
     carId = input("Enter the car's id: ")
     make = input("Enter the car's make: ")
     body = input("Enter the car's body type: ")
     colour = input("Enter the car's colour: ")
     seats = input("Enter the car's seat number: ")
     location = input("Enter the car's location: ")
     cost = input("Enter the car's cost per hour: ")
     bookedBy = input("Enter the car's current owner, blank if no one: ")
     
     with DatabaseUtils() as db:
         if(db.insertCar(carId, make, body, colour, seats, location, cost, bookedBy)):
             print("{} inserted successfully.".format(make))
         else:
             print("{} failed to be inserted.".format(make))
Exemplo n.º 7
0
 def listPeople(self):
     print("--- People ---")
     print("{:<15} {}".format("Person ID", "Name"))
     with DatabaseUtils() as db:
         for person in db.getPeople():
             print("{:<15} {}".format(person[0], person[1]))
Exemplo n.º 8
0
 def main(self):
     with DatabaseUtils() as db:
         db.createBookingsTable()
     self.runMenu()