def __init__(self, database_name): self.db = DbClass(database_name) # todo self.create_all_tables() self.load()
def main(): db = DbClass('attend5.db') db.print_user_info('admin1') db.print_user_info('admin1', False) db2 = DbClass('testAttend.db') db2.create_date_table() db2.create_leaves_table() db2.create_presents_table() db2.create_table_person() pass
class AttendanceDatabaseBuilder: def __init__(self, database_name): self.db = DbClass(database_name) # todo self.create_all_tables() self.load() def show_table(self, option=2, uid=None, filter2=False): self.db.show_table(option, uid, filter2) def create_all_tables(self): # person self.db.create_table_person() # date self.db.create_date_table() # presents self.db.create_presents_table() # leaves self.db.create_leaves_table() pass def does_super_admin_exist(self): return self.db.does_super_admin_exist() def create_base_admin(self): self.db.create_base_admin() def load(self): self.db.insert_date(TODAY) table = self.db.get_person_table() for entry in table: if entry[5] == 1: SuperAdmins[entry[0]] = (SuperAdmin(entry[0], entry[1], entry[2], entry[3], self.db)) if entry[4] == 1: Admins[entry[0]] = (Admin(entry[0], entry[1], entry[2], entry[3], self.db)) elif entry[4] == 0: Employees[entry[0]] = (Employee(entry[0], entry[1], entry[2], entry[3], self.db)) print('For testing, List of all admins and Employees:') print(Admins) print(Employees) def insert_date(self, date): self.db.insert_date(date)
def __init__(self, database_name): self.db = DbClass(database_name) self.load()