Esempio n. 1
0
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////
        public void ContinueToUpdateAccount()
        {
            int      accountNo = Convert.ToInt32(InputHandlerFromConsole.GetNumberInRange(1, int.MaxValue, "Enter the Account Number: "));
            Customer c         = bll.getCustomer(accountNo);

            if (c == null)
            {
                WriteLine("Invalid Account Number!");
                return;
            }
            OutputHandlerToConsole.DisplayCustoemr(c);

            ForegroundColor = ConsoleColor.DarkMagenta;
            Write("Please enter in the fields you wish to update(leave blank otherwise): ");
            ForegroundColor = ConsoleColor.White;

            Customer updatedCustomer = InputHandlerFromConsole.GetFieldsForUpdatingAccount(accountNo);

            updatedCustomer.AccountNo = accountNo;
            if (updatedCustomer.UserId == "")
            {
                updatedCustomer.UserId = c.UserId;
            }

            if (updatedCustomer.PinCode == "")
            {
                updatedCustomer.PinCode = c.PinCode;
            }

            if (updatedCustomer.AccountHolderName == "")
            {
                updatedCustomer.AccountHolderName = c.AccountHolderName;
            }

            if (updatedCustomer.AccountType == "")
            {
                updatedCustomer.AccountType = c.AccountType;
            }

            updatedCustomer.AccountBalance = c.AccountBalance;

            if (updatedCustomer.Status == "")
            {
                updatedCustomer.Status = c.Status;
            }

            OutputHandlerToConsole.DisplayCustoemr(updatedCustomer);

            if (bll.UpdateCustomer(updatedCustomer))
            {
                WriteLine("Your account have been successfully been updated!");
            }
            else
            {
                ForegroundColor = ConsoleColor.DarkMagenta;
                WriteLine("There is some problem while updating the account information!");
                ForegroundColor = ConsoleColor.White;
            }
        }
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////

        public void ContinueToViewBalance(string currentUserId)
        {
            int accountNo = bll.getAccountNo(currentUserId);
            int balance   = bll.GetBalance(accountNo);

            string time = (DateTime.Now).ToString();

            OutputHandlerToConsole.DisplayBalancePage(accountNo, balance, time);
        }