Exemplo n.º 1
0
 def delete_projection(id):
     try:
         execute_query(DELETE_PROJECTION, [
             id,
         ], commit=True)
     except Exception:
         print("Database not initilized or connected")
Exemplo n.º 2
0
 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")
Exemplo n.º 3
0
 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")
Exemplo n.º 4
0
 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")
Exemplo n.º 5
0
 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")
Exemplo n.º 6
0
    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!")
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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")
Exemplo n.º 9
0
 def update_movie(id, name, rating):
     try:
         execute_query(UPDATE_MOVIE, [name, rating, id, ], commit=True)
     except Exception:
         print("Database not initilized or connected")
Exemplo n.º 10
0
 def delete_movie(id):
     try:
         execute_query(DELETE_MOVIE, [id, ], commit=True)
     except Exception:
         print("Database not initilized or connected")
Exemplo n.º 11
0
 def add_movie(name, rating):
     try:
         execute_query(INSERT_MOVIE, [name, rating, ], commit=True)
     except Exception:
         print("Database not initilized or connected")
Exemplo n.º 12
0
 def __init__(self):
     try:
         self.data = execute_query(SELECT_MOVIES_ORDERED_BY_RATING, [])
     except Exception:
         print("Database not initilized or connected")