def insert(card): DAO.insert( "INSERT INTO cards (username, expiration_date, balance, is_blocked) VALUES ('{}', '{}', {}, '{}')" .format(card.username, card.expiration_date, card.balance, card.is_blocked))
def add_ticket(ticket): seat = ticket.seat DAO.insert( "INSERT INTO tickets (price, match_id, block, row, place) VALUES ({}, {}, {}, {}, {})" .format(ticket.price, ticket.match.id, seat.block, seat.row, seat.place))
def register(person, creator="NULL"): DAO.insert( "INSERT INTO person (username, first_name, last_name, age, role, password, creator) VALUES ('{}', '{}', '{}', {}, '{}', '{}', '{}')" .format(person.username, person.first_name, person.last_name, person.age, person.role, PersonDAO.encrypt_password(person.password), creator))
def add_match(match): DAO.insert( "INSERT INTO matches (host, guest, match_date, organizer, match_type) VALUES ('{}', '{}', '{}', '{}', '{}')" .format(match.host_team, match.guest_team, match.date, match.organizer, match.match_type)) return MatchDAO.get_max_match_id()