Пример #1
0
        public void SendEmailWhenRegisters(Participante participante)
        {
            var         eventoDao = new EventoDao();
            var         evento    = eventoDao.GetById(participante.IdEvento);
            MailMessage mail      = new MailMessage();

            mail.To.Add(new MailAddress(participante.Email));
            mail.From       = new MailAddress("*****@*****.**");
            mail.Subject    = "Cadastro no evento " + evento.Nome;
            mail.IsBodyHtml = true;
            mail.Body       = "" + participante.Nome + ",</br> Seu cadastro para o evento " + evento.Nome + " foi concluido com sucesso !";

            SmtpClient client = new SmtpClient("smtp-mail.outlook.com", 587);

            using (client)
            {
                client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "cedro123");
                client.EnableSsl   = true;
                try
                {
                    client.Send(mail);
                }
                catch (Exception ex)
                {
                    Console.Write("Não foi possivel enviar o email, Erro = " + ex.Message);
                }
            }
        }
Пример #2
0
        public void LeaveEvento(int id)
        {
            var eventoDao = new EventoDao();
            var evento    = eventoDao.GetById(id);

            evento.IngressosVendidos--;
            eventoDao.Update(evento);
        }
Пример #3
0
        public void Update(int id, EventoModelView eventoModelView)
        {
            var eventoDao = new EventoDao();
            var evento    = eventoDao.GetById(id);

            evento = PrepareEvento(eventoModelView, evento);
            var emailBll = new EmailBll();

            emailBll.SendMailWhenEventoUpdate(evento);
            eventoDao.Update(evento);
        }
        public bool EventoExist(int id)
        {
            var eventoDao = new EventoDao();
            var evento    = eventoDao.GetById(id);

            if (evento != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
        public bool HaveIngresso(int id)
        {
            var eventoDao = new EventoDao();
            var evento    = eventoDao.GetById(id);

            if (evento.IngressosVendidos < evento.MaximoIngressos)
            {
                evento.IngressosVendidos++;
                eventoDao.Update(evento);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
        public void SendMailWhenEventoDelete(int id)
        {
            var eventoBll         = new EventoDao();
            var evento            = eventoBll.GetById(id);
            var participanteBll   = new ParticipanteBll();
            var listParticipantes = participanteBll.GetParticipantes();

            foreach (var participante in listParticipantes)
            {
                if (participante.IdEvento != evento.IdEvento)
                {
                    continue;
                }
                MailMessage mail = new MailMessage();
                mail.To.Add(new MailAddress(participante.Email));
                mail.From       = new MailAddress("*****@*****.**");
                mail.Subject    = "Alterações no evento  " + evento.Nome;
                mail.IsBodyHtml = true;
                mail.Body       = "" + participante.Nome + ",<br/> Seu evento " + evento.Nome + " foi cancelado, entre em contato para mais detalhes";

                SmtpClient client = new SmtpClient("smtp-mail.outlook.com", 587);
                using (client)
                {
                    client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "cedro123");
                    client.EnableSsl   = true;
                    try
                    {
                        client.Send(mail);
                    }
                    catch (Exception ex)
                    {
                        Console.Write("Não foi possivel enviar o email, Erro = " + ex.Message);
                    }
                }
            }
        }
Пример #7
0
        public Evento GetById(int id)
        {
            var eventoDao = new EventoDao();

            return(eventoDao.GetById(id));
        }