public static void RegisterCustomer() { var _customerInstance = ClassNewers.CustomerCreator(); bool active = false; while (!active) { Helper1.Logger("Enter your email Address"); _customerInstance.EmailAddress = Validate.ValidateMail(); Helper1.Logger("Enter your FirstName"); _customerInstance.FirstName = Validate.ValidateName(); Helper1.Logger("Enter your LastName"); _customerInstance.LastName = Helper1.Reader(); Helper1.Logger("Enter your Password");; _customerInstance.Password = Validate.ValidatePassword(); CustomerDataStore.SaveCustomer(_customerInstance); RegisterAccountInitial(_customerInstance); active = true; Console.Clear(); } }
public static void InitialDeposit(CustomerDetails customer, decimal defaultValue, IAccounts account) { try { var _AccountNumber = account.AccountNumber; Helper1.Logger("Enter amount to deposit"); var _amountToDeposit = Console.ReadLine(); var value = Convert.ToDecimal(_amountToDeposit); if (value > defaultValue) { if (account.AccountOwner == customer) { Helper1.Logger("Enter transaction description"); account.Note = Helper1.Reader(); account.AccountBalance += value; var transactDetails = ClassNewers.TransactionDetailsCreator(account); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = account.AccountBalance; transactDetails.Note = account.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); Helper1.Logger("Transaction Successful"); Helper1.Logger($"Your new account balance is #{account.AccountBalance}"); } else { Helper1.Logger("The details you entered were incorrect, make sure the account number you eneterd is yours"); InitialDeposit(customer, defaultValue, account); } } else { Helper1.Logger($"The amount must be at least eqaul to {defaultValue}"); InitialDeposit(customer, defaultValue, account); } } catch (FormatException) { Helper1.Logger("Account Number Must be a number"); InitialDeposit(customer, defaultValue, account); } catch (Exception) { Helper1.Logger("No such account exists in our Database"); InitialDeposit(customer, defaultValue, account); } }
public static void CustomerLogger() { Console.Clear(); bool active = false; while (!active) { //Checks that the Databse is not empty before allowing any user access to log-in. if (CustomerDataStore.DataStoreCount()) { CustomerDetails foundUser = null; Helper1.Logger("Please enter your log-in details"); Helper1.Logger("Please enter your registered email Address"); var Login_mail = Helper1.Reader(); Helper1.Logger("Please enter your password"); var Login_password = Helper1.Reader(); //Checks to see that the user attempting to log-in actually exists in the Database var user1 = CustomerDataStore.FindCustomerByMail(Login_mail); var user2 = CustomerDataStore.FindCustomerByPassword(Login_password); if (user1 != null && user2 != null && user1 == user2) { Helper1.Logger("Welcome you are logged in"); Helper1.Reader(); foundUser = user1; MainUserInterface.ActivityPage(foundUser); active = true; } else { Console.WriteLine("Sorry, this user does not exist in our database"); Console.ReadKey(); active = true; } } else { Console.WriteLine("There are currently no users in the database. Rgister first"); Console.ReadKey(); active = true; } break; } }
public static void RegisterAccountInitial(CustomerDetails customer) { bool active = false; while (!active) { Console.Clear(); Helper1.Logger("Please follow the prompt to create a bank account and complete your registeration process"); Helper1.Logger(@"Enter: '1' to create a savings account '2' to create a current account "); var value = Helper1.Reader(); switch (value) { case "1": var _savingsAccountInstance = ClassNewers.SavingsAccountCreator(customer); AccountsDataStore.SaveAccount(_savingsAccountInstance); Helper1.Logger($"Welcome you have successfully registerd a savings account.\n" + $" Your Account number is {_savingsAccountInstance.AccountNumber}"); var _accountnumber = _savingsAccountInstance.AccountNumber; var account = AccountsDataStore.ExistChecker(_accountnumber); account.MakeInitialDeposit(customer, account); Console.ReadKey(); active = true; break; case "2": var _currentAccountInstance = ClassNewers.CurrentAccountCreator(customer); AccountsDataStore.SaveAccount(_currentAccountInstance); Helper1.Logger($"Welcome you have successfully registerd a current account.\n" + $"Your Account number is {_currentAccountInstance.AccountNumber}"); var _accountnumber1 = _currentAccountInstance.AccountNumber; var account1 = AccountsDataStore.ExistChecker(_accountnumber1); account1.MakeInitialDeposit(customer, account1); Console.ReadKey(); active = true; break; default: break; } } }
public static void ActivityPage(CustomerDetails customer) { Console.Clear(); bool active = false; while (!active) { try { Console.Clear(); Console.WriteLine("->> Welcome to the Kingdom School Admin Home page; we hope you have a wonderful experience"); Console.WriteLine("Please follow the prompt to update your details"); Console.WriteLine(@"Enter: '1' to Deopsit funds '2' to Withdraw funds '3' to transfer funds '4' to Get your account balance '5' to get your statement of account '6' to create a new savings account '7' to create a new current account '0' to Log out"); var value = Console.ReadLine(); switch (value) { case "1": Helper1.Logger("Enter The account number to deposiit funds into"); var value1 = Convert.ToInt32(Helper1.Reader()); var _accountnumber1 = value1; var account1 = AccountsDataStore.ExistChecker(_accountnumber1); account1.DepositFunds(customer, account1); Console.ReadKey(); Console.Clear(); break; case "2": Helper1.Logger("Enter your account number"); var value2 = Convert.ToInt32(Helper1.Reader()); var _accountnumber2 = value2; var account2 = AccountsDataStore.ExistChecker(_accountnumber2); account2.WithdrawFunds(customer, account2); Console.ReadKey(); Console.Clear(); break; case "3": Helper1.Logger("Enter your account number"); var value3 = Convert.ToInt32(Helper1.Reader()); var _accountnumber3 = value3; var account3 = AccountsDataStore.ExistChecker(_accountnumber3); account3.TransferFunds(customer, account3); Console.ReadKey(); Console.Clear(); break; case "4": Helper1.Logger("Enter The account number to get balance from"); var value4 = Convert.ToInt32(Helper1.Reader()); var _accountnumber4 = value4; var account4 = AccountsDataStore.ExistChecker(_accountnumber4); account4.GetBalance(customer, account4); Console.ReadKey(); Console.Clear(); break; case "5": Helper1.Logger("Enter The account number to get statemnt from"); var value5 = Convert.ToInt32(Helper1.Reader()); var _accountnumber5 = value5; var account5 = AccountsDataStore.ExistChecker(_accountnumber5); account5.GetStatement(customer, account5); Console.ReadKey(); Console.Clear(); break; case "6": var _savingsAccountInstance = ClassNewers.SavingsAccountCreator(customer); AccountsDataStore.SaveAccount(_savingsAccountInstance); Helper1.Logger($"Welcome you have successfully registerd your Account number is {_savingsAccountInstance.AccountNumber}"); var _accountnumber = _savingsAccountInstance.AccountNumber; var account = AccountsDataStore.ExistChecker(_accountnumber); account.MakeInitialDeposit(customer, account); Console.ReadKey(); Console.ReadLine(); break; case "7": var _currentAccountInstance = ClassNewers.CurrentAccountCreator(customer); AccountsDataStore.SaveAccount(_currentAccountInstance); Helper1.Logger($"Welcome you have successfully registerd your Account number is {_currentAccountInstance.AccountNumber}"); var _accountnumber7 = _currentAccountInstance.AccountNumber; var account7 = AccountsDataStore.ExistChecker(_accountnumber7); account7.MakeInitialDeposit(customer, account7); Console.ReadKey(); Console.Clear(); break; case "0": active = true; Console.WriteLine("Thank YOU FOR VISITING"); Console.ReadKey(); Console.Clear(); break; default: break; } } catch (FormatException) { Helper1.Logger("Account must be a number"); Thread.Sleep(1500); } catch (Exception) { Helper1.Logger("There was an Error in your input please try again"); Thread.Sleep(1500); } } }
public static void GetBalance(CustomerDetails customer, IAccounts account) { bool active = false; while (!active) { Helper1.Logger("Enter Account Number to get balance from"); try { var _AccountNumber = account.AccountNumber;; if (account.AccountOwner == customer) { Helper1.Logger("Please Enter your passord for additional security"); var authpassword = Console.ReadLine(); if (authpassword == customer.Password) { if (account.AccountBalance >= 1010.23m) { var value = 10.23m; account.Note = "Get Balance"; account.AccountBalance -= value; var transactDetails = ClassNewers.TransactionDetailsCreator(account); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = account.AccountBalance; transactDetails.Note = account.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); Helper1.Logger("Transaction Successful"); Helper1.Logger($" Your Account Balance for {account.AccountNumber} is {account.AccountBalance} as at {DateTime.Now}"); active = true; } else { Helper1.Logger("Your Account is insufficient please make a deposit and try again. Thank you"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("Your password is incorrect"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("The details you entered were incorrect, ensure the account number you eneterd is yours"); Thread.Sleep(1500); active = true; } } catch (FormatException) { Helper1.Logger("Account number must be a number"); Thread.Sleep(1500); active = true; } catch (Exception) { Helper1.Logger("No such account exists in our Database"); Thread.Sleep(1500); active = true; } } }
public static void Withdraw(CustomerDetails customer, int defaultAmount, IAccounts account) { bool active = false; while (!active) { try { var _AccountNumber = account.AccountNumber; if (account.AccountOwner == customer) { Helper1.Logger("Enter amount to withdraw"); var _amountToTransfer = Helper1.Reader(); var value = Convert.ToDecimal(_amountToTransfer); if (value > 0) { if (value < account.AccountBalance && account.AccountBalance > defaultAmount) { Helper1.Logger("Please enter your password for additional security"); var authpassword = Console.ReadLine(); if (authpassword == customer.Password) { Helper1.Logger("Enter transaction description"); account.Note = Helper1.Reader(); account.AccountBalance -= value; var transactDetails = ClassNewers.TransactionDetailsCreator(account); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = account.AccountBalance; transactDetails.Note = account.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); Helper1.Logger("Transaction Successful"); Helper1.Logger($"Your new account balance is #{account.AccountBalance}"); active = true; } else { Helper1.Logger("Passowrd is Incorrect"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("Your account balance is insufficient"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("Amount must be a positive Integer"); Thread.Sleep(1500); } } else { Helper1.Logger("The details you entered were incorrect, make sure the account number you eneterd is yours"); Thread.Sleep(1500); active = true; } ; } catch (FormatException) { Helper1.Logger("Account Number must be a number"); Thread.Sleep(1500); active = true; } catch (Exception) { Helper1.Logger("No such account exists in our Database"); Thread.Sleep(1500); active = true; } } }
public static void Transfer(CustomerDetails customer, int defaultAmount, IAccounts accounts) { bool active = false; while (!active) { Helper1.Logger("Enter Account Number to transfer funds to"); var _accountToTransferTo = Helper1.Reader(); try { var beneficiary = Convert.ToInt32(_accountToTransferTo); var useraccount = accounts.AccountNumber; var checker1 = AccountsDataStore.FindAccount(beneficiary); if (accounts.AccountOwner == customer) { Helper1.Logger("Enter amount to transfer"); var _amountToTransfer = Helper1.Reader(); var value = Convert.ToDecimal(_amountToTransfer); if (value >= 0) { if (value < accounts.AccountBalance && accounts.AccountBalance > defaultAmount) { Helper1.Logger("Please enter your password for additional security"); var authpassword = Helper1.Reader(); if (authpassword == customer.Password) { Helper1.Logger("Enter transaction description"); accounts.Note = Helper1.Reader(); accounts.AccountBalance -= value; checker1.AccountBalance += value; var transactDetails = ClassNewers.TransactionDetailsCreator(accounts); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = checker1.AccountBalance; transactDetails.Note = checker1.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); var transactDetails1 = ClassNewers.TransactionDetailsCreator(checker1); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = checker1.AccountBalance; transactDetails.Note = checker1.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); Helper1.Logger("Transaction Successful"); Helper1.Logger($"Your new account balance is #{accounts.AccountBalance}"); active = true; } else { Helper1.Logger("Password is incorrect"); Thread.Sleep(2000); active = true; } } else { Helper1.Logger("Your account balance is insufficient"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("Amount must be a positive number"); } } else { Helper1.Logger("The details you entered were incorrect, ensure the account number you eneterd is yours"); Thread.Sleep(1500); active = true; } } catch (FormatException) { Helper1.Logger("Account number must be a number"); Thread.Sleep(1500); active = true; } catch (Exception) { Helper1.Logger("No such account exists in our Database"); Thread.Sleep(1500); active = true; } } }
public static void GetStatement(CustomerDetails customer, IAccounts account) { bool active = false; while (!active) { try { var _AccountNumber = account.AccountNumber; if (account.AccountOwner == customer) { Helper1.Logger("Please Enter your passord for additional security"); var authpassword = Console.ReadLine(); if (authpassword == customer.Password) { if (account.AccountBalance >= 1019.4m) { var value = 19.14m; account.AccountBalance -= value; account.Note = "Get statement of Account"; var transactDetails = ClassNewers.TransactionDetailsCreator(account); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = account.AccountBalance; transactDetails.Note = account.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); var _statement = AccountsDataStore.FindTransactions(_AccountNumber); foreach (var transaction in _statement) { Console.WriteLine("{0} || {1} || {2} || {3} || {4} || {5} || {6}", transaction.AccountOwnerName, transaction.AccountNumber, transaction.AccountType, transaction.TransactionAmount, transaction.AccountBalance, transaction.Note, transaction.TransactionTime); } Helper1.Logger("Transaction Successful"); active = true; } else { Helper1.Logger("Your account balance is insufficient, please credit your account and try again. Thank you."); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("Your password is incorrect"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("The details you entered were incorrect, ensure the account number you eneterd is yours"); Thread.Sleep(1500); active = true; } } catch (FormatException) { Helper1.Logger("Account number must be a number"); Thread.Sleep(1500); active = true; } catch (Exception) { Helper1.Logger("No such account exists in our Database"); Thread.Sleep(1500); active = true; } } }
public static void Deposit(CustomerDetails customer, IAccounts account) { bool active = false; while (!active) { Helper1.Logger("Enter Account Number to Deposit funds to"); try { var _AccountNumber = account.AccountNumber; Helper1.Logger("Enter amount to deposit"); var _amountToDeposit = Console.ReadLine(); var value = Convert.ToDecimal(_amountToDeposit); if (value > 0) { if (account.AccountOwner == customer) { Helper1.Logger("Enter transaction description"); account.Note = Helper1.Reader(); account.AccountBalance += value; var transactDetails = ClassNewers.TransactionDetailsCreator(account); transactDetails.TransactionAmount = value; transactDetails.AccountBalance = account.AccountBalance; transactDetails.Note = account.Note; AccountsDataStore.SaveTransactionDetails(transactDetails); Helper1.Logger("Transaction Successful"); Helper1.Logger($"Your new account balance is #{account.AccountBalance}"); active = true; } else { Helper1.Logger("The details you entered were incorrect, make sure the account number you eneterd is yours"); Thread.Sleep(1500); active = true; } } else { Helper1.Logger("The amount must be a greater than zer0"); Thread.Sleep(1500); } } catch (FormatException) { Helper1.Logger("Account Number Must be a number"); Thread.Sleep(1500); active = true; } catch (Exception) { Helper1.Logger("No such account exists in our Database"); Thread.Sleep(1500); active = true; } } }