-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMain.py
95 lines (78 loc) · 2.16 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
import peewee
from peewee import *
import sys
from email import _name
import __main__
from symbol import except_clause
db = peewee.SqliteDatabase('internet_banking.db')
def initDB():
db.connect()
try:
db.create_tables([User, Funds])
except OperationalError:
# if tables already existed
print "Exception during tables creation"
pass
def deinitDB():
db.close()
#Creating the models for the project
class BaseModel(Model):
class Meta:
database = db
class User(BaseModel):
user = CharField(unique=True)
dob = CharField()
gender = CharField()
address = CharField()
class Funds(BaseModel):
user = ForeignKeyField(User, backref='funds')
amount = DoubleField()
def create_user():
name = raw_input("Please enter your name:")
date_of_birth = raw_input("Please enter your date of birth:")
gender = raw_input("Please enter your gender:")
address = raw_input("Please enter your address:")
def balance_check():
print "Checking Balance"
def withdrawal():
print "Withdrawing amount"
def deposit():
print "Depositing amount"
def existing_user():
existing_user_message()
def existing_user_message():
print """
Thanks for your confirmation. Please choose from the following options:
a. Check Balance
b. Withdrawal
c. Deposit
d. Quit
"""
banking_choice = raw_input("Please enter your choice:")
banking_choice = banking_choice.lower()
if banking_choice == 'a':
balance_check()
elif banking_choice == 'b':
withdrawal()
elif banking_choice == 'c':
deposit()
elif banking_choice == 'd':
sys.exit()
else:
print "Invalid Choice. Please try again."
existing_user_message()
print """
Welcome to Internet Banking
a. New User
b. Existing User
"""
user_choice = raw_input("Please enter your choice:")
user_choice = user_choice.lower()
if user_choice == 'a':
create_user()
elif user_choice == 'b':
existing_user()
else:
print "Invalid Choice. Please try again later. Good Bye."
if __name__ == '__main__':
initDB()