-
Notifications
You must be signed in to change notification settings - Fork 0
/
general.py
194 lines (133 loc) · 5.45 KB
/
general.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
import sqlite3
def get_cnos():
print("\nChoose from given events: \n")
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Event_name From events")
for e in check:
print(e[0])
event_name = input()
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
while(event_name == ""):
event_name = input("Please choose from given events: \n")
while (check is None):
event_name = input("Please choose from given events: \n")
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
participants = con.execute("SELECT Participant_name from event_participant WHERE Event_name = ?", (event_name,))
print("\nHere is the output, if any: ")
for p in participants:
pname = p[0]
cno = con.execute("SELECT contact_no FROM participants WHERE Participant_name = ?", (pname,))
for c in cno:
print("Participant_Name: " + pname + " Contact Number: " + str(c[0]))
con.close()
def get_maxonline():
con = sqlite3.connect('fest.db')
events = con.execute("SELECT Event_name, online_reach FROM publicity_details WHERE online_reach = (SELECT max(online_reach) FROM publicity_details)")
print("\nHere is(are) the Event(s) with maximum online reach, if any: ")
for e in events:
print("Event_name: " + e[0] + " Online_Reach: " + str(e[1]))
con.close()
def get_levelx():
level = input("Enter level of spons(1,2,3): \n")
while(True):
if (not level.isdigit()):
print("Please Enter valid input!!")
level = input()
continue
elif (int(level)<1 or int(level)>3):
print("Please Enter valid input!!")
level = input()
continue
level = int(level)
break
print("\nHere are the name of companies providing level " + str(level) + " sponsorships: ")
con = sqlite3.connect('fest.db')
companies = con.execute("SELECT Company_name FROM sponsorships WHERE level = ?", (level,))
for c in companies:
print(c[0])
con.close()
def get_orgteam():
print("\nChoose from given teams: \n")
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Team_name From teams")
for e in check:
print(e[0])
team_name = input()
check = con.execute("SELECT Team_name From teams WHERE Team_name = ?", (team_name,))
check = check.fetchone()
while(team_name == ""):
team_name = input("Please choose from given teams: \n")
while (check is None):
team_name = input("Please choose from given teams: \n")
check = con.execute("SELECT Team_name From teams WHERE Team_name = ?", (team_name,))
check = check.fetchone()
orgs = con.execute("SELECT first_name, last_name FROM organizers WHERE Team_name = ?", (team_name,))
print("\nHere are the names of all organizers in team " + team_name)
for o in orgs:
print("Name: " + o[0]+" " +o[1])
con.close()
def update_loc():
print("\nChoose from given events: \n")
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Event_name From events")
for e in check:
print(e[0])
event_name = input()
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
while(event_name == ""):
event_name = input("Please choose from given events: \n")
while (check is None):
event_name = input("Please choose from given events: \n")
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
location = input("Enter a new location: \n")
if (location ==""):
print("Enter a location please: ")
location = input()
con.execute("UPDATE events set location = ? WHERE Event_name = ?", (location, event_name,))
print("Location Update Successfully!")
con.commit()
con.close()
def count_event():
print("\nChoose from given events: \n")
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Event_name From events")
for e in check:
print(e[0])
event_name = input()
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
while(event_name == ""):
event_name = input("Please choose from given events: \n")
while (check is None):
event_name = input("Please choose from given events: \n")
check = con.execute("SELECT Event_name From events WHERE Event_name = ?", (event_name,))
check = check.fetchone()
count = con.execute("SELECT count(*) FROM event_participant WHERE event_name = ?", (event_name,))
for c in count:
print("Number of participants of Event: " + event_name + " : " + str(c[0]))
con.close()
def no_publicity():
print("Here are the events who do no require any publicity, if any: \n")
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Event_name FROM events WHERE Event_name NOT IN (SELECT Event_name FROM Publicity_Details) ")
for e in check:
print("Event_name: " + e[0] + "\n")
con.close()
def invalid_email():
con = sqlite3.connect('fest.db')
check = con.execute("SELECT Participant_name,contact_no,email_id FROM PARTICIPANTS WHERE email_id NOT LIKE '%_@__%.__%'")
print("Participants with invalid Email_id, if any: \n")
for p in check:
print("Participant_name: " + p[0] + " Contact_no: " + str(p[1]) + " Email_id: " + p[2] + "\n")
con.close()
def event_organizers():
con = sqlite3.connect('fest.db')
check = con.execute("SELECT organizers.Event_name, first_name, last_name FROM organizers INNER JOIN events ON organizers.Event_name==events.Event_name")
print("Event Organizers: \n")
for x in check:
print("Event_name: " + x[0] + "Organizer_name: " + x[1] + " " + x[2]);
con.close()