-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
127 lines (119 loc) · 4.29 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
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
from user import User
from admin import Admin
def user_input(user):
while True:
option = input("1. TransferMoney 2.DepositMoney 3.WithdrawMoney 4.ViewProfile")
if option == '1':
acc_no = input("Enter Account_No you want to transfer ")
if User.is_valid_acc(acc_no):
amount = input("Enter Amount")
if Admin.is_valid_transfer(user, int(amount)):
user.transfer(acc_no, (int(amount)))
print("successfully transferred")
else:
print("Not valid transaction")
else:
print(" Sorry!Not valid account_no")
elif option == '2':
amount = input("Enter Amount")
user.deposit(int(amount))
print("successfully deposit")
elif option == '3':
amount = input("Enter Amount")
if Admin.is_valid_withdraw(user, int(amount)):
user.withdraw(int(amount))
print("successfully withdraw")
else:
print("Not valid transaction")
elif option == '4':
user.show_profile()
else:
print("invalid option selected")
cont = input("Enter 0 to exist")
if int(cont) == 0:
break
def admin_input(admin):
while True:
option = input("1. AddUser 2. DeleteUser 3.SearchUser 4.ViewUser 5. ViewAllUsers 6.AddAdmin"
" 7.DeleteAdmin 8.ChangePassword 9.ViewProfile 10.ViewTransaction")
if option == '1':
name = input("Enter name")
acc_no = input("Enter account_no")
if User.unique(acc_no):
print("Please enter unique account_no")
else:
password = input("Enter password")
user = User(name, acc_no, password)
Admin.add_user(user)
elif option == '2':
acc_no = input("Enter account_no you want to remove ")
if User.is_valid_acc(acc_no):
Admin.del_user(acc_no)
else:
print("Sorry! wrong account no")
elif option == '3':
acc_no = input("Enter account_no you want to search")
if Admin.search_user(acc_no):
print('exist')
else:
print("Not exist")
elif option == '5':
Admin.show()
elif option == '4':
acc_no = input("Enter account_no you want to search")
if User.is_valid_acc(acc_no):
Admin.show_user_profile(acc_no)
else:
print("Sorry! wrong account no")
elif option == '6':
name = input("Enter name")
id = input("Enter id")
if Admin.unique(id):
print("Please enter unique id")
else:
password = input("Enter password")
admin = Admin(name, id, password)
admin.add_admin()
elif option == "7":
acc_no = input("Enter id you want to remove")
if Admin.is_valid_acc(acc_no):
Admin.del_admin(acc_no)
else:
print("Sorry! wrong account no")
elif option == '8':
new_password = input("Enter new password")
admin.change_password(new_password)
elif option == '9':
admin.show_profile()
elif option == '10':
acc_no = input("Enter the account no ")
if User.is_valid_acc(acc_no):
Admin.view_transaction(acc_no)
else:
print("Sorry! wrong account no")
else:
print("wrong input")
cont = input("Enter 0 to exist")
if int(cont) == 0:
break
option = input("1. Admin 2.User ")
if option == '1':
print("Login")
id = input("Enter id ")
Pass = input("Enter Password ")
admin = Admin.is_valid(id, Pass)
if admin == None:
print("wrong id and password")
else:
admin_input(admin)
elif option == '2':
print("Login")
Account_no = input("Enter Account_No ")
Pass = input("Enter Password ")
user = User.is_valid(Account_no, Pass)
if user == None:
print("wrong id and password")
else:
user_input(user)
else:
print("invalid option selected")