def order_menu(): menu({ "1": { "info": "get all orders", "func": get_all_orders }, "2": { "info": "get order by id", "func": get_order_by_id }, "3": { "info": "search orders", "func": search_orders_menu }, "4": { "info": "update a order by id and column", "func": update_orders }, "5": { "info": "add a order", "func": add_order }, "6": { "info": "drop order by id", "func": drop_order_by_id } })
def car_menu(): menu({ "1": { "info": "get all cars", "func": get_all_cars }, "2": { "info": "get car by id", "func": get_car_by_id }, "3": { "info": "search cars", "func": search_cars_menu }, "4": { "info": "update a car by column", "func": update_car }, "5": { "info": "add a car", "func": add_car }, "6": { "info": "drop car by id", "func": drop_car_by_id } })
def customer_menu(): menu({ "1": { "info": "get all customers", "func": get_all_customers }, "2": { "info": "get customer by id", "func": get_customer_by_id }, "3": { "info": "get customers by name", "func": get_customers_by_name }, "4": { "info": "search customers", "func": search_customers_menu }, "5": { "info": "update a customer by id and column", "func": update_customer }, "6": { "info": "add a customer", "func": add_customer }, "7": { "info": "drop customer by id", "func": drop_customer_by_id } })
def employee_menu(): menu({ "1": { "info": "get all employees", "func": get_all_employees }, "2": { "info": "get employees by id", "func": get_employee_by_id }, "3": { "info": "get employees by name", "func": get_employee_by_name }, "4": { "info": "search employee", "func": search_employee_menu }, "5": { "info": "update a employee by id and column", "func": update_employee }, "6": { "info": "add a employee", "func": add_employee }, "7": { "info": "drop employee by id", "func": drop_employee_by_id } })
def shop_menu(): menu({ "1": { "info": "get all shops", "func": get_all_shops }, "2": { "info": "get shop by id", "func": get_shop_by_id }, "3": { "info": "search shop", "func": search_shop_menu }, "4": { "info": "update a shop by id and column", "func": update_shop }, "5": { "info": "update the list of employees", "func": update_employee_list }, "6": { "info": "add a shop", "func": add_shop }, "7": { "info": "drop shop by id", "func": drop_shop_by_id } })
def product_menu(): menu({ "1": { "info": "get all products", "func": get_all_products }, "2": { "info": "get product by id", "func": get_product_by_id }, "3": { "info": "get product by name", "func": get_product_by_name }, "4": { "info": "search products", "func": search_products_menu }, "5": { "info": "update a product by id", "func": update_product }, "6": { "info": "add product", "func": add_product }, "7": { "info": "delete product by id", "func": delete_product_by_id } })
def search_orders_menu(): def inner(column): return lambda: get_orders_by_columnvalue(column) menu({ str(i + 1): { "info": o, "func": inner(o) } for i, o in enumerate(oc.get_columns()) })
def search_cars_menu(): def inner(column): return lambda: get_cars_by_columnvalue(column) menu({ str(i + 1): { "info": c, "func": inner(c) } for i, c in enumerate(cc.get_columns()) })
def search_employee_menu(): def inner(column): return lambda: get_employee_by_columnvalue(column) menu({ str(i + 1): { "info": e, "func": inner(e) } for i, e in enumerate(ec.get_columns()) })
def search_products_menu(): def inner(column): return lambda: get_products_by_columnvalue(column) menu({ str(i + 1): { "info": p, "func": inner(p) } for i, p in enumerate(pc.get_columns()) })
def update_orders(): print("enter an order id: ") o_id = f_input() order = oc.get_order_by_id(o_id) def inner(column, order): return lambda: update_order_column(column, order) menu({ str(i + 1): { "info": o, "func": inner(o, order) } for i, o in enumerate(oc.get_columns()) })
def update_car(): print("enter a car id: ") c_id = f_input() car = cc.get_car_by_id(c_id) def inner(column, car): return lambda: update_car_column(column, car) menu({ str(i + 1): { "info": c, "func": inner(c, car) } for i, c in enumerate(cc.get_columns()) })
def update_shop(): print("enter a shop id: ") s_id = f_input() shop = sc.get_shop_by_id(s_id) def inner(column, shop): return lambda: update_shop_column(column, shop) menu({ str(i + 1): { "info": s, "func": inner(s, shop) } for i, s in enumerate(sc.get_columns()) })
def update_product(): print("enter a product id: ") p_id = f_input() product = pc.get_product_by_id(p_id) print(product) def inner(column, product): return lambda: update_product_column(column, product) menu({ str(i + 1): { "info": p, "func": inner(p, product) } for i, p in enumerate(pc.get_columns()) })
def update_employee(): get_all_employees() print('====================') print("enter an employee id: ") e_id = f_input() employee = ec.get_employee_by_id(e_id) def inner(column, employee): return lambda: update_employee_column(column, employee) menu({ str(i + 1): { "info": e, "func": inner(e, employee) } for i, e in enumerate(ec.get_columns()) })
def main_menu(): menu(main_menus)