示例#1
0
 def get_by_id(card_id):
     result = DAO.select(
         "SELECT * FROM cards WHERE id = {}".format(card_id))
     if len(result) == 0:
         raise FanIDCardNotFoundError(
             "Fan ID Card {} does not exist".format(card_id))
     return result[0]
示例#2
0
 def get_card_by_username(username):
     result = DAO.select(
         "SELECT * FROM cards WHERE username = '******'".format(username))
     if len(result) == 0:
         raise UsernameNotFoundError(
             "Username {} was not found in the system".format(username))
     return result[0]
示例#3
0
 def does_exist(username):
     result = DAO.select(
         "SELECT * FROM person WHERE username = '******'".format(username))
     return len(result) > 0
示例#4
0
 def get_role_by_username(username):
     result = DAO.select(
         "SELECT role FROM person WHERE username = '******'".format(username))
     return result[0][0]
示例#5
0
 def is_password_correct(username, password):
     encrypted_password = PersonDAO.encrypt_password(password)
     result = DAO.select(
         "SELECT * FROM person WHERE username = '******' and password = '******'".
         format(username, encrypted_password))
     return len(result) != 0
示例#6
0
 def get_by_id(username):
     result = DAO.select(
         "SELECT * FROM person WHERE username = '******'".format(username))
     if len(result) == 0:
         raise UsernameNotFoundError("Username was not found")
     return result[0]
示例#7
0
 def get_available_tickets_id_and_seats_and_price(match_id):
     return DAO.select(
         "SELECT id, block, row, place, price FROM tickets WHERE match_id = {} AND card_id is NULL ORDER BY id"
         .format(match_id))
示例#8
0
 def get_max_match_id():
     max_match_id = DAO.select("SELECT MAX(id) FROM matches")[0][0]
     return max_match_id
示例#9
0
 def does_exist(ticket_id):
     result = DAO.select(
         "SELECT * FROM tickets WHERE id = {}".format(ticket_id))
     return len(result) > 0
示例#10
0
 def get_tickets_id_by_card_id(card_id):
     return DAO.select(
         "SELECT id FROM tickets WHERE card_id = {} ORDER BY id".format(
             card_id))
示例#11
0
 def get_by_id(ticket_id):
     return DAO.select(
         "SELECT * FROM tickets WHERE id = {}".format(ticket_id))[0]
示例#12
0
 def does_exist(match_id):
     result = DAO.select(
         "SELECT * FROM matches WHERE id = {}".format(match_id))
     return len(result) > 0
示例#13
0
 def get_matches():
     return DAO.select("SELECT * FROM matches ORDER BY id")
示例#14
0
 def does_exist(card_id):
     result = DAO.select(
         "SELECT * FROM cards WHERE id = {}".format(card_id))
     return len(result) > 0
示例#15
0
 def get_paid_money(match_id):
     result = DAO.select(
         "SELECT card_id, price FROM tickets WHERE match_id = {}".format(
             match_id))
     return result
示例#16
0
 def get_max_card_id():
     max_card_id = DAO.select("SELECT MAX(id) FROM cards")[0][0]
     return max_card_id
示例#17
0
 def get_by_id(match_id):
     return DAO.select(
         "SELECT * FROM matches WHERE id = {}".format(match_id))[0]