public void visualizarEmprestimosAbertos()
        {
            Console.Clear();

            string configuracaColunasTabela = "{0,-10} | {1,-15} | {2,-25} | {3,-25} | {4,-25}";

            MontarCabecalhoTabela(configuracaColunasTabela);

            Emprestimo[] emprestimos = controladorEmprestimo.SelecionarTodosEmprestimos();

            for (int i = 0; i < emprestimos.Length; i++)
            {
                if (emprestimos[i].emprestimoFechado == false)
                {
                    Console.Write(configuracaColunasTabela,
                                  emprestimos[i].id, emprestimos[i].amigo.nome, emprestimos[i].revista.nome, emprestimos[i].dataEmprestimo.ToString("dd/MM/yyyy"), emprestimos[i].dataDevolucao.ToString("dd/MM/yyyy"));

                    Console.WriteLine();
                }
            }
            if (emprestimos.Length == 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Nenhum empréstimo cadastrado!");
                Console.ResetColor();
            }


            Console.ReadLine();
        }
Ejemplo n.º 2
0
        public void VisualizarEmprestimosAbertos()
        {
            ConfigurarTela("Visualizando emprestimos abertos...");

            Emprestimo[] emprestimo = controladorEmprestimo.SelecionarTodosEmprestimos();

            if (emprestimo.Length == 0)
            {
                Console.WriteLine("Nenhum emprestimo cadastrado");
                Console.ReadLine();
                return;
            }

            int contador = 0;

            for (int i = 0; i < emprestimo.Length; i++)
            {
                if (emprestimo[i].estaAtivo)
                {
                    contador++;
                }
            }

            if (contador == 0)
            {
                Console.WriteLine("Nenhum emprestimo ativo");
                Console.ReadLine();
                return;
            }

            Console.WriteLine();
            Console.WriteLine($"Existe {contador} emprestimo(s) ativos.");
            Console.WriteLine();

            string configuracaColunasTabela = "{0,-5} | {1,-10} | {2,-10} | {3,-25} | {4,-25}";

            MontarCabecalhoTabela(configuracaColunasTabela);

            for (int i = 0; i < emprestimo.Length; i++)
            {
                if (emprestimo[i].estaAtivo)
                {
                    Console.WriteLine(configuracaColunasTabela,
                                      emprestimo[i].id, emprestimo[i].revistinha.id, emprestimo[i].amiguinho.id, emprestimo[i].dataEmprestimo.ToString(),
                                      emprestimo[i].dataDevolucao.ToString());
                }
            }
            Console.ReadLine();
        }
Ejemplo n.º 3
0
        public void VisualizarEmprestimosAbertosDia()
        {
            ConfigurarTela("Visualizando Emprestimos do dia...");

            MontarCabecalhoTabela();

            Emprestimo[] emprestimos = controladorEmprestimo.SelecionarTodosEmprestimos();

            if (emprestimos.Length == 0)
            {
                ApresentarMensagem("Nenhum empréstimo aberto!", TipoMensagem.Atencao);
                return;
            }

            foreach (Emprestimo e in emprestimos)
            {
                if (e.dataEmprestimo.Date == DateTime.Now.Date && e.status == "EMPRESTADO")
                {
                    Console.WriteLine("{0,-5} | {1,-10} | {2,-25} | {3,-20} | {4,-20} | {5,-20}", e.id, e.amigo.nome, e.revista.tipoColecao, e.dataEmprestimo.ToString("dd/MM/yyyy"), e.dataDevolucao.ToString("dd/MM/yyyy"), e.status);
                }
            }
        }
Ejemplo n.º 4
0
        internal void MostrarEmprestimosAbertos()
        {
            Emprestimo[] emprestimo = controladorEmprestimo.SelecionarTodosEmprestimos();

            int contador = 0;

            for (int i = 0; i < emprestimo.Length; i++)
            {
                if (emprestimo[i].Status)
                {
                    contador++;
                }
            }
            Console.WriteLine($"\n{contador} emprestimos abertos.\n");

            string configuracaColunasTabela = "{0,-5} | {1,-5} | {2,-15} | {3,-25} | {4,-25} | {5,-25}";

            MontarCabecalhoTabela(configuracaColunasTabela);

            for (int i = 0; i < emprestimo.Length; i++)
            {
                if (emprestimo[i].Status)
                {
                    Console.WriteLine(configuracaColunasTabela,
                                      emprestimo[i].Id, emprestimo[i].Revista.Id, emprestimo[i].Amiguinho.Nome, emprestimo[i].DataEmprestimo.ToString(),
                                      emprestimo[i].DataDevolucao.ToString(), emprestimo[i].Status);
                }
            }
            Console.ReadLine();

            if (contador == 0)
            {
                Console.WriteLine("Não existem emprestimos em aberto no momento");
                Console.ReadLine();
            }
        }
Ejemplo n.º 5
0
        public void VisualizarRegistros()
        {
            ConfigurarTela("Visualizando Emprestimos...");

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

            MontarCabecalhoTabela(configuracaColunasTabela);

            Emprestimo[] emprestimos = controladorEmprestimo.SelecionarTodosEmprestimos();

            if (emprestimos.Length == 0)
            {
                ApresentarMensagem("Nenhum emprestimo cadastrado!", TipoMensagem.Atencao);
                return;
            }
            //Vizualia Emprestimos Realizados
            for (int i = 0; i < emprestimos.Length; i++)
            {
                Console.WriteLine(configuracaColunasTabela,
                                  emprestimos[i].id, emprestimos[i].nomeAmigo, emprestimos[i].revista, emprestimos[i].dataEmprestimo);
                Console.WriteLine("--------------------------------------------------------------------------");
            }
            //Vizualisa Emprestimos Realizados no Mes
            foreach (Emprestimo emprestimo in emprestimos)
            {
                if (emprestimo.dataDevolucao != DateTime.MinValue)
                {
                    if (emprestimo.dataDevolucao.Month == DateTime.Now.Month)
                    {
                        Console.WriteLine("{0,-10} | {1,-10} | {2,-10} | {3,-10} | {4,-10}",
                                          emprestimo.id, emprestimo.revista.id, emprestimo.nomeAmigo.nomeAmigo, emprestimo.dataEmprestimo, emprestimo.dataDevolucao);
                        Console.WriteLine("--------------------------------------------------------------------------");
                    }
                }
            }
            //Vizualisa Emprestimos Diarios
            foreach (Emprestimo emprestimo in emprestimos)
            {
                if (emprestimo.dataDevolucao == DateTime.MinValue)
                {
                    Console.WriteLine("{0,-10} | {1,-10} | {2,-10} | {3,-10}",
                                      emprestimo.id, emprestimo.revista.id, emprestimo.nomeAmigo.nomeAmigo, emprestimo.dataEmprestimo);
                    Console.WriteLine("--------------------------------------------------------------------------");
                }
            }
        }
Ejemplo n.º 6
0
        public void VisualizarRegistros()
        {
            ConfigurarTela("Visualizando Empestimos...");

            MontarCabecalhoTabela();

            Emprestimo[] emprestimos = ControladorEmprestimo.SelecionarTodosEmprestimos();

            if (emprestimos.Length == 0)
            {
                ApresentarMensagem("Nenhum emprestimo cadastrado!", TipoMensagem.Atencao);
                return;
            }

            foreach (Emprestimo emprestimo in emprestimos)
            {
                Console.WriteLine("{0,-10} | {1,-15} | {2,-15} | {3,-45}",
                                  emprestimo.id, emprestimo.amiguinho.nome, emprestimo.revista.colecao, emprestimo.dataEmprestimo);
            }
        }
Ejemplo n.º 7
0
        public void VisualizarRegistros()
        {
            ConfigurarTela("Visualizando registros...");

            MontarCabecalhoTabela();

            Emprestimo[] emprestimos = ctrlEmprestimo.SelecionarTodosEmprestimos();

            foreach (Emprestimo emprestimo in emprestimos)
            {
                Console.WriteLine("{0,-3} | {1,-20} | {2,-20} | {3, -16} | {4, -16}", emprestimo.id, emprestimo.amiguinho.Nome,
                                  emprestimo.revista.TipoColecao, emprestimo.data, emprestimo.dataDevolucao);

                Console.WriteLine();
            }

            if (emprestimos.Length == 0)
            {
                ApresentarMensagem("Nenhum registro encontrado!", TipoMensagem.Atencao);
            }

            Console.ReadLine();
        }
Ejemplo n.º 8
0
        public override void VisualizarRegistros()
        {
            ConfigurarTela("Visualizando empréstimos...");

            MontarCabecalhoTabela();

            Emprestimo[] emprestimos = controladorEmprestimo.SelecionarTodosEmprestimos();

            if (emprestimos.Length == 0)
            {
                ApresentarMensagem("Nenhum emprestimo registrado!", TipoMensagem.Atencao);
                return;
            }

            Console.WriteLine("Empréstimos do mês...");

            foreach (Emprestimo emprestimo in emprestimos)
            {
                if (emprestimo.dataEmprestimo.Month == DateTime.Now.Month)
                {
                    Console.WriteLine("{0,-10} | {1,-30} | {2,-55} | {3,-25} | {4,-25}",
                                      emprestimo.id, emprestimo.revista.id, emprestimo.amiguinho.id, emprestimo.dataEmprestimo, emprestimo.dataDevolucao);
                }
            }

            Console.ReadLine();
            Console.WriteLine("Empréstimos de hoje...");

            foreach (Emprestimo emprestimo in emprestimos)
            {
                if (emprestimo.dataEmprestimo.Day == DateTime.Now.Day)
                {
                    Console.WriteLine("{0,-10} | {1,-30} | {2,-55} | {3,-25} | {4,-25}",
                                      emprestimo.id, emprestimo.revista.id, emprestimo.amiguinho.id, emprestimo.dataEmprestimo, emprestimo.dataDevolucao);
                }
            }
        }