Exemplo n.º 1
0
        public static void DepositOrWithdrawl(string userNameInput, BankActionTypes transactionType)
        {
            string depositType = "";

            if (transactionType == BankActionTypes.Deposit)
            {
                depositType = "deposit";
            }
            else if (transactionType == BankActionTypes.Withdrawl)
            {
                depositType = "withdrawl";
            }
            else
            {
                LoggedInScreen(userNameInput, "Banking action not recognized");
            }

            Console.WriteLine("Alright, lets record a " + depositType);

            Console.WriteLine("What party is responsible for this " + depositType);

            var receivedFrom = Console.ReadLine();

            Console.WriteLine("What payment method was used?");

            var paymentMethod = Console.ReadLine();

            Console.WriteLine("How much was the " + depositType + " for?");

            var depositAmount = Console.ReadLine();

            decimal parsedDepositAmount;

            if (!decimal.TryParse(depositAmount, out parsedDepositAmount))
            {
                LoggedInScreen(userNameInput, "Amount deposited must be a decimal");
                return;
            }

            if (transactionType == BankActionTypes.Deposit)
            {
                DepositLogic depositLogic = new DepositLogic();

                var createdDeposit = depositLogic.CreateDeposit(receivedFrom, paymentMethod, parsedDepositAmount, userNameInput);
            }
            else if (transactionType == BankActionTypes.Withdrawl)
            {
                WithdrawlLogic withdrawlLogic = new WithdrawlLogic();

                var createdDeposit = withdrawlLogic.CreateWithdrawl(receivedFrom, paymentMethod, parsedDepositAmount, userNameInput);
            }
            else
            {
                LoggedInScreen(userNameInput, "Banking action not recognized");
            }

            LoggedInScreen(userNameInput, "Successfully recorded " + depositType + " for: $" + depositAmount);
        }
Exemplo n.º 2
0
        public static void TransferFunds(string userNameInput)
        {
            var transactionLogic = new TransactionLogic();

            Console.WriteLine("which friend would you like to send money to?");

            var friendList = transactionLogic.GetFriendList(userNameInput);

            foreach (var friend in friendList)
            {
                Console.WriteLine(friend);
            }

            var friendName = Console.ReadLine();

            string amountToSend = "";

            if (friendList.IndexOf(friendName) != -1)
            {
                Console.WriteLine("Wonderful!  How much would you like to send?");

                amountToSend = Console.ReadLine();

                decimal parsedSendAmount;

                if (!decimal.TryParse(amountToSend, out parsedSendAmount))
                {
                    LoggedInScreen(userNameInput, "Amount deposited must be a decimal");
                    return;
                }

                var newDepositLogic = new DepositLogic();

                newDepositLogic.CreateDeposit(userNameInput, "Online Transfer", parsedSendAmount, friendName);

                var newWithdrawlLogic = new WithdrawlLogic();

                newWithdrawlLogic.CreateWithdrawl(friendName, "Online Transfer", parsedSendAmount, userNameInput);
            }
            else
            {
                LoggedInScreen(userNameInput, "Type friend name exactly to send funds");
                return;
            }

            LoggedInScreen(userNameInput, "Successfully sent " + amountToSend + " to " + friendName);
        }
Exemplo n.º 3
0
        public static void CreateAdminUser()
        {
            var RegisterLogic = new RegistrationLogic();

            RegisterLogic.RegisterNewUser("alex", "pass");
            DepositLogic depositLogic = new DepositLogic();

            depositLogic.CreateDeposit("Customer1", "Cash", 35, "alex");
            depositLogic.CreateDeposit("Customer2", "Cash", 43, "alex");
            depositLogic.CreateDeposit("Customer3", "Cash", 225, "alex");
            depositLogic.CreateDeposit("Customer4", "Cash", 45, "alex");

            WithdrawlLogic WithdrawlLogic = new WithdrawlLogic();

            WithdrawlLogic.CreateWithdrawl("Customer1", "Check", 22, "alex");
            WithdrawlLogic.CreateWithdrawl("Customer2", "Check", 32, "alex");
            WithdrawlLogic.CreateWithdrawl("Customer3", "Check", 22, "alex");
            WithdrawlLogic.CreateWithdrawl("Customer4", "Check", 45, "alex");

            RegisterLogic.RegisterNewUser("john", "pass");

            depositLogic.CreateDeposit("Customer1", "Cash", 55, "john");
            depositLogic.CreateDeposit("Customer2", "Cash", 44, "john");
            depositLogic.CreateDeposit("Customer3", "Cash", 67, "john");
            depositLogic.CreateDeposit("Customer4", "Cash", 86, "john");

            WithdrawlLogic.CreateWithdrawl("Customer1", "Check", 22, "john");
            WithdrawlLogic.CreateWithdrawl("Customer2", "Check", 4, "john");
            WithdrawlLogic.CreateWithdrawl("Customer3", "Check", 71, "john");
            WithdrawlLogic.CreateWithdrawl("Customer4", "Check", 12, "john");

            RegisterLogic.RegisterNewUser("bob", "pass");

            depositLogic.CreateDeposit("Customer1", "Cash", 55, "bob");
            depositLogic.CreateDeposit("Customer2", "Cash", 44, "bob");
            depositLogic.CreateDeposit("Customer3", "Cash", 67, "bob");
            depositLogic.CreateDeposit("Customer4", "Cash", 86, "bob");

            WithdrawlLogic.CreateWithdrawl("Customer1", "Check", 22, "bob");
            WithdrawlLogic.CreateWithdrawl("Customer2", "Check", 4, "bob");
            WithdrawlLogic.CreateWithdrawl("Customer3", "Check", 71, "bob");
            WithdrawlLogic.CreateWithdrawl("Customer4", "Check", 12, "bob");
        }