def create_commodity_select(): name = StringVar() commodity_id = StringVar() price = StringVar() create_commodity_menu(commodity_id, name, price) def callback(): con.select_callback({(commodity_id.get(), 'commodity_id'), (name.get(), 'name'), (price.get(), 'price')}) con.create_button('select', callback, 1, 7)
def create_commodity_update(): name = StringVar() commodity_id = StringVar() price = StringVar() create_commodity_menu(commodity_id, name, price) def callback(): con.update_callback((commodity_id.get(), "commodity_id"), {(name.get(), "name"), (price.get(), "price")}) con.create_button('update', callback, 1, 7)
def create_order_update(): customer_id = StringVar() order_id = StringVar() assortment_id = StringVar() create_order_menu(customer_id, order_id, assortment_id) def callback(): con.update_callback((customer_id.get(), "customer_id"), {(order_id.get(), "order_id"), (assortment_id.get(), "assortment_id")}) con.create_button('update', callback, 1, 7)
def create_assortment_select(): assortment_id = StringVar() commodity_id = StringVar() shop_id = StringVar() create_assortment_menu(assortment_id, commodity_id, shop_id) def callback(): con.select_callback({(assortment_id.get(), 'assortment_id'), (commodity_id.get(), 'commodity_id'), (shop_id.get(), 'shop_id')}) con.create_button('select', callback, 1, 7)
def create_order_select(): customer_id = StringVar() order_id = StringVar() assortment_id = StringVar() create_order_menu(customer_id, order_id, assortment_id) def callback(): con.select_callback({(customer_id.get(), 'customer_id'), (order_id.get(), 'order_id'), (assortment_id.get(), 'assortment_id')}) con.create_button('select', callback, 1, 7)
def create_assortment_update(): assortment_id = StringVar() commodity_id = StringVar() shop_id = StringVar() create_assortment_menu(assortment_id, commodity_id, shop_id) def callback(): con.update_callback((assortment_id.get(), "assortment_id"), {(commodity_id.get(), "commodity_id"), (shop_id.get(), "shop_id")}) con.create_button('update', callback, 1, 7)
def create_shop_update(): shop_id = StringVar() monthly_profit = StringVar() address = StringVar() create_shop_menu(shop_id, monthly_profit, address) def callback(): con.update_callback((shop_id.get(), "shop_id"), {(monthly_profit.get(), "monthly_profit"), (address.get(), "address")}) con.create_button('update', callback, 1, 7)
def create_shop_select(): shop_id = StringVar() monthly_profit = StringVar() address = StringVar() create_shop_menu(shop_id, monthly_profit, address) def callback(): con.select_callback({(shop_id.get(), 'shop_id'), (monthly_profit.get(), 'monthly_profit'), (address.get(), 'address')}) con.create_button('select', callback, 1, 7)
def create_customer_select(): customer_id = StringVar() name = StringVar() raiting = StringVar() worker_id = StringVar() create_customer_menu(customer_id, name, raiting, worker_id) def callback(): con.select_callback({(customer_id.get(), 'customer_id'), (name.get(), 'name'), (raiting.get(), 'raiting'), (worker_id.get(), 'worker_id')}) con.create_button('select', callback, 1, 8)
def create_action_menu(table_name): if len(con.current_table) != 0: remove_unused_elements() con.current_table = table_name con.change_color(con.clicked_color_change[con.current_table]) def select_callback(): remove_unused_elements() select_creators[con.current_table]() def insert_callback(): remove_unused_elements() insert_creators[con.current_table]() def delete_callback(): remove_unused_elements() create_delete_menu() def update_callback(): remove_unused_elements() update_creators[con.current_table]() con.create_button("Select", select_callback, 1, 3) con.create_button("Insert", insert_callback, 2, 3) con.create_button("Delete", delete_callback, 3, 3) con.create_button("Update", update_callback, 4, 3)
def create_customer_update(): customer_id = StringVar() name = StringVar() raiting = StringVar() worker_id = StringVar() create_customer_menu(customer_id, name, raiting, worker_id) def callback(): con.update_callback( (customer_id.get(), "customer_id"), {(raiting.get(), "name"), (raiting.get(), "raiting"), (worker_id.get(), "worker_id")}) con.create_button('update', callback, 1, 8)
def create_shop_insert(): shop_id = StringVar() monthly_profit = StringVar() address = StringVar() create_shop_menu(shop_id, monthly_profit, address) def insert_callback(): status, result = con.execute_query( con.insert_query.format(table=con.current_table, values="({0},{1},{2})".format( shop_id.get(), monthly_profit.get(), address.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 7)
def create_order_insert(): customer_id = StringVar() order_id = StringVar() assortment_id = StringVar() create_order_menu(customer_id, order_id, assortment_id) def insert_callback(): status, result = con.execute_query( con.insert_query.format(table=con.current_table, values="({0},{1},{2})".format( order_id.get(), customer_id.get(), assortment_id.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 7)
def create_assortment_insert(): assortment_id = StringVar() commodity_id = StringVar() shop_id = StringVar() create_assortment_menu(assortment_id, commodity_id, shop_id) def insert_callback(): status, result = con.execute_query( con.insert_query.format(table=con.current_table, values="({0},{1},{2})".format( assortment_id.get(), commodity_id.get(), shop_id.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 7)
def create_worker_select(): worker_id = StringVar() shop_id = StringVar() name = StringVar() surname = StringVar() position = StringVar() create_worker_menu(worker_id, shop_id, name, surname, position) def callback(): con.select_callback({(worker_id.get(), 'worker_id'), (shop_id.get(), 'shop_id'), (name.get(), 'name'), (surname.get(), 'surname'), (position.get(), 'position')}) con.create_button('select', callback, 1, 9)
def create_customer_insert(): customer_id = StringVar() name = StringVar() raiting = StringVar() worker_id = StringVar() create_customer_menu(customer_id, name, raiting, worker_id) def insert_callback(): status, result = con.execute_query( con.insert_query.format(table=con.current_table, values="({0},{1},{2},{3})".format( customer_id.get(), raiting.get(), worker_id.get(), name.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 8)
def create_worker_update(): worker_id = StringVar() shop_id = StringVar() name = StringVar() surname = StringVar() position = StringVar() create_worker_menu(worker_id, shop_id, name, surname, position) def callback(): con.update_callback( (worker_id.get(), "worker_id"), {(shop_id.get(), "shop_id"), (name.get(), "name"), (surname.get(), "surname"), (position.get(), "position")}) con.create_button('update', callback, 1, 9)
def create_commodity_insert(): name = StringVar() commodity_id = StringVar() price = StringVar() create_commodity_menu(commodity_id, name, price) def insert_callback(): status, result = con.execute_query( con.insert_query.format( table=con.current_table, values="({commodity_id},{name},{price})".format( commodity_id=commodity_id.get(), name=name.get(), price=price.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 7)
def create_worker_insert(): worker_id = StringVar() shop_id = StringVar() name = StringVar() surname = StringVar() position = StringVar() create_worker_menu(worker_id, shop_id, name, surname, position) def insert_callback(): status, result = con.execute_query( con.insert_query.format(table=con.current_table, values="({0},{1},{2},{3},{4})".format( worker_id.get(), shop_id.get(), name.get(), surname.get(), position.get()))) con.text_label['text'] = status con.create_button('insert', insert_callback, 1, 9)
def create_delete_menu(): remove_unused_elements() delete_part_fields = { con.Assortment_str: 'assortment_id', con.Commodity_str: 'commodity_id', con.Order_str: 'order_id', con.Worker_str: 'worker_id', con.Shop_str: 'shop_id', con.Customer_str: 'customer_id' } current_field_name = delete_part_fields[con.current_table] value = StringVar() def delete_statement(): status, result = con.execute_query( con.delete_query.format(table=con.current_table, field=current_field_name, value=value.get())) con.text_label['text'] = status con.create_label(current_field_name, label_height, 2, 1, 4, 1, 1, "white") con.create_entry(value, 2, 4) con.create_button('delete', delete_statement, 1, 5)
def create_menu_for_task1(): con.create_button(con.Assortment_str, assortment_table_use, 1, 2) con.create_button(con.Commodity_str, commodity_table_use, 2, 2) con.create_button(con.Customer_str, customer_table_use, 3, 2) con.create_button(con.Order_str, order_table_use, 4, 2) con.create_button(con.Shop_str, shop_table_use, 5, 2) con.create_button(con.Worker_str, worker_table_use, 6, 2)