def get_car_by_id(): print("Enter a id") c_id = f_input() car = cc.get_car_by_id(c_id) if car: print_tablerow(car) else: print("not found")
def add_car(): insert_dict = {} for column in cc.get_columns(): if column != "id": insert_dict[column] = input(f'{column}: ') car = cc.add_car(insert_dict) if car: print_tablerow(car) divider() return car
def combine_customer_car(customer_id, car_id): insert_dict = {"CustomerId": customer_id, "CarId": car_id} for column in cc.get_columns(): if column != "CustomerId" and column != "CarId": insert_dict[column] = input(f'{column}: ') divider() customer_car = cc.add_customer_car(insert_dict) if customer_car: refresh_row(customer_car) print_tablerow(customer_car)
def add_customer_car(): insert_dict = {} for column in cc.get_columns(): insert_dict[column] = input(f'{column}: ') divider() customer_car = cc.add_customer_car(insert_dict) if customer_car: refresh_row(customer_car) print_tablerow(customer_car) divider()
def create_contact_person(): print('Add contact persons information') print('===============================') insert_dict = {} for column in cpc.get_columns(): if column != "id": insert_dict[column] = input(f'{column}: ') contact_person = cpc.add_cp(insert_dict) if contact_person: print_tablerow(contact_person) return contact_person
def add_associate(): insert_dict = {} for column in ac.get_columns(): if column != "id": insert_dict[column] = input(f'{column}: ') if column == 'contact_person_id': contact_person = create_contact_person() insert_dict[column] = contact_person.id divider() associate = ac.add_associate(insert_dict) if associate: print_tablerow(associate)
def show_associate_by_id(): print("Enter an Associate Id") a_id = f_input() associate = ac.show_associate_by_id(a_id) if associate: print_tablerow(associate) cp_id = associate.contact_person_id print(f'Do you want to show >{associate.name}s< contact person?\n' '1: Yes\n' '2: No') if int(f_input()) == 1: contact_person = cpc.show_cp_by_id(cp_id) print_tablerow(contact_person) else: return
def add_customer(): def inner(customer): return lambda: add_customer_car(customer) insert_dict = {} for column in cc.get_columns(): if column != "id": insert_dict[column] = input(f'{column}: ') divider() customer = cc.add_customer(insert_dict) if customer: print_tablerow(customer) menu({ "1": { "info": "add car", "func": inner(customer) } })
def get_customers_cars(): customer = get_customer_by_id() customers_cars = cc.get_customers_cars(customer.id) print_tablerow(customers_cars[0].Customer) for join_info in customers_cars: print_tablerow(join_info.Car) print_tablerow(join_info.CustomerCar)
def get_order_by_id(): print("Enter a Order Id") c_id = f_input() order = cc.get_order_by_id(c_id) print_tablerow(order)
def update_car_column(column, car): print("Enter new value: ") value = f_input() cc.update_car_column(car, column, value) print_tablerow(car)
def update_storage_column(column, storage): print("Enter new value: ") value = f_input() cc.update_storage_column(storage, column, value) print_tablerow(storage)
def update_associate_column(column, associate): print("Enter new value: ") value = f_input() ac.update_associate_column(associate, column, value) print_tablerow(associate)
def update_employee_column(column, employee): print("Enter new value: ") value = f_input() cc.update_employee_column(employee, column, value) print_tablerow(employee)
def update_product_internal_order_column(column, product_internal_order): print("Enter new value: ") value = f_input() cc.update_product_internal_order_column(product_internal_order, column, value) print_tablerow(product_internal_order)
def show_customer_by_id(): customer = get_customer_by_id() print_tablerow(customer)
def main(): customer = join_test(1) for c in customer: uf.print_tablerow(c.Car) uf.print_tablerow(c.Customer)
def update_order_column(column, order): print("Enter new value: ") value = f_input() cc.update_order_column(order, column, value) print_tablerow(order)
def update_compatibility_column(column, compatibility): print("Enter new value: ") value = f_input() cc.update_compatibility_column(compatibility, column, value) print_tablerow(compatibility)
def get_employee_by_id(): print("Enter a Employee Id") c_id = f_input() employee = cc.get_employee_by_id(c_id) print_tablerow(employee)
def get_storage_by_id(): print("Enter a Storage Id") c_id = f_input() storage = cc.get_storage_by_id(c_id) print_tablerow(storage)
def get_internal_order_by_id(): print("Enter a InternalOrder Id") c_id = f_input() internal_order = cc.get_internal_order_by_id(c_id) print_tablerow(internal_order)
def update_contact_person_column(column, contact_person): print("Enter new value: ") value = f_input() cpc.update_cp_column(contact_person, column, value) print_tablerow(contact_person)
def update_product_associate_column(column, product_associate): print("Enter new value: ") value = f_input() cc.update_product_associate_column(product_associate, column, value) print_tablerow(product_associate)
def get_compatibility_by_id(): print("Enter a Compatibility Id") c_id = f_input() compatibility = cc.get_compatibility_by_id(c_id) print_tablerow(compatibility)