예제 #1
0
def modify_room(room_num, new_room_num=None, new_capacity=None):
    if new_capacity:
        call = ("UPDATE TheatreRoom SET Capacity=%s WHERE RoomNumber=%s")
        db_connector.append_row(call, (new_capacity, room_num))

    if new_room_num:
        call = ("UPDATE TheatreRoom SET RoomNumber=%s WHERE RoomNumber=%s")
        db_connector.append_row(call, (new_room_num, new_capacity))
예제 #2
0
def modify_movie(movie_id, new_movie_name=None, new_movie_year=None):
    if new_movie_name:
        call = ("UPDATE Movie SET MovieName=%s WHERE idMovie=%s")
        db_connector.append_row(call, (new_movie_name, movie_id))

    if new_movie_year:
        call = ("UPDATE Movie SET MovieYear=%s WHERE idMovie=%s")
        db_connector.append_row(call, (new_movie_year, movie_id))
예제 #3
0
def modify_customer(customer_id,
                    new_fname=None,
                    new_lname=None,
                    new_email=None,
                    new_sex=None):
    if new_fname:
        call = ("UPDATE Customer SET FirstName=%s WHERE idCustomer=%s")
        db_connector.append_row(call, (new_fname, customer_id))

    if new_lname:
        call = ("UPDATE Customer SET LastName=%s WHERE idCustomer=%s")
        db_connector.append_row(call, (new_lname, customer_id))

    if new_email:
        call = ("UPDATE Customer SET EmailAddress=%s WHERE idCustomer=%s")
        db_connector.append_row(call, (new_email, customer_id))

    if new_sex:
        call = ("UPDATE Customer SET Sex=%s WHERE idCustomer=%s")
        db_connector.append_row(call, (new_sex, customer_id))
예제 #4
0
def modify_showing(showing_id,
                   new_date=None,
                   new_movie_id=None,
                   new_room_num=None,
                   new_price=None):
    if new_date:
        call = ("UPDATE Showing SET ShowingDateTime=%s WHERE idShowing=%s")
        db_connector.append_row(call, (new_date, showing_id))

    if new_movie_id:
        call = ("UPDATE Showing SET Movie_idMovie=%s WHERE idShowing=%s")
        db_connector.append_row(call, (new_movie_id, showing_id))

    if new_room_num:
        call = (
            "UPDATE Showing SET TheatreRoom_RoomNumber=%s WHERE idShowing=%s")
        db_connector.append_row(call, (new_room_num, showing_id))

    if new_price:
        call = ("UPDATE Showing SET TicketPrice=%s WHERE idShowing=%s")
        db_connector.append_row(call, (new_price, showing_id))
예제 #5
0
def delete_movie(movie_id):
    call = ("DELETE FROM Genre WHERE Movie_idMovie=%s")
    db_connector.append_row(call, (movie_id, ))

    call = ("DELETE FROM Movie WHERE idMovie=%s")
    db_connector.append_row(call, (movie_id, ))
예제 #6
0
def delete_showing(showing_id):
    call = ("DELETE FROM Showing WHERE idShowing=%s")
    db_connector.append_row(call, (showing_id, ))
예제 #7
0
def add_showing(date_time, movie_id, room_num, price):
    call = ("INSERT INTO Showing (ShowingDateTime, "
            "Movie_idMovie, TheatreRoom_RoomNumber, TicketPrice) "
            "VALUES(%s, %s, %s, %s)")
    db_connector.append_row(call, (date_time, movie_id, room_num, price))
예제 #8
0
def delete_room(room_num):
    call = ("DELETE FROM TheatreRoom WHERE RoomNumber=%s")
    db_connector.append_row(call, (room_num, ))
예제 #9
0
def add_room(room_num, capacity):
    call = ("INSERT INTO TheatreRoom (RoomNumber, Capacity)" "VALUES (%s, %s)")
    db_connector.append_row(call, (room_num, capacity))
예제 #10
0
def delete_genre(movie_id, genre):
    call = ("DELETE FROM Genre WHERE Movie_idMovie=%s AND Genre=%s")
    db_connector.append_row(call, (movie_id, genre))
예제 #11
0
def add_genre(movie_id, genre):
    call = ("INSERT INTO Genre (Genre, Movie_idMovie)" "VALUES (%s, %s)")
    db_connector.append_row(call, (genre, movie_id))
예제 #12
0
def add_movie(movie_name, movie_year):
    call = ("INSERT INTO Movie (MovieName, MovieYear)" "VALUES (%s, %s)")
    db_connector.append_row(call, (movie_name, movie_year))
예제 #13
0
def delete_customer(customer_id):
    call = ("DELETE FROM Customer WHERE idCustomer=%s")
    db_connector.append_row(call, (customer_id, ))
예제 #14
0
def add_customer(fname, lname, email, sex):
    call = ("INSERT INTO Customer (FirstName, LastName, EmailAddress, Sex) "
            "VALUES(%s, %s, %s, %s)")
    db_connector.append_row(call, (fname, lname, email, sex))
예제 #15
0
def rate_showing(customer_id, showing_id, rating):
    call = ("UPDATE Attend set rating=%s WHERE Customer_idCustomer=%s AND Showing_idShowing=%s")
    db_connector.append_row(call, (rating, customer_id, showing_id))
예제 #16
0
def attend_showing(customer_id, showing_id):
    call = ("INSERT INTO Attend (Customer_idCustomer, Showing_idShowing)"
            "VALUES (%s, %s)")
    db_connector.append_row(call, (customer_id, showing_id))