def create(self):
     with DB() as db:
         values = (self.username, self.name, self.surname, self.password,
                   self.passcode)
         db.execute(
             'INSERT INTO admins (username, name, surname, password, passcode) VALUES (?, ?, ?, ?, ?)',
             values)
Example #2
0
 def create(self):
     with DB() as db:
         values = (self.name, self.surname, self.phone_number,
                   self.position, self.passcode)
         db.execute(
             '''INSERT INTO staff (name, surname, phone_number, position, passcode) VALUES (?, ?, ?, ?, ?)''',
             values)
Example #3
0
 def save(self):
     with DB() as db:
         values = (self.name, self.surname, self.phone_number,
                   self.position, self.passcode, self.id)
         db.execute(
             '''UPDATE staff SET name = ?, surname = ?, phone_number = ?, position = ?, passcode = ? WHERE id = ?''',
             values)
 def save(self):
     with DB() as db:
         values = (self.username, self.name, self.surname, self.password,
                   self.passcode, self.id)
         db.execute(
             'UPDATE admins SET username = ?, name = ?, surname = ?, password = ?, passcode = ? WHERE id = ?',
             values)
         return self
 def find_by_username(username):
     if not username:
         return None
     with DB() as db:
         row = db.execute('SELECT * FROM admins WHERE username = ?',
                          (username, )).fetchone()
         if row:
             return Admin(*row)
Example #6
0
 def save(self):
     with DB() as db:
         values = (self.name, self.surname, self.phone_number,
                   self.passcode, self.entry_date, self.expiry_date,
                   self.id)
         db.execute(
             '''UPDATE guests SET name = ?, surname = ?, phone_number = ?, passcode = ?, entry_date = ?, expiry_date = ?, WHERE id = ?''',
             values)
Example #7
0
 def create(self):
     with DB() as db:
         values = (
             self.name,
             self.surname,
             self.phone_number,
             self.passcode,
             self.entry_date,
             self.expiry_date,
         )
         db.execute(
             '''INSERT INTO guests (name, surname, phone_number, passcode, entry_date, expiry_date) VALUES (?, ?, ?, ?, ?, ?)''',
             values)
 def all_usernames():
     with DB() as db:
         rows = db.execute('SELECT * FROM admins').fetchall()
         return [Admin(*row).username for row in rows]
Example #9
0
 def find_by_id(id):
     with DB() as db:
         row = db.execute('SELECT * FROM guests WHERE id = ?',
                          (id, )).fetchone()
         return Guest(*row)
Example #10
0
 def all():
     with DB() as db:
         rows = db.execute('SELECT * FROM guests').fetchall()
         return [Guest(*row) for row in rows]
Example #11
0
 def find_by_id(id):
     with DB() as db:
         row = db.execute('SELECT * FROM staff WHERE id = ?',
                          (id, )).fetchone()
         return Staff(*row)
Example #12
0
 def all():
     with DB() as db:
         rows = db.execute('SELECT * FROM staff').fetchall()
         return [Staff(*row) for row in rows]
 def get_by_passcode(passcode):
     with DB() as db:
         row = db.execute('SELECT * FROM passcodes WHERE passcode = ?',
                          (passcode, )).fetchone()
         if row:
             return Passcode(*row)
 def all():
     with DB() as db:
         rows = db.execute('SELECT * FROM passcodes').fetchall()
         return [Passcode(*row).passcode for row in rows]
 def create(self):
     with DB() as db:
         values = (self.passcode, self.entry_date, self.expiry_date)
         row = db.execute(
             'INSERT INTO passcodes (passcode, entry_date, expiry_date) VALUES (?, ?, ?)',
             values)