public static void EmployeeMenu(BankService bankService, AccountService accountService) { Console.Write(Constant.EmployeeMenu); EmployeeMenu option = (EmployeeMenu)Helper.GetValidInteger(); switch (option) { case Models.EmployeeMenu.AddAccount: bankService.CreateAccount(UserInput.GetAccountDetails()); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.RemoveAccount: Console.Write(Constant.AccountNumber); string accountId = Helper.GetValidString(); Account account = bankService.GetAccount(accountId); if (account == null) { Console.WriteLine(Constant.UserNotFound); } else { Console.Write(Constant.DeleteConfirmation); if (UserInput.Confirmation() == ConfirmationOption.Yes) { bankService.RemoveAccount(accountId); Console.WriteLine(Constant.RemoveAccount); } } Console.ReadKey(); Console.ReadKey(); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.UpdateAccount: Console.Write(Constant.AccountNumber); accountId = Helper.GetValidString(); account = bankService.GetAccount(accountId); if (account == null) { Console.WriteLine(Constant.UserNotFound); } else { bankService.UpdateAccount(UserInput.GetAccountDetails(), accountId); Console.WriteLine(Constant.UpdateAccount); } Console.ReadKey(); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.Transaction: TransactionMenu(bankService, accountService); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.CurrencyExchange: Console.Write(Constant.TransactionAmount); double amount = Helper.GetValidDouble(); Console.Write(Constant.CurrencyRate); float currencyRate = Helper.GetValidFloat(); Console.Write(amount * currencyRate + Constant.PayableAmount); EmployeeMenu(bankService, accountService); break; case Models.EmployeeMenu.SignOut: break; case Models.EmployeeMenu.Exit: Environment.Exit(0); break; default: EmployeeMenu(bankService, accountService); break; } }
public static void AdministratorMenu(BankService bankService, AccountService accountService) { Console.Write(Constant.AdminMenu); AdministratorMenu option = (AdministratorMenu)Helper.GetValidInteger(); switch (option) { case Models.AdministratorMenu.AddEmployee: string employeeId = bankService.CreateEmployee(UserInput.GetEmployeeDetails()); Employee employee = bankService.GetEmployee(employeeId); Console.WriteLine(Constant.EmployeeId + employeeId); Console.WriteLine(Constant.EmployeeUserName + employee.UserId); Console.WriteLine(Constant.EmployeePassword + employee.Password); Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.RemoveEmployee: Console.WriteLine(Constant.EmployeeId); employeeId = Helper.GetValidString(); if (!bankService.HasEmployee(employeeId)) { Console.WriteLine(Constant.UserNotFound); } else { Console.Write(Constant.DeleteConfirmation); if (UserInput.Confirmation() == ConfirmationOption.Yes) { bankService.RemoveEmployee(employeeId); Console.WriteLine(Constant.RemoveEmployee); Console.ReadKey(); } } Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.UpdateEmployee: Console.Write(Constant.EmployeeId); employeeId = Helper.GetValidString(); if (!bankService.HasEmployee(employeeId)) { Console.WriteLine(Constant.UserNotFound); } else { bankService.UpdateEmployee(UserInput.GetEmployeeDetails(), employeeId); Console.WriteLine(Constant.UpdateEmployee); } Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.AddAccount: string accountId = bankService.CreateAccount(UserInput.GetAccountDetails()); Account account = bankService.GetAccount(accountId); Console.WriteLine(Constant.AccountNumber + account.Id); Console.WriteLine(Constant.UserId + account.Holder.UserId); Console.WriteLine(Constant.Password + account.Holder.Password); Console.WriteLine(Constant.BankId + account.Holder.BankId); Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.RemoveAccount: Console.Write(Constant.AccountNumber); accountId = Helper.GetValidString(); if (!bankService.HasAccount(accountId)) { Console.WriteLine(Constant.UserNotFound); } else { Console.Write(Constant.DeleteConfirmation); if (UserInput.Confirmation() == ConfirmationOption.Yes) { bankService.RemoveAccount(accountId); Console.WriteLine(Constant.RemoveAccount); } } Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.UpdateAccount: Console.Write(Constant.AccountNumber); accountId = Helper.GetValidString(); if (bankService.HasAccount(accountId)) { Console.WriteLine(Constant.UserNotFound); } else { bankService.UpdateAccount(UserInput.GetAccountDetails(), accountId); Console.WriteLine(Constant.UpdateAccount); } Console.ReadKey(); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.Transaction: TransactionMenu(bankService, accountService); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.CurrencyExchange: Console.Write(Constant.TransactionAmount); double amount = Helper.GetValidDouble(); Console.Write(Constant.CurrencyRate); float currencyRate = Helper.GetValidFloat(); Console.WriteLine(amount * currencyRate + Constant.PayableAmount); AdministratorMenu(bankService, accountService); break; case Models.AdministratorMenu.SignOut: break; case Models.AdministratorMenu.Exit: Environment.Exit(0); break; default: AdministratorMenu(bankService, accountService); break; } }