Esempio n. 1
0
        public static void Start()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("SG Bank Application");
                Console.WriteLine("-------------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2.Deposit");
                Console.WriteLine("3.Withdraw");

                Console.WriteLine("\nQ to quit");
                Console.Write("\nEnter selection: ");

                string userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    break;

                case "3":
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 2
0
        public static void Start()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("SG Bank Application");
                Console.WriteLine(ConsoleIO.DividingBar);
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("4. List all Accounts");
                Console.WriteLine("5. Add new Account");

                Console.WriteLine("\nQ - To Quit");
                Console.Write("\nEnter Selection: ");

                string userInput = Console.ReadLine().ToUpper();

                switch (userInput)
                {
                case "1":
                    AccountLookupWorkflow lookupFlow = new AccountLookupWorkflow();
                    lookupFlow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositFlow = new DepositWorkflow();
                    depositFlow.Execute();
                    break;

                case "3":
                    WithdrawWorkflow withdrawFlow = new WithdrawWorkflow();
                    withdrawFlow.Execute();
                    break;

                case "4":
                    AccountLookupAllWorkflow lookupAllFlow = new AccountLookupAllWorkflow();
                    lookupAllFlow.Execute();
                    break;

                case "5":
                    AddAccountWorkflow addFlow = new AddAccountWorkflow();
                    addFlow.Execute();
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 3
0
        public static void Start()
        {
            FileAccountRepository fileRepo = new FileAccountRepository();

            List <Account> accounts = fileRepo.GetAllAccounts();

            while (true)
            {
                Console.Clear();
                Console.WriteLine("SG Bank Application");
                Console.WriteLine("________________________");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");

                Console.WriteLine("\nQ to quit");
                Console.WriteLine("\nEnter selection");

                string userinput = Console.ReadLine();

                switch (userinput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    fileRepo.SaveAllAccounts(accounts);
                    break;

                case "3":
                    WithdrawWorkflow withdrawWorkflow = new WithdrawWorkflow();
                    withdrawWorkflow.Execute();
                    fileRepo.SaveAllAccounts(accounts);
                    break;

                case "Q":

                    return;
                }
            }
        }
Esempio n. 4
0
        public static void Start()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("SG Bank application");
                Console.WriteLine("------------------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposite");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("4. Lookup a Customer");
                Console.WriteLine("\nQ to quit");
                Console.WriteLine("\nEnter selection");

                string userInput = Console.ReadLine().ToUpper();

                switch (userInput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositeWorkflow depositeWorkflow = new DepositeWorkflow();
                    depositeWorkflow.Execute();
                    break;

                case "3":
                    WithdrawWorkflow withdrawWotkflow = new WithdrawWorkflow();
                    withdrawWotkflow.Execute();
                    break;

                case "4":
                    CustomerLookupWorkflow customerWorkflow = new CustomerLookupWorkflow();
                    customerWorkflow.Execute();
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 5
0
        public static void start()
        {
            Boolean keepBoolingAround = true;

            while (keepBoolingAround)
            {
                Console.Clear();
                Console.WriteLine("JCL Bank Application");
                Console.WriteLine("---------------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("---------------------------");

                Console.WriteLine("\nQ to quit");
                Console.WriteLine("\nEnter selection: ");

                string userinput = Console.ReadLine();

                switch (userinput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    break;

                case "3":
                    WithdrawWorkflow withdrawWorkflow = new WithdrawWorkflow();
                    withdrawWorkflow.Execute();
                    break;

                case "Q":
                    keepBoolingAround = false;
                    break;
                }
            }
        }
Esempio n. 6
0
        public static void Start()
        {
            Console.Clear();
            while (true)
            {
                Console.WriteLine("SG Bank Application");
                Console.WriteLine("---------------------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("\nQ to quit");
                Console.Write("\nEnter selection:  ");

                string userinput = Console.ReadLine().ToLower();

                switch (userinput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    break;

                case "3":
                    WithdrawalWorkflow withdrawalWorkflow = new WithdrawalWorkflow();
                    withdrawalWorkflow.Execute();
                    break;

                case "q":
                    return;

                default:
                    Console.WriteLine("Invalid selection. Try again...");
                    break;
                }
            }
        }
Esempio n. 7
0
        public static void Start()
        {
            bool userExit = false;

            while(!userExit)
            { 
                
            Console.Clear();
                Console.WriteLine("SG Bank Application");
                Console.WriteLine("----------------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("\nQ to quit");
                Console.Write("\nEnter selection: ");

                string userInput = Console.ReadLine();

                switch(userInput.ToUpper())
                {
                    case "1":
                        AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                        lookupWorkflow.Execute();
                        break;

                    case "2":
                        AccountDepositWorkflow depositWorkflow = new AccountDepositWorkflow();
                        depositWorkflow.Execute();
                        break;

                    case "3":
                        AccountWithdrawWorkflow withdrawWorkflow = new AccountWithdrawWorkflow();
                        withdrawWorkflow.Execute();
                        break;

                    case "Q":
                        userExit = true;
                        break;
                }
            }
        }
Esempio n. 8
0
        public static void Start()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("====================");
                Console.WriteLine("SG BANK APPLICATION");
                Console.WriteLine("--------------------");
                Console.WriteLine("1. Lookup an Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("Q. Quit");
                Console.WriteLine("====================");
                Console.Write("\nEnter selection: ");

                string userInput = Console.ReadLine().ToUpper();

                switch (userInput)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    break;

                case "3":
                    WithdrawWorkflow withdrawWorkflow = new WithdrawWorkflow();
                    withdrawWorkflow.Execute();
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 9
0
        public static void Start()//Static only one state
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("SG Bank Application");
                Console.WriteLine("==========================");
                Console.WriteLine("1. Lookup Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");

                Console.WriteLine("\nQ to quit");
                Console.WriteLine("\\nEnter selection: ");

                string input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                    lookupWorkflow.Execute();
                    break;

                case "2":
                    DepositWorkflow depositWorkflow = new DepositWorkflow();
                    depositWorkflow.Execute();
                    break;

                case "3":
                    WithdrawWorkflow withdrawWorkflow = new WithdrawWorkflow();
                    withdrawWorkflow.Execute();
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 10
0
        internal static void Start()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("SGBank Application");
                Console.WriteLine("================================");
                Console.WriteLine("1. Lookup Account");
                Console.WriteLine("2. Deposit");
                Console.WriteLine("3. Withdraw");
                Console.WriteLine("\nQ to Quit");
                Console.WriteLine("\nEnter Selection");

                string userInput = Console.ReadLine();

                switch (userInput)
                {
                case "1":
                    AccountLookupWorkflow accountLookupWorkflow = new AccountLookupWorkflow();
                    accountLookupWorkflow.Execute();
                    break;

                case "2":
                    AccountDepositWorkflow accountDepositWorkflow = new AccountDepositWorkflow();
                    accountDepositWorkflow.Exicute();
                    break;

                case "3":
                    AccountWithdrawWorkflow accountWithdrawWorkflow = new AccountWithdrawWorkflow();
                    accountWithdrawWorkflow.Exicute();
                    break;

                case "Q":
                    return;
                }
            }
        }
Esempio n. 11
0
        public static void Start()
        {
            try
            {
                while (true)
                {
                    Console.Clear();
                    Console.WriteLine("SG Bank Application");
                    Console.WriteLine("-----------------------");
                    Console.WriteLine("1. Lookup an Account.");
                    Console.WriteLine("2. Deposit");
                    Console.WriteLine("3. Withdraw");

                    Console.WriteLine("\nQ to quit");
                    Console.WriteLine("\nEnter selection: ");

                    string userInput = Console.ReadLine().ToUpper();

                    switch (userInput)
                    {
                    case "1":
                        AccountLookupWorkflow lookupWorkflow = new AccountLookupWorkflow();
                        lookupWorkflow.Execute();
                        break;

                    case "2":
                        DepositWorkFlow depositWorkflow = new DepositWorkFlow();
                        depositWorkflow.Execute();
                        break;

                    case "3":     //WithdrawWorkflow
                        WithdrawWorkflow withdrawWorkflow = new WithdrawWorkflow();
                        withdrawWorkflow.Execute();
                        break;

                    case "Q":
                        return;

                    default:
                        //Invalid Input
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                //Just being funny...
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("\n========== Oppsie, I tooted! ==========\n");
                //Print out the exception info to the user
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex.Message);
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("=======================================================================================================================");
                Console.WriteLine($"The error happened:\n{ex.StackTrace}");
                Console.WriteLine("=======================================================================================================================");
                Console.ResetColor();
                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
        }