Пример #1
0
 def read(self):
     rows = Repository().read(self.filename)
     locations = [
         Location(row['country'], row['airport'], row['phone'],
                  row['hours'], row['id']) for row in rows
     ]
     return locations
 def read(self):
     rows = Repository().read(self.filename)
     vehicletypes = [
         VehicleType(row['name'], row['location_id'], row['rate'],
                     row['id']) for row in rows
     ]
     return vehicletypes
Пример #3
0
def get_image_repository():
    """1 repository instance"""
    global image_repository
    if image_repository:
        return image_repository
    else:
        image_repository = Repository('images')
        return image_repository
 def read(self):
     rows = Repository().read(self.filename)
     users = [
         Employee(row['role'], row['name'], row['address'], row['postal'],
                  row['ssn'], row['phone'], row['homephone'], row['email'],
                  row['location_id'], row['id']) for row in rows
     ]
     return users
 def read(self):
     rows = Repository().read(self.filename)
     customers = [
         Customer(row['name'], row['address'], row['postal'], row['ssn'],
                  row['phone'], row['email'], row['country'], row['id'])
         for row in rows
     ]
     return customers
 def read(self):
     rows = Repository().read(self.filename)
     vehicles = [
         Vehicle(row['manufacturer'], row['model'], row['vehicle_type_id'],
                 row['status'], row['man_year'], row['color'],
                 row['licence_type'], row['location_id'], row['id'])
         for row in rows
     ]
     return vehicles
Пример #7
0
 def create(self, location: Location):
     row = dict((key, getattr(location, key)) for key in self.fieldnames)
     Repository().create(self.filename, self.fieldnames, row)
     return location
Пример #8
0
 def delete(self, id) -> None:
     return Repository().delete(self.filename, self.fieldnames, id)
Пример #9
0
 def update(self, id, updates: dict):
     return Repository().update(self.filename, self.fieldnames, id, updates)
Пример #10
0
 def read(self):
     rows = Repository().read(self.filename)
     contracts = [Contract(row['customer_id'], row['vehicle_id'], row['employee_id'], row['location_id'], row['date_from'], row['date_to'], row['contract_date'], row['contract_status'], row['pickup_date'], row['dropoff_date'], row['total'], row['paid'], row['id']) for row in rows]
     return contracts
Пример #11
0
 def create(self, contract: Contract):
     row = dict((key, getattr(contract, key)) for key in self.fieldnames)
     Repository().create(self.filename, self.fieldnames, row)
     return contract
 def create(self, vehicle: Vehicle):
     row = dict((key, getattr(vehicle, key)) for key in self.fieldnames)
     Repository().create(self.filename, self.fieldnames, row)
     return vehicle
 def create(self, employee: Employee):
     row = dict((key, getattr(employee, key)) for key in self.fieldnames)
     Repository().create(self.filename, self.fieldnames, row)
     return employee
 def create(self, customer: Customer):
     row = dict((key, getattr(customer, key)) for key in self.fieldnames)
     new_row = Repository().create(self.filename, self.fieldnames, row)
     customer.set_id(new_row['id'])
     return customer