Exemple #1
0
        public bool VisualizarRegistros()
        {
            ConfigurarTela("Visualizando emprestimos");

            string configuracaColunasTabela = "{0,-10} | {1,-17} | {2,-27} | {3,-37} | {4,-47}";

            MontarCabecalhoTabela(configuracaColunasTabela);

            Emprestimo[] emprestimos = controladorEmprestimo.SelecionarTodosOsEmprestimos();

            if (emprestimos.Length == 0)
            {
                Console.WriteLine("Nehum emprestimo registrado");
                Console.ReadLine();
                return(false);
            }

            for (int i = 0; i < emprestimos.Length; i++)
            {
                if (emprestimos[i].dataDevolucao > DateTime.Now)
                {
                    Console.WriteLine(configuracaColunasTabela,
                                      emprestimos[i].id, emprestimos[i].amiguinho.nome, emprestimos[i].revista.colecao, emprestimos[i].dataDevolucao.ToString("dd/MM/yyyy"), emprestimos[i].statusEmprestimo);
                }
                else
                {
                    Console.WriteLine(configuracaColunasTabela,
                                      emprestimos[i].id, emprestimos[i].amiguinho, emprestimos[i].revista.colecao, emprestimos[i].dataDevolucao, "DATA EXPIRADA");
                }
            }

            return(true);
        }