def delete_projection(id): try: execute_query(DELETE_PROJECTION, [ id, ], commit=True) except Exception: print("Database not initilized or connected")
def add_projection(movie_id, movie_type, date): try: execute_query(INSERT_PROJECTION, [ movie_id, movie_type, date, ], commit=True) except Exception: print("Database not initilized or connected")
def update_projection(id, movie_id, movie_type, date): try: execute_query(UPDATE_PROJECTION, [ movie_id, movie_type, date, id, ], commit=True) except Exception: print("Database not initilized or connected")
def get_taken_seats(id): try: return execute_query(SELECT_AVAILABLE_SEATS, [ id, ]) except Exception as e: print(e) print("Could not get the taken seats")
def __init__(self, movie_id, projection_date): try: self.data = execute_query(SELECT_PROJECTION_ORDERED_BY_DATE, [ movie_id, projection_date, projection_date + " " + SharedVariables.end_of_day, ]) except Exception: print("Database not initilized or connected")
def movie_projections(id): try: data = execute_query(SELECT_PROJECTION_FOR_MOVIE, [id, ]) t = PrettyTable(SharedVariables.projection_col) for row in data: t.add_row([row[0], row[1], row[2], row[3], (100 - row[4])]) return str(t) except Exception: print("Database not initilized or connected!")
def get_movie(id): try: data = execute_query(SELECT_MOVIE_BY_ID, [id, ]) except Exception: print("Database not initilized or connected") t = PrettyTable(SharedVariables.movie_col) for row in data: t.add_row([row[0], row[1], row[2]]) return str(t)
def get_projection(id): try: data = execute_query(SELECT_PROJECTION_BY_ID, [ id, ]) t = PrettyTable( ['Projection ID', 'Movie ID', 'Movie Type', 'Date Time']) for row in data: t.add_row([row[0], row[1], row[2], row[3]]) return str(t) except Exception: print("Database not initilized or connected")
def update_movie(id, name, rating): try: execute_query(UPDATE_MOVIE, [name, rating, id, ], commit=True) except Exception: print("Database not initilized or connected")
def delete_movie(id): try: execute_query(DELETE_MOVIE, [id, ], commit=True) except Exception: print("Database not initilized or connected")
def add_movie(name, rating): try: execute_query(INSERT_MOVIE, [name, rating, ], commit=True) except Exception: print("Database not initilized or connected")
def __init__(self): try: self.data = execute_query(SELECT_MOVIES_ORDERED_BY_RATING, []) except Exception: print("Database not initilized or connected")