def main(): while True: print("当前是用户管理窗格") menuList = ['增加用户', '修改密码', '备份', '恢复'] count = 1 for words in menuList: print((str)(count) + ":" + words) count = count + 1 choose = eval(input("请选择你需要的功能")) if choose == 1: username = input("请输入用户名") flag = 0 password = input("请输入密码") while flag == 0: passwordconfirm = input("请再输入一次") if password == passwordconfirm: cursor.execute('INSERT INTO UserInfoSheet VALUES (%s,%s)', (username, password)) conn.commit() flag = 1 elif choose == 2: cursor.execute('SELECT username FROM UserInfoSheet') no = input("请输入要更改密码的用户") newpass = input("输入新的密码:") while True: newpassconfirm = input("请再输入一次:") if newpass is newpassconfirm: cursor.excute( 'UPDATE UserInfoSheet Set password = %s WHERE username = %s ', (username, password)) conn.commit() break
def updating(): print("当前进入更新窗格") while True: selectall() c = input("请选择你要更改的线路的编号,输入quit退出当前模块") if c is 'quit': mainui.uiDisplay() else: c = (eval)(c) item = ['1.线路信息', '2.线路花费', '3.线路介绍', '4.线路路径'] for w in item: print(w) c2 = eval(input("请选择你要更改的信息")) if c2 == 1: newinfo = input("请输入新的线路信息:") cursor.execute( 'UPDATE DestInfoSheet SET Name = %s WHERE DestNo = %d', (newinfo, c)) elif c2 == 2: newfee = eval(input("请输入新的线路花费")) cursor.execute( 'UPDATE DestInfoSheet SET Cost = %d WHERE DestNo = %d', (newfee, c)) elif c2 == 3: newintro = input("请输入线路介绍:") cursor.execute( 'UPDATE DestInfoSheet SET Intro = %s WHERE DestNo = %d', (newintro, c)) elif c2 == 4: newpath = input("请输入新的线路路径") cursor.execute( 'UPDATE DestInfoSheet SET Graph = %s WHERE DestNo = %d', (newpath, c)) conn.commit()
def add(): roadinfo = str(input("请输入线路信息:")) roadfee = eval(input("请输入线路花费:")) roadintro = str(input("请输入线路介绍:")) roadgraph = str(input("请输入线路 路径:")) roadno = eval(input("线路编号:")) cursor.execute('INSERT INTO DestInfoSheet VALUES (%s,%d,%s,%s,%d)', (roadinfo, roadfee, roadintro, roadgraph, roadno)) conn.commit()
def add(): printf("目前状态") selectall() teamno = eval(input("请输入团队编号")) destno = eval(input("请输入目的地编号")) teamnum = eval(input("请输入团队人数")) teamleave = eval(input("请输入出发日期")) teamreturn = eval(input("请输入返程日期")) cursor.execute('INSERT INTO TeamInfoSheet VALUES (%d,%d,%d,%d,%d)', (teamno, destno, teamnum, teamleave, teamreturn)) conn.commit()
def updating(): print("当前进入更新窗格") while True: selectall() c = input("请选择你要更改的团队编号,输入quit退出当前模块") if c is 'quit': mainui.uiDisplay() else: c = (eval)(c) item = ['该组负责人', '人数', '日期', '出发', '费用', '盈利'] count = 1 for w in item: print((str)(count) + ":" + w) count = count + 1 c2 = eval(input("请选择你要更改的信息")) if c2 == 1: newGroupNo = input("请输入负责人") cursor.execute( 'UPDATE GroupInfoSheet SET GroupNo = %d WHERE GroupNo = %d', (newGroupNo, c)) elif c2 == 2: newnum = eval(input("请输入人数")) cursor.execute( 'UPDATE GroupInfoSheet SET Name = %s WHERE GroupNo = %d', (newnum, c)) elif c2 == 3: newdate = input("请输入日期") cursor.execute( 'UPDATE GroupInfoSheet SET Sex = %s WHERE GroupNo = %d', (newdate, c)) elif c2 == 4: newisleave = input("请输入是否出发") cursor.execute( 'UPDATE GroupInfoSheet SET Tel = %s WHERE GroupNo = %d', (newisleave, c)) elif c2 == 5: newfee = eval(input("请输入新的费用")) cursor.execute( 'UPDATE GroupInfoSheet SET Tel = %s WHERE GroupNo = %d', (newfee, c)) elif c2 == 6: newshare = eval(input("请输入盈利金额")) cursor.execute( 'UPDATE GroupInfoSheet SET Tel = %s WHERE GroupNo = %d', (newshare, c)) conn.commit()
def add(): printf("目前状态") selectall() GroupNo = eval(input("请输入组别编号")) GroupCharge = input("请输入该组负责人") Groupnum = eval(input("请输入该组人数")) GroupSetDate = input("请输入建组日期") Groupisleave = input("请输入是否出发") GroupFee = eval(input("请输入费用")) GroupShare = eval(input("请输入盈利数额")) cursor.execute( 'INSERT INTO GroupInfoSheet VALUES (%d,%s,%d,%s,%s,%s,%d,%d)', (GroupNo, GroupCharge, Groupnum, GroupSetDate, Groupisleave, GroupFee, GroupShare)) conn.commit() selectall()
def updating(): print("当前进入更新窗格") while True: selectall() c = input("请选择你要更改的团队编号,输入quit退出当前模块") if c is 'quit': mainui.uiDisplay() else: c = (eval)(c) item = ['团队编号', '目的地编号', '团队人数', '出发日期', '返程日期'] count = 1 for w in item: print((str)(count) + ":" + w) count = count + 1 c2 = eval(input("请选择你要更改的信息")) if c2 == 1: newdestno = eval(input("请输入团队编号")) cursor.execute( 'UPDATE TeamInfoSheet SET DestNo = %d WHERE TeamNo = %d', (newdestno, c)) elif c2 == 2: newteamno = eval(input("请输入目的地编号")) cursor.execute( 'UPDATE TeamInfoSheet SET TeamNo = %d WHERE TeamNo = %d', (newteamno, c)) elif c2 == 3: newname = input("请输入团队人数") cursor.execute( 'UPDATE TeamInfoSheet SET Name = %s WHERE TeamNo = %d', (newname, c)) elif c2 == 4: newsex = input("请输入出发日期") cursor.execute( 'UPDATE TeamInfoSheet SET Sex = %s WHERE TeamNo = %d', (newsex, c)) elif c2 == 5: newtel = input("请输入返程日期") cursor.execute( 'UPDATE TeamInfoSheet SET Tel = %s WHERE TeamNo = %d', (newtel, c)) conn.commit()
def add(): memno = eval(input("请输入成员编号")) memname = input("请输入姓名") memsex = input("请输入性别") memtel = input("请输入电话") memaddress = input("请输入地址") memidcardnum = input("请输入身份证号码") memispaid = input("是否支付 ?请输入是或否") memtips = input("请输入备注") cursor.execute('SELECT * FROM DestInfoSheet WHERE Name LIKE %s', info) row = cursor.fetchone() print("线路信息\t\t\t线路花费\t\t\t线路介绍\t\t\t线路路径\t\t\t线路编号") memdestno = eval(input("请输入目的地编号")) cursor.execute( 'INSERT INTO MemInfoSheet VALUES (%d,%s,%s,%s,%s,%s,%s,%s,%d)', (memno, memname, memsex, memtel, memaddress, memidcardnum, memispaid, memtips, memdestno)) conn.commit()
def recuse(): cursor.execute('Restore database touristagency from disk = D:\backup.bak') conn.commit()
def backup(): cursor.execute('Backup Database touristagency To disk = D:\backup.bak') conn.commit()
def deleting(): selectall() deleteno = eval(input("请选择你要删除的号码")) cursor.execute('DELETE FROM TeamInfoSheet WHERE TeamNo=%d', deleteno) conn.commit() selectall()
def updating(): print("当前进入更新窗格") while True: selectall() c = input("请选择你要更改的团员编号,输入quit退出当前模块") if c is 'quit': mainui.uiDisplay() else: c = (eval)(c) item = [ '目的地编号', '团队编号', '团员编号', '姓名', '性别', '电话', '地址', '身份证号码', '是否支付', '备注' ] count = 1 for w in item: print((str)(count) + ":" + w) count = count + 1 c2 = eval(input("请选择你要更改的信息")) if c2 == 1: newdestno = eval(input("请输入目的地编号:")) cursor.execute( 'UPDATE MemInfoSheet SET DestNo = %d WHERE MemNo = %d', (newdestno, c)) elif c2 == 2: newteamno = eval(input("请输入新的团队编号:")) cursor.execute( 'UPDATE MemInfoSheet SET TeamNo = %d WHERE MemNo = %d', (newteamno, c)) elif c2 == 3: newname = input("请输入新的姓名") cursor.execute( 'UPDATE MemInfoSheet SET Name = %s WHERE MemNo = %d', (newname, c)) elif c2 == 4: newsex = input("请输入新的性别") cursor.execute( 'UPDATE MemInfoSheet SET Sex = %s WHERE MemNo = %d', (newsex, c)) elif c2 == 5: newtel = input("请输入新的电话") cursor.execute( 'UPDATE MemInfoSheet SET Tel = %s WHERE MemNo = %d', (newtel, c)) elif c2 == 6: newadd = input("请输入新的地址") cursor.execute( 'UPDATE MemInfoSheet SET Address = %s WHERE MemNo = %d', (newadd, c)) elif c2 == 7: newidcardnum = input("请输入新的身份证号码") cursor.execute( 'UPDATE MemInfoSheet SET IdcardNum = %s WHERE MemNo = %d', (newidcardnum, c)) elif c2 == 8: newispaid = input("请输入是否支付") cursor.execute( 'UPDATE MemInfoSheet SET IsPaid = %s WHERE MemNo = %d', (newispaid, c)) elif c2 == 9: newtips = input("请输入备份") cursor.execute( 'UPDATE MemInfoSheet SET tips = %s WHERE MemNo = %d', (newtips, c)) conn.commit()