-
Notifications
You must be signed in to change notification settings - Fork 0
/
admh.py
219 lines (203 loc) · 5.57 KB
/
admh.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
217
218
219
import mysql.connector as mc
import os
import sys
import funcs
def admh(db,uname):
os.system('cls')
print('LOGGED IN')
print("WELCOME ",uname)
while True:
print('ENTER \n1 TO SEE OR EDIT DETAILS \n2 ADD NEW ADMIN \n3 TO SHOW DATABASES \n0 TO LOG OUT')
ch=funcs.notsame(['1','2','3','0'])
if ch=='1':
admdet(db,uname)
elif ch=='2':
os.system('cls')
uname=input('Enter Admin Username: ')
mail=input('Enter Mail Id of new Admin: ')
pwd=input('Enter password: ')
l=[uname,mail,pwd]
funcs.inp(db,l,1)
elif ch=='3':
showdata(db,uname)
else:
break
def admdet(db,uname):
os.system('cls')
cursor=db.cursor()
cursor.execute("use lj;")
cursor.execute("select * from data where uname='%s'"%(uname,))
rec=cursor.fetchone()
ch=input('ENTER 1 TO EDIT DETAILS \t ANY OTHER KEY TO GO BACK: ')
if ch=='1':
print('ENTER 1 TO EDIT ADMIN NAME \t2 TO EDIT EMAIL ID \t3 TO EDIT PASSWORD')
l=['1','2','3']
ch=funcs.notsame(l)
if ch=='1':
un=input('Enter New Username: ')
cursor.execute("update data set uname='%s' where uname='%s'"%(un,uname))
db.commit()
elif ch=='2':
ml=input('Enter New Email Id: ')
cursor.execute("update data set mail='%s' where uname='%s'"%(ml,uname))
db.commit()
else:
pwd=input('Enter New password: ')
cursor.execute("update data set pwd='%s' where uname='%s'"%(pwd,uname))
db.commit()
else:
return
def showdata(db,uname):
os.system('cls')
cursor=db.cursor()
cursor.execute("use lj;")
cursor.execute("show tables;")
tab=cursor.fetchall()
f1=f2=f3=f4=0
for i in tab:
if i[0]=='dataemployer':
f1=1
elif i[0]=='dataemployee':
f2=2
elif i[0]=='jobs':
f3=3
elif i[0]=='applications':
f4=4
print('ENTER 1 TO SEE ALL TABLES \t2 TO SEE ALL CUSTOMERS \t3 TO SEE EMPLOYERS \t4 TO SEE EMPLOYEES \t5 TO SEE POSTED JOBS \t6 TO SEE SUBMITTED APPLICATIONS \tANY OTHER KEY TO GO BACK-')
while True:
ch=input('Enter Choice: ')
if ch=='1':
print('ALL TABLES')
cursor.execute("SHOW TABLES;")
b=cursor.fetchall()
for i in b:
print(i[0])
print()
print('ALL CUSTOMERS')
print('USERNAME\tMAIL ID\tPASSWORD\tTYPE')
cursor.execute('select * from data;')
a=cursor.fetchall()
for i in a:
for j in i:
print(j,end='\t')
print()
print()
if f1==1:
print('ALL EMPLOYERS')
print('USERNAME\tCOMPANY NAME\tLOCATION')
cursor.execute('select * from dataemployer;')
c=cursor.fetchall()
for i in c:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR EMPLOYERS')
if f2==2:
print('ALL EMPLOYEES')
print('USERNAME\tFATHER\'S NAME\tDATE OF BIRTH\tAGE\tCONTACT\tNATIONALITY\tADDRESS\tQUALIFICATIONS\tEXPERIENCE\tHOBBIES')
cursor.execute('select * from dataemployee;')
d=cursor.fetchall()
for i in d:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR EMPLOYEES')
if f3==3:
print('POSTED JOBS')
print('USERNAME\tJOB NAME\tCOMPANY NAME\tDESCRIPTION\tELIGIBILITY\tREQUIRED AGE')
cursor.execute('select * from jobs;')
e=cursor.fetchall()
for i in e:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR POSTED JOBS')
if f4==4:
print('SUBMITTED APPLICATIONS')
print('USERNAME\tMAIL ID\tAGE\tCONTACT\tELIGIBILITY\tEXPERIENCE\tHOBBIES\tJOB NAME\tCOMPANY NAME')
cursor.execute('select * from applications;')
f=cursor.fetchall()
for i in f:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR SUBMITTED APPLICATIONS')
elif ch=='2':
print('ALL TABLES')
cursor.execute("SHOW TABLES;")
b=cursor.fetchall()
for i in b:
print(i)
print()
print('ALL CUSTOMERS')
print('USERNAME\tMAIL ID\tPASSWORD\tTYPE')
cursor.execute('select * from data;')
a=cursor.fetchall()
for i in a:
for j in i:
print(j,end='\t')
print()
print()
elif ch=='3':
if f1==1:
print('ALL EMPLOYERS')
print('USERNAME\tCOMPANY NAME\tLOCATION')
cursor.execute('select * from dataemployee;')
c=cursor.fetchall()
for i in c:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR EMPLOYERS')
elif ch=='4':
if f2==2:
print('ALL EMPLOYEES')
print('USERNAME\tFATHER\'S NAME\tDATE OF BIRTH\tAGE\tCONTACT\tNATIONALITY\tADDRESS\tQUALIFICATIONS\tEXPERIENCE\tHOBBIES')
cursor.execute('select * from dataemployer;')
d=cursor.fetchall()
for i in d:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR EMPLOYEES')
elif ch=='5':
if f3==3:
print('POSTED JOBS')
print('USERNAME\tJOB NAME\tCOMPANY NAME\tDESCRIPTION\tELIGIBILITY\tREQUIRED AGE')
cursor.execute('select * from jobs;')
e=cursor.fetchall()
for i in e:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR POSTED JOBS')
elif ch=='6':
if f4==4:
print('SUBMITTED APPLICATIONS')
print('USERNAME\tMAIL ID\tAGE\tCONTACT\tELIGIBILITY\tEXPERIENCE\tHOBBIES\tJOB NAME\tCOMPANY NAME')
cursor.execute('select * from applications;')
f=cursor.fetchall()
for i in f:
for j in i:
print(j,end='\t')
print()
print()
else:
print('NO DATA AVAILABLE FOR SUBMITTED APPLICATIONS')
else:
break
return