示例#1
0
        static void Main(string[] args)
        {
            #region Aula 1

            //var conexao = new ConnectionFactory();
            //conexao.GetConnection();

            #endregion Aula 1

            #region Aula 2

            //var notas = new NotasMusicais();

            //IList<INota> musica = new List<INota>
            //{
            //    notas.GetNota("do"),
            //    notas.GetNota("re"),
            //    notas.GetNota("mi"),
            //    notas.GetNota("fa"),
            //    notas.GetNota("fa"),
            //    notas.GetNota("fa"),

            //    notas.GetNota("do"),
            //    notas.GetNota("re"),
            //    notas.GetNota("do"),
            //    notas.GetNota("re"),
            //    notas.GetNota("re"),
            //    notas.GetNota("re"),

            //    notas.GetNota("do"),
            //    notas.GetNota("sol"),
            //    notas.GetNota("fa"),
            //    notas.GetNota("mi"),
            //    notas.GetNota("mi"),
            //    notas.GetNota("mi"),

            //    notas.GetNota("do"),
            //    notas.GetNota("re"),
            //    notas.GetNota("mi"),
            //    notas.GetNota("fa"),
            //    notas.GetNota("fa"),
            //    notas.GetNota("fa")
            //};

            //var piano = new Piano();
            //piano.Toca(musica);

            #endregion Aula 2

            #region Aula 3

            //var historico = new Historico();

            //Contrato contrato = new Contrato(DateTime.Now, "Paulo", TipoContrato.Novo);
            //historico.Adiciona(contrato.SalvaEstado());

            //contrato.AvancaStatus();
            //historico.Adiciona(contrato.SalvaEstado());

            //contrato.AvancaStatus();
            //historico.Adiciona(contrato.SalvaEstado());

            //foreach (var estado in historico.ListaEstado)
            //{
            //    Console.WriteLine(estado.Contrato.Tipo + " | " + estado.DataEstado.ToString("yyyy-MM-dd HH:mm:ss.fffffff", CultureInfo.InvariantCulture));
            //}

            #endregion Aula 3

            #region Aula 4

            //IExpressao esquerda = new Subtracao(new Numero(10), new Numero(5));
            //IExpressao direita = new Soma(new Numero(2), new Numero(10));

            //IExpressao conta = new Soma(esquerda, direita);
            //var resultado = conta.Avalia();
            //Console.WriteLine(resultado);

            #endregion Aula 4

            #region Aula 5

            //IExpressao esquerda = new Subtracao(new Numero(10), new Numero(5));
            //IExpressao direita = new Soma(new Numero(2), new Numero(10));

            //IExpressao conta = new Soma(esquerda, direita);
            //var resultado = conta.Avalia();
            //Console.WriteLine(resultado);

            ////Impressão
            //var visitor = new ImprimeExpressaoVisitor();
            //var visitorFixo = new ImprimeExpressaoFixaVisitor();
            //conta.Aceita(visitor);
            //conta.Aceita(visitorFixo);

            #endregion Aula 5

            #region Aula 6

            //IMensagem mensagem = new MensagemAdministrador("Paulo");s
            //IEnviador enviador = new EnviaMensagemSMS();
            //mensagem.Enviador = enviador;
            //mensagem.Envia();

            #endregion Aula 6

            #region Aula 7

            //var pedido1 = new Pedido("A", 1000);
            //var pedido2 = new Pedido("B", 5000);

            //var listaProcessamento = new FilaExecucaoPedido();

            //listaProcessamento.Adiciona(new PagaPedido(pedido1));
            //listaProcessamento.Adiciona(new PagaPedido(pedido2));
            //listaProcessamento.Adiciona(new FinalizaPedido(pedido1));
            //listaProcessamento.Processa();

            #endregion Aula 7

            #region Aula 8

            var cliente = new Cliente();
            cliente.Nome           = "Paulo Henrique";
            cliente.Endereco       = "Teste";
            cliente.DataNascimento = DateTime.Parse("20/06/1996");

            var xml = new GeradorXML().GerarXML(cliente);
            Console.WriteLine(xml);

            #endregion Aula 8


            Console.ReadKey();
        }
示例#2
0
        static void Main(string[] args)
        {
            /*
             * ------------------------------
             * AULA 01 - FACTORY
             * ------------------------------
             *
             * IDbConnection conexao = new ConnectionFactory().getConnection();
             *
             * IDbCommand comando = conexao.CreateCommand();
             * comando.CommandText = "SELECT * FROM tabela"; */

            /**
             * ------------------------------
             * AULA 02 - FLYWEIGHT
             * ------------------------------
             * NotasMusicais notas = new NotasMusicais();
             *
             * IList<INota> musica = new List<INota>()
             * {
             *  notas.PegaNota("do"),
             *  notas.PegaNota("re"),
             *  notas.PegaNota("mi"),
             *  notas.PegaNota("fa"),
             *  notas.PegaNota("fa"),
             *  notas.PegaNota("fa")
             * };
             *
             * Piano piano = new Piano();
             * piano.Toca(musica); */

            /**
             * ----------------------------
             * AULA 03 - MEMENTO
             * ----------------------------
             *
             * Contrato contrato = new Contrato(DateTime.Now, "Fulano de Tal", TipoContrato.Novo);
             * Console.WriteLine(contrato.Tipo);
             *
             * Historico historico = new Historico();
             * historico.Adiciona(new Estado(new Contrato(contrato.Data, contrato.Cliente, contrato.Tipo)));
             *
             * contrato.Avanca();
             * historico.Adiciona(new Estado(new Contrato(contrato.Data, contrato.Cliente, contrato.Tipo)));
             * Console.WriteLine(contrato.Tipo);
             *
             * contrato.Avanca();
             * historico.Adiciona(new Estado(new Contrato(contrato.Data, contrato.Cliente, contrato.Tipo)));
             * Console.WriteLine(contrato.Tipo);
             *
             * Console.WriteLine("Histórico 0: " + historico.Pega(0).Contrato.Tipo);
             * Console.WriteLine("Histórico 1: " + historico.Pega(1).Contrato.Tipo); */


            /**
             * ---------------------------------
             * AULA 06 - BRIDGES
             * ---------------------------------
             *
             * IEnviador enviadorEmail = new EnviarPorEmail();
             * IMensagem mensagem = new MensagemCliente("Fulano de Tal Cliente");
             * enviadorEmail.Enviar(mensagem);
             *
             * IEnviador enviadorSms = new EnviarPorSMS();
             * enviadorSms.Enviar(mensagem);
             *
             * IMensagem mensagemAdm = new MensagemAdministrativa("Fulano Admin");
             * enviadorSms.Enviar(mensagemAdm); */


            Cliente    cliente    = new Cliente("Fulano Cliente", "*****@*****.**", 20);
            GeradorXML geradorXML = new GeradorXML();

            Console.WriteLine(geradorXML.GerarXML(cliente));


            Console.ReadKey();
        }