-
Notifications
You must be signed in to change notification settings - Fork 0
/
booking.py
64 lines (49 loc) · 1.71 KB
/
booking.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
from db import User, Game
def getSeatType():
seatTypes = ['A', 'B', 'C', 'D']
sType = input(
'Enter your seat class\n'
'A - A/C VIP Lounge ------------------------ 200\n'
'B - 100\n'
'C - 50\n'
'D - 25\n'
'Your Choice: '
)
if sType not in seatTypes:
print('The Seat Class you entered is invalid!\nPlease Try Again!!\n')
getSeatType()
return sType
def getMatch():
game = Game()
print('\nAVAILABLE MATCHES\n')
game.viewGames()
mID = int(input('Enter match you want to book for: '))
if game.gameVerify(mID) != 1:
print('The match id you entered is invalid!\nPlease Try Again!!\n')
getMatch()
return mID
def getSeat(user, sType,matchID):
seatNo = int(input("Enter your required seat no: "))
if user.checkSeat(seatNo,sType,matchID) != 1:
print('Yaay seat available!')
return seatNo
else:
print('The seat number you asked for is already booked!!\nTry another seat.\n')
getSeat(user, sType, matchID)
def book():
user = User()
name = input('Enter your Name: ')
age = int(input('Enter your age: '))
email = input('Enter your Email: ')
phone = input('Enter your Phone: ')
sType = getSeatType()
matchID = getMatch()
seatNo = getSeat(user, sType, matchID)
print(seatNo)
print('Getting your ticket ready...')
ticketNo = user.addTicket(matchID,name,age,phone,email,sType,seatNo)
print(
'Done\n'
'Here is your ticket number: ' + str(ticketNo) +
'\nKeep it safe for further uses.\n'
)