-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainCheckingAccount.cs
264 lines (240 loc) · 10.7 KB
/
MainCheckingAccount.cs
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
using System;
using System.Threading;
using System.Collections.Generic;
namespace ConsoleBasedBanking
{
class CheckingAccount
{
static void Main()
{
/* This area is where you can call your functions
* Main() is where you can execute all of your commands
* But this legacy type Console Based Banking application has pre-built methods
* As a reminder, all of this information is falsified and is not real.
*/
#region Variables & Declarations
var CheckingAccount = new MenuCode();
bool Pass_Main_Menu = false;
bool NewUser = true;
bool Are_Loans_Enabled = true;
bool Are_BankMessages_Enabled = true;
bool InSettingsPage = true;
#endregion
#region Check if the user is new or not
while (NewUser)
{
try
{
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine("[ Welcome To The Quantum Banking Application! ]");
Console.WriteLine("[ ------------------------------------------- ]");
Console.Write("[ Please enter your full name: ");
Console.ResetColor();
CheckingAccount.AccountOwner = Console.ReadLine();
double Account_Length_String = CheckingAccount.AccountOwner.Length;
// Username length checking ( Ensuring the user types in both names, or at least most of it )
if (Account_Length_String < 8)
{
throw new NotImplementedException(); // Loops back
}
if (Account_Length_String > 20)
{
throw new NotImplementedException(); // Loops back
}
Thread.Sleep(250);
Welcome_The_First_Time_User(); // Running local variables & Configs
NewUser = false; // Makes it so that this wont run again...
}
catch
{
Console.Clear();
Console.WriteLine($"Please ensure your name was entered correctly.");
Thread.Sleep(3000);
Console.Clear();
}
}
#endregion
#region Main Menu Code
Console.Clear();
while (Pass_Main_Menu == false)
{
try
{
// Console Based Main Menu
Console.Clear();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"[ Current Balance : {CheckingAccount.Balance}]");
Console.WriteLine($"[ Account Owner : {CheckingAccount.AccountOwner}]");
Console.WriteLine("-------------------------------");
Console.ResetColor();
Console.WriteLine("[*] Please select an option:");
Console.WriteLine();
Console.WriteLine("[1] Deposit Money");
Console.WriteLine("[2] Withdraw Money");
Console.WriteLine("[3] Loans");
Console.WriteLine("[4] View Settings");
Console.WriteLine("[5] Exit Application");
Console.WriteLine();
Console.Write("Enter an option: ");
#region Option Conversion
string form1 = Console.ReadLine();
double MenuChoice = Convert.ToDouble(form1); // Legacy way of doing it..
#endregion
switch (MenuChoice)
{
case 1:
DepositMoneyMenu();
break;
case 2:
WithdrawMoneyMenu();
break;
case 3:
LoansMenu();
break;
case 4:
SettingsMenu();
break;
}
}
catch
{
Console.WriteLine($"Please enter a valid option.");
Thread.Sleep(3000);
Console.Clear();
}
}
#endregion
void Welcome_The_First_Time_User()
{
Console.Clear();
Console.WriteLine($"Hello, {CheckingAccount.AccountOwner}. Lets setup your account.");
Thread.Sleep(1);
Console.ForegroundColor = ConsoleColor.Green; // Green for good!
Console.WriteLine($"Setting user account level....");
//User_Account_Level = "Default"; // (ADMIN, MODERATOR, DEFAULT)
Thread.Sleep(1);
Console.WriteLine($"Grabbing Global Permissions..."); // For use later
CheckingAccount.Account_Hard_Locked = false;
CheckingAccount.Account_Soft_Locked = false;
CheckingAccount.EXCEEDED_DAILY_LIMIT = false;
Thread.Sleep(1);
Console.WriteLine($"Checking Global Connection String...");
//CheckingAccount.UploadToDatabase = true;
Thread.Sleep(1);
Console.WriteLine($"Finishing up.");
Thread.Sleep(1);
Console.ResetColor();
}
void Check_The_Transaction()
{
Console.Clear();
Console.WriteLine($"Processing your transaction...");
Thread.Sleep(1500);
Console.Clear();
Console.ForegroundColor = ConsoleColor.Green; // Green for good!
Console.WriteLine($"Checking Transaction...");
Thread.Sleep(1500);
Console.ResetColor();
Console.Clear();
}
void SettingsMenu()
{
while (InSettingsPage)
{
Console.Clear();
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine($"[ Current Balance : {CheckingAccount.Balance} ]");
Console.WriteLine($"[ Account Owner : {CheckingAccount.AccountOwner} ]");
Console.ResetColor();
Console.WriteLine("-------------------------------");
Console.WriteLine("");
Console.WriteLine($"1. Enable/Disable loan screen. [Current: {Are_Loans_Enabled}]");
Console.WriteLine($"2. Show Contact Messages [Current: {Are_BankMessages_Enabled}]");
Console.WriteLine($"3. Exit Settings page.");
Console.WriteLine("");
Console.Write("Enter choice: ");
string SettingsPageChoice = Console.ReadLine();
double tt = Convert.ToInt32(SettingsPageChoice);
switch (tt)
{
case 1:
if (Are_Loans_Enabled)
{
Are_Loans_Enabled = false;
Console.Clear();
Console.WriteLine("Disabling Loans Section...");
Thread.Sleep(2000);
}
else if (!Are_Loans_Enabled)
{
Are_Loans_Enabled = true;
Console.Clear();
Console.WriteLine("Enabling Loans Section...");
Thread.Sleep(3000);
}
break;
case 2:
if (Are_BankMessages_Enabled)
{
Console.Clear();
Are_BankMessages_Enabled = false;
Console.WriteLine("Disabling Bank Contact Messages...");
Thread.Sleep(1500);
}
else if (!Are_BankMessages_Enabled)
{
Console.Clear();
Are_BankMessages_Enabled = true;
Console.WriteLine("Enabling Bank Contact Messages...");
Thread.Sleep(1500);
}
break;
case 3:
InSettingsPage = false;
break;
default:
Console.WriteLine("Please enter a valid option.");
break;
}
}
}
void LoansMenu()
{
CheckingAccount.LoanMoney(1);
Thread.Sleep(4000);
Console.Clear();
}
void DepositMoneyMenu()
{
Console.Clear();
Console.WriteLine($"[ Current Balance : {CheckingAccount.Balance} ]");
Console.WriteLine($"[ Account Owner : {CheckingAccount.AccountOwner} ]");
Console.Write($"Please enter a deposit amount: ");
string Users_Deposit_Amount = Console.ReadLine();
double Int_Users_Deposit_Amount = Convert.ToDouble(Users_Deposit_Amount);
Check_The_Transaction();
CheckingAccount.DepositMoney(Int_Users_Deposit_Amount);
}
void WithdrawMoneyMenu()
{
Console.Clear();
Console.WriteLine($"[ Current Balance : {CheckingAccount.Balance} ]");
Console.WriteLine($"[ Account Owner : {CheckingAccount.AccountOwner} ]");
Console.Write($"Please enter a withdrawal amount: ");
string Users_Withdraw_Amount = Console.ReadLine();
double Int_Users_Withdraw_Amount = Convert.ToDouble(Users_Withdraw_Amount);
Check_The_Transaction();
CheckingAccount.WithdrawMoney(Int_Users_Withdraw_Amount);
}
}
}
}
/*
* -- Bank Questions ( Edited on tha fly )
* How long did it take to develop Quantum Bank?
* What is the purpose of Quantum Console Based Banking?
* Who is the developer behind this Quantum Console Bank?
* Information about custom loan amounts?
* Whats planned for the future?
* Will this project be maintained?
*/