Exemplo n.º 1
0
 def evEditItem(self, event=None):
     # get selected member
     indices = self.itemList.curselection()
     index = int(indices[0]) if indices else 0
     item = self.items[index]
     ownerID = item[3]
     ownerName = data.get_member_name(ownerID)
     dlg = od.OptionsDialog(top, (["Name", item[1]], [
         "Description", item[2]
     ], ["Owner", ownerName], ["Price", item[4]], ["Condition", item[5]]))
     if dlg.changed:
         if dlg.options[2][1] != ownerName:  # its changed
             ownerID = self.get_member_id(dlg.options[2][1])
         data.update_item(item[0],
                          dlg.options[0][1], dlg.options[1][1], ownerID,
                          int(dlg.options[3][1]), dlg.options[4][1])
         self.items = data.get_items()
         self.populateItemList()
Exemplo n.º 2
0
 def ev_edit_item(self, event=None):
     # get selected member
     indices = self.item_list.curselection()
     index = int(indices[0]) if indices else 0
     item = self.items[index]
     owner_id = item[3]
     owner_name = data.get_member_name(owner_id)
     dlg = od.OptionsDialog(top, (
         ["Name", item[1]],
         ["Description", item[2]],
         ["Owner", owner_name],
         ["Price", item[4]],
         ["Condition", item[5]]))
     if dlg.changed:
         if dlg.options[2][1] != owner_name:  # its changed
             owner_id = self.get_member_id(dlg.options[2][1])
         data.update_item(item[0], dlg.options[0][1], dlg.options[1][1], owner_id, int(dlg.options[3][1]),
                          dlg.options[4][1])
         self.items = data.get_items()
         self.populate_item_list()
Exemplo n.º 3
0
import lendydata as ld
ld.initDB()
print(ld.get_members())
print(ld.get_items())

ld.insert_item('Python Projects','Book',6,30,'Excellent')
###
# this should not have worked..... BUT IT DID. WTF PRAGMA?!>!?
###

ld.insert_member('Alan','*****@*****.**')
print(ld.get_members())
ld.insert_item('Python Projects','Book',6,30,'Excellent')
ld.get_items()

ld.update_item(7,Price=25)
ld.get_item_details(7)
ld.get_member_name(6)
ld.update_member(6,Name='Alan Gould')
ld.get_member_details(6)

ld.delete_member(6)  # this also shouldn't work due to referential integrity, but does...
ld.delete_item(7)
ld.delete_member(6)

ld.cursor.execute("""
    select * from item
    where OwnerID in (select id from member where name like '%e%')
    """).fetchall()

ld.cursor.execute("""