Esempio n. 1
0
        public void Insert(Partiner partiner)
        {
            using (var cn = new SqlConnection())
            {
                var cmd = new SqlCommand();

                cn.ConnectionString = "MinhaConnectionString";
                cmd.Connection      = cn;
                cmd.CommandType     = CommandType.Text;
                cmd.CommandText     = "INSERT INTO PARTICIPANTE (NOME, EMAIL) VALUES (@nome, @email)";

                cmd.Parameters.AddWithValue("nome", partiner.Nome);
                cmd.Parameters.AddWithValue("email", partiner.Email);

                cn.Open();
                cmd.ExecuteNonQuery();
            }
        }
Esempio n. 2
0
 public void Insert(Partiner partiner)
 {
     throw new NotImplementedException();
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            // Configura dependencia
            ConfigureDependecy();

            IPartinerRepository repository = container.GetInstance <IPartinerRepository>();

            //1 - APLICAR: SINGLE RESPONSABILITY PRINCIPLE
            //2 - APLICAR: OPEN CLOSED PRINCIPLE
            //3 - APLICAR: LISKOV SUBSTITUTION PRINCIPLE
            //4 - APLICAR: INTERFACE SEGREGATION PRINCIPLE
            //5 - APLICAR: DEPENDENCY INVERSION PRINCIPLE
            //KISS / YAGNY / DRY
            Console.Write("E-mail para inscrição: ");
            string email = Console.ReadLine();

            Console.Write("Nome da inscrição: ");
            string nome = Console.ReadLine();

            Partiner partiner = new Partiner(nome, email);

            repository.Insert(partiner);


            Console.Write("Rebecer notificação por (1-Email / 2-Tela): ");
            int notificacao = Convert.ToInt32(Console.ReadLine());

            if (notificacao == 1)
            {
                var mail = new MailMessage("*****@*****.**", email);

                var client = new SmtpClient
                {
                    Port                  = 25,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Host                  = "smtp.google.com"
                };

                mail.Subject = "Bem Vindo, " + nome;
                mail.Body    = "Parabéns! Você está cadastrado.";
                client.Send(mail);
            }
            else if (notificacao == 2)
            {
                Console.WriteLine("Bem Vindo, " + nome);
                Console.WriteLine("Parabéns! Você está cadastrado.");
            }
            else if (notificacao == 3)
            {
                //SMS MESSAGE
                //NUMERO CELULAR, MENSAGEM, TITULO
            }

            Console.WriteLine("Cliente cadastrado com sucesso!");

            Console.WriteLine("Lista de Clientes cadastrados");
            ShowPartiners(repository.GetAll());


            Console.WriteLine("Exportar Clientes cadastrados");
            ShowPartiners(repository.GetAll());

            Console.ReadKey();
        }