-
Notifications
You must be signed in to change notification settings - Fork 1
/
options.py
216 lines (196 loc) · 5.62 KB
/
options.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import subprocess as sp
import pymysql
import pymysql.cursors
import add
from add import *
import updating
from updating import *
import delete
from delete import *
import displayDetails
from displayDetails import *
import aggr
from aggr import *
import projection
from projection import *
import placeOrder
from placeOrder import *
import analysis
from analysis import *
import getby
from getby import *
import adminOptions
from adminOptions import *
import retrieve_id
from retrieve_id import *
import retrieve_other
from retrieve_other import *
def adminOpt(cur,con,loginid):
while(1):
print("1. Manage staff")
print("2. Manage dependents")
print("3. Update department")
print("4. Add plasma samples")
print("5. Manage donor")
print("6. Manage vehicles")
print("7. Get information")
print("8. Add hospital")
print("9. Show all details")
print("10. Add inventory")
print("11. Update user")
print("12. Logout")
ch = int(input("Enter choice> "))
if ch==12:
return
elif ch==1:
manageStaff(cur, con)
elif ch==2:
manageDep(cur, con)
elif ch==3:
updateDept(cur, con)
elif ch==4:
addPlasma(cur, con)
elif ch==5:
manageDonor(cur, con)
elif ch==6:
manageVeh(cur, con)
elif ch==7:
getInfo(cur, con, loginid)
elif ch==8:
addHosp(cur, con)
elif ch==9:
showAllDetails(cur, con)
elif ch==10:
addInventory(cur, con)
elif ch==11:
updateUser(cur, con)
else:
print("Invalid choice")
def invStaffOpt(cur,con,loginid):
while(1):
print("1. View your details")
print("2. Add donor")
print("3. Show all donors")
print("4. Update donor")
print("5. Delete donor")
print("6. Get Donor")
print("7. Add plasma sample")
print("8. Show all plasma samples")
print("9. View filtered Plasma samples")
print("10. Add hospital")
print("11. Show all hospitals")
print("12. Add inventory")
print("13. Show all inventories")
print("14. Logout")
ch = int(input("Enter choice> "))
if ch==14:
return
elif ch==1:
displayMyDetails(cur, con, loginid)
elif ch==2:
addDonor(cur, con)
elif ch==4:
updateDonor(cur, con)
elif ch==5:
delDonor(cur, con)
elif ch==6:
getDonor(cur, con)
elif ch==7:
addPlasma(cur, con)
elif ch==9:
getPlasma(cur, con)
elif ch==10:
addHosp(cur, con)
elif ch==12:
addInventory(cur, con)
elif ch==3:
showAllDonor(cur,con)
elif ch==8:
showAllPlasma(cur,con)
elif ch==11:
showAllHospital(cur,con)
elif ch==13:
showAllInv(cur,con)
else:
print("Invalid choice")
tmp = input("Enter any key to CONTINUE>")
def logStafOpt(cur,con,loginid):
while(1):
print("1. View your details")
print("2. Add vehicle")
print("3. Show all vehicles")
print("4. Update vehicle availability")
print("5. Delete vehicle")
print("6. Logout")
ch = int(input("Enter choice> "))
if ch==6:
return
elif ch==1:
displayMyDetails(cur, con, loginid)
elif ch==2:
addVehi(cur, con)
elif ch==4:
updateVehAv(cur, con)
elif ch==5:
delVehi(cur, con)
elif ch==3:
showAllVehi(cur,con)
else:
print("Invalid choice")
tmp = input("Enter any key to CONTINUE>")
def staffOpt(cur,con,loginid):
stid = loginid[5:len(loginid)]
query = "SELECT Department_id FROM WORKS_FOR WHERE Staff_id LIKE '%s'" %(stid)
#print(query)
cur.execute(query)
dept = ""
result = cur.fetchall()
for row in result:
for key, value in row.items():
if key=="Department_id":
dept = value
print(dept)
if dept == "DPI":
invStaffOpt(cur,con,loginid)
else:
logStafOpt(cur,con,loginid)
tmp = input("Enter any key to CONTINUE>")
def donorOpt(cur,con,loginid):
while(1):
print("1. View my details")
print("2. Plasma sample details") # based on donor id
print("3. Logout")
ch = int(input("Enter choice> "))
if ch==3:
return
elif ch==1:
displayMyDetails(cur, con, loginid)
elif ch==2:
donorid = loginid[5:len(loginid)]
retrievePlasmaById(cur,con,donorid)
else:
print("Invalid choice")
tmp = input("Enter any key to CONTINUE>")
def hospOpt(cur,con,loginid):
while(1):
print("1. View our details")
print("2. View our patients")
print("3. Place order")
print("4. View our orders")
print("5. Logout")
ch = int(input("Enter choice> "))
if ch==5:
return
elif ch==1:
displayMyDetails(cur, con, loginid)
elif ch==2:
hospid = loginid[8:len(loginid)]
retrievePatByHospId(cur,con,hospid)
elif ch==3:
placeOrder(cur, con, loginid)
elif ch==4:
hospid = loginid[8:len(loginid)]
retrieveOrderByHospId(cur,con,hospid)
else:
print("Invalid choice")
tmp = input("Enter any key to CONTINUE>")