forked from vrishtrix/e-Auction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
99 lines (81 loc) · 3.08 KB
/
main.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
import os
from colorama import Fore, Style
from cogs import MenuHandler
from cogs.ItemsHandler import itemsManager
from cogs.LoginHandler import userLogin
from cogs.RegisterHandler import userRegister
from cogs.StateHandler import isSold
def clear():
if os.name == 'nt':
_ = os.system('cls')
else:
_ = os.system('clear')
def main():
if 'AUCUSER' in os.environ:
name, email = os.environ['AUCUSER'], os.environ['AUCMAIL']
menuChoice = MenuHandler.optionmenu(name)
print(Style.RESET_ALL)
clear()
itemManager = itemsManager()
if menuChoice == '1':
itemManager.prodList()
input('Press ' + Fore.GREEN + 'enter ' + Style.RESET_ALL + 'to go back to the dashboard.')
clear()
main()
elif menuChoice == '2':
itemManager.addProd()
clear()
main()
elif menuChoice == '3':
itemManager.manageListings()
options = MenuHandler.manageProd()
if options == None:
pass
else:
isSold(options[0], options[1])
clear()
main()
elif menuChoice == '4':
itemManager.soldProducts()
input('Press ' + Fore.GREEN + 'enter ' + Style.RESET_ALL + 'to go back to the dashboard.')
clear()
main()
elif menuChoice == '5':
itemManager.purchasedProducts()
input('Press ' + Fore.GREEN + 'enter ' + Style.RESET_ALL + 'to go back to the dashboard.')
clear()
main()
elif menuChoice == '6':
del os.environ['AUCUSER']
del os.environ['AUCMAIL']
else:
print(Fore.RED + 'Invalid option provided!' + Style.RESET_ALL)
else:
menuChoice = MenuHandler.lor()
print(Style.RESET_ALL)
clear()
if menuChoice == 'login':
userContext = userLogin()
userContext.loginScreen()
userContext.doLogin()
clear()
main()
elif menuChoice == 'register':
userContext = userRegister()
userContext.registerScreen()
userContext.doRegister()
clear()
main()
else:
print(Fore.RED + 'Invalid option provided!' + Style.RESET_ALL)
if __name__ == '__main__':
clear()
print(Fore.CYAN + '''
+------------------------------------------------+
| Online Auction System V1.0.0 |
+------------------------------------------------+
''' + Style.RESET_ALL + '''
By Vrishin and Soumo
'''
)
main()