예제 #1
0
    def sel_inventorycounts(text_widget):
        inventorycounts = []
        pp = DP.InventoryCountProcessor('Python210FinalDB.db')
        sql = pp.build_sel_code()
        for row in pp.execute_sql_code(sql):
            inventorycounts.append(DM.InventoryCount(row[0], row[1], row[2]))
        pp.db_con.commit()
        pp.db_con.close()

        text_widget['state'] = 'normal'
        text_widget.delete(1.0, tk.END)

        if inventorycounts is None:
            text_widget.insert("No data available")

        if inventorycounts is not None:
            text_widget.insert(tk.END, "Inventory ID | Product ID | Count\n")
            for row in inventorycounts:
                text_widget.insert(tk.END, str(row) + "\n")
        text_widget['state'] = 'disabled'
예제 #2
0
    def sel_inventory_count(text_widget):
        inventory_count = []
        icp = dp.InventoryCountProcessor(database)
        sql = icp.build_sel_code()
        for row in icp.execute_sql_code(sql):
            inventory_count.append(dm.InventoryCount(row[0], row[1], row[2]))
        icp.db_con.commit()
        icp.db_con.close()

        text_widget['state'] = 'normal'
        text_widget.delete(1.0, tk.END)

        if inventory_count is None:
            text_widget.insert("No data available")
        else:
            text_widget.insert(tk.END, "InventoryID,ProductID,Count\n")
            for row in inventory_count:
                print(row, type(row))
                text_widget.insert(tk.END, str(row) + "\n")

        text_widget['state'] = 'disabled'
예제 #3
0
    "CREATE TABLE InventoryCounts (InventoryID int, ProductID int, Count int);"
)
icp.db_con.commit()
icp.execute_sql_code(
    icp.build_ins_code(inventory_id=11011, product_id=1, count=25))
icp.db_con.commit()
icp.execute_sql_code(
    icp.build_ins_code(inventory_id=11011, product_id=2, count=15))
icp.db_con.commit()

# print(icp.build_sel_code())
iclst = []

for product in plst:
    for tbl_row in crs.execute(icp.build_sel_code()):
        iclst.append(dm.InventoryCount(tbl_row[0], product, tbl_row[2]))
print(iclst)

# for f, b in zip(plst, crs.execute(icp.build_sel_code())):
#     # print(f, b)
#     iclst.append(dm.InventoryCount(plst[0], b[2]))
# print(iclst)
# icp.db_con.commit()
# icp.db_con.close()

# ip = dp.InventoryProcessor(':memory:')
#
# # Create table for testing
# crs = ip.db_con.cursor()
# crs.execute("CREATE TABLE Inventories (InventoryID int, InventoryDate date);")
# ip.db_con.commit()