Beispiel #1
0
        /// <summary>
        /// Prints account number, name of the client and CPF.
        /// </summary>
        /// <param name="accountsArray"></param>
        /// <param name="clientsArray"></param>
        /// <param name="accountIndex"></param>
        public static void PrintAccountNameAndCPF(decimal[,] accountsArray, string[,] clientsArray,
                                                  int accountIndex)
        {
            string cpf         = CPFDecimalToString(accountsArray[accountIndex, 0]);
            int    clientIndex = ArrayLib.Find_Binary(clientsArray, cpf, 0);

            Console.WriteLine("\nNúmero da conta: {0}\nNome do cliente: {1:C}\nCPF:{2}",
                              accountsArray[accountIndex, 1], clientsArray[clientIndex, 1], ClientsLib.CPFFormat(cpf));
        }
Beispiel #2
0
        /// <summary>
        /// Prints account number and balance.
        /// </summary>
        /// <param name="accountsArray"></param>
        /// <param name="accountIndex"></param>
        /// <param name="message"></param>
        public static void ConsultAccounts(decimal[,] accountsArray, decimal cpf)
        {
            MenuLib.PrintSubmenu("CONSULTANDO AS CONTAS");
            Console.WriteLine("Para o CPF informado ({0}), temos as seguintes contas:", ClientsLib.CPFFormat(CPFDecimalToString(cpf)));
            decimal totalBalance = 0;

            for (int i = 0; i < accountsArray.GetLength(0); i++)
            {
                if (accountsArray[i, 0] == cpf)
                {
                    PrintAccount(accountsArray, i);
                    totalBalance += accountsArray[i, 2];
                }
            }
            if (totalBalance != 0)
            {
                Console.WriteLine("\nO balanço total do cliente é: {0:C}\n\n" +
                                  "Digite qualquer tecla para retornar ao menu de contas.", totalBalance);
            }
            else
            {
                Console.WriteLine("O cliente não possui nenhuma conta cadastrada.");
            }
            Console.ReadKey();
        }