Beispiel #1
0
 static void Main(string[] args)
 {
     Console.WriteLine("Bank App versio 1.0");
     //CreateBank();
     //ReadBanks();
     // GetBankById();
     // UpdateBank();
     bankView.GetBankByName();
     bankView.DeleteBank();
     Console.WriteLine("Enter Lopettaa");
     Console.ReadLine();
 }
Beispiel #2
0
        static void Main(string[] args)
        {
            ConsoleKeyInfo cki;
            string         message     = string.Empty;
            BankView       bankView    = new BankView();
            AccountView    accountView = new AccountView();

            Console.OutputEncoding = System.Text.Encoding.UTF8;

            do
            {
                cki = UserInterface();
                switch (cki.Key)
                {
                case ConsoleKey.C:
                    bankView.CreateBank();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.U:
                    bankView.UpdateBank();
                    message = "\n-----------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.D:
                    bankView.DeleteBank(8);
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.A:
                    bankView.CreateCustomer();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.B:
                    accountView.CreateAccount();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.E:
                    bankView.PrintAccounts(_accountRepository.Read());
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.F:
                    bankView.PrintCustomers(_customerRepository.Read());
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.G:
                    bankView.UpdateCustomer();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.H:
                    bankView.DeleteCustomer(14);
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.I:
                    accountView.DeleteAccount("22113344556677");
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.J:
                    accountView.ReadbyId(1);
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.K:
                    accountView.CreateTransaction();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.L:
                    accountView.GetTransactionByIban("112233445566778");
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.R:
                    accountView.PrintAll();
                    message = "\n------------------------------------\nPaina Enter jatkaaksesi!";
                    break;

                case ConsoleKey.Escape:
                    message = "\nOhjelman suoritus päättyy.";
                    break;

                default:
                    message = "Virhe - Paina Enter ja aloita alusta!";
                    break;
                }
                Console.WriteLine(message);
                Console.ReadLine();
                Console.Clear();
            } while (cki.Key != ConsoleKey.Escape);

            Console.WriteLine("Ohjelman suoritus päättyi!");
        }