def del_inventory(inventory_id, update_controls=[None]): ip = dp.InventoryProcessor(database) sql = ip.build_del_code(inventory_id=inventory_id) ip.execute_sql_code(sql) ip.db_con.commit() ip.db_con.close() if update_controls is not None: IOProcessor.sel_inventory(update_controls[0])
def del_inventory(inventory_id, update_controls=[None]): pp = DP.InventoryProcessor('Python210FinalDB.db') sql = pp.build_del_code(inventory_id=inventory_id) pp.execute_sql_code(sql) pp.db_con.commit() pp.db_con.close() if update_controls is not None: IOProcessor.sel_inventory(update_controls[0])
def ins_inventory(inventory_id, inventory_date, update_controls=[None]): pp = DP.InventoryProcessor('Python210FinalDB.db') sql = pp.build_ins_code(inventory_id=inventory_id, inventory_date=inventory_date) pp.execute_sql_code(sql) pp.db_con.commit() pp.db_con.close() if update_controls is None: IOProcessor.sel_inventory(update_controls[0]) if update_controls is not None: # Needs work, cannot allow inventory to repopulate new data IOProcessor.sel_inventory(update_controls[0])
def sel_inventory(text_widget): inventory = [] pp = DP.InventoryProcessor('Python210FinalDB.db') sql = pp.build_sel_code() for row in pp.execute_sql_code(sql): inventory.append(DM.Inventory(row[0], row[1])) pp.db_con.commit() pp.db_con.close() text_widget['state'] = 'normal' text_widget.delete(1.0, tk.END) if inventory is None: text_widget.insert("No data available") if inventory is not None: text_widget.insert(tk.END, "InventoryID | InventoryDate\n") for row in inventory: text_widget.insert(tk.END, str(row) + "\n") text_widget['state'] = 'disabled'
def sel_inventory(text_widget): inventory = [] ip = dp.InventoryProcessor(database) sql = ip.build_sel_code() for row in ip.execute_sql_code(sql): inventory.append(dm.Inventory(row[0], row[1])) ip.db_con.commit() ip.db_con.close() text_widget['state'] = 'normal' text_widget.delete(1.0, tk.END) if inventory is None: text_widget.insert("No data available") else: text_widget.insert(tk.END, "InventoryID,InventoryDate\n") for row in inventory: print(row, type(row)) text_widget.insert(tk.END, str(row) + "\n") text_widget['state'] = 'disabled'