예제 #1
0
        /// <summary>
        /// method to add new customer to the queue
        /// </summary>
        /// <param name="accountNo"></param>
        /// <param name="name"></param>
        public void AddNewCustomer(QueueImplementation <int> accountNo, QueueImplementation <string> name)
        {
            Customer customer = new Customer();

            customer.SetName();
            customer.SetAccountNo();

            accountNo.Enqueue(customer.accountNo);
            name.Enqueue(customer.customerName);
        }
예제 #2
0
        /// <summary>
        /// method to open cash counter , add new customer and attend customer
        /// </summary>
        void OpenCashCounter()
        {
            this.balance = STARTING_BALANCE;
            QueueImplementation <int>    accountNo = new QueueImplementation <int>(10);
            QueueImplementation <string> name      = new QueueImplementation <string>(10);
            int money = default;

            while (true)
            {
                int outer = CashCounterPanel();
                switch (outer)
                {
                case 1:
                    AddNewCustomer(accountNo, name);
                    continue;

                case 2:
                    if (accountNo.length > EMPTY && name.length > EMPTY)
                    {
                        int inner = TransactionPanel();
                        switch (inner)
                        {
                        // Deposit Money
                        case 1:
                            DepositMoney(accountNo, name, money);
                            continue;

                        // Withdrwal
                        case 2:
                            WithdrawMoney(accountNo, name, money);
                            continue;
                        }
                    }
                    else
                    {
                        Console.WriteLine("There is no Customer Available Right now...\n");
                        Console.WriteLine("Press 1 To go to add customer panel.");
                        Console.WriteLine("Press 2 to exit bank.");
                        var exitChoice = Console.ReadLine();
                        switch (exitChoice)
                        {
                        case "1":
                            continue;

                        case "2":
                            break;
                        }
                    }
                    break;
                }
                break;
            }
        }
예제 #3
0
        /// <summary>
        /// method to withdraw money from cash counter
        /// </summary>
        /// <param name="accountNo"> account no of customer </param>
        /// <param name="name"> name of customer </param>
        /// <param name="money"> amount to be withdrawn </param>
        public void WithdrawMoney(QueueImplementation <int> accountNo, QueueImplementation <string> name, int money)
        {
            Console.WriteLine("\nPlease go to Counter :(B)\n");
            Console.Write("Enter the Amount to be Withdraw: ");
            money    = Convert.ToInt32(Console.ReadLine());
            balance -= money;

            Console.WriteLine("\n------------- Cash Withdraw Reciept -----------");
            Console.WriteLine("\n\tCash Withdraw :   {0}\n\tAccount No :   {1}\n\tCust Name :    {2}\n", money, accountNo.Dequeue(), name.Dequeue());

            Console.WriteLine("----------- ---------------------------------");
        }