protected void btnGravar_Click(object sender, EventArgs e) { EmailMkt em = new EmailMkt(); em.Email = ValidParam.ValidarParametro(txtEmail.Text.Trim()); em.Nome = ValidParam.ValidarParametro(txtNome.Text.Trim()); if (em.Existe(txtEmail.Text.Trim()) == true) { lblResultado.Text = "Já existe o e-mail"; } else { if (lblCodigo.Text == "-") { em.Inserir(); } else { em.Codigo = int.Parse(lblCodigo.Text); em.Atualizar(); } Session["Data"] = EmailMkt.Listar(); gridEmailMkt.DataSource = Session["Data"]; gridEmailMkt.DataBind(); btnNovo_Click(sender, e); } }
protected void btnGravar_Click(object sender, EventArgs e) { string controle = "OK"; string strEmail = ""; // Valida se o E-mail foi preenchido if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "") { strEmail = ValidParam.ValidarEditor(txtEmail.Text.Trim()); strEmail = ValidParam.ValidarParametro(txtEmail.Text.Trim()); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; }; if (ValidParam.ValidaEmail(txtEmail.Text) == false) { lblResultado.Text = "Favor preencher um e-mail válido."; controle = "ERRO"; } ; // Valida se é um humano a fazer o cadastro. if (txtCaptcha.Text != Session["CaptchaValue"].ToString()) { lblResultado.Text = "Favor digitar o número conforme imagem apresentada."; controle = "ERRO"; } ; EmailMkt eml = new EmailMkt(); eml.CarregarPorEmail(strEmail); // Valida se nao existir o e-mail. if (eml.Existe(txtEmail.Text) == false) { lblResultado.Text = "Este e-mail já foi cancelado."; controle = "ERRO"; } ; // Verifica se todas as verificações tiveram existo. if (controle == "OK") { eml.Excluir(); lblResultado.Text = "O e-mail : " + eml.Email.ToString() + " foi cancelado com sucesso!"; } }
protected void btnGravar_Click(object sender, EventArgs e) { string controle = "OK"; EmailMkt eml = new EmailMkt(); // Valida Nome if (ValidParam.ValidarParametro(txtNome.Text.Trim()) != "Digite seu nome") { eml.Nome = ValidParam.ValidarParametro(txtNome.Text); } else { lblResultado.Text = "Favor preencher o nome."; controle = "ERRO"; }; // Valida Nome em branco if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtNome.Text.Trim()) != "") { eml.Nome = ValidParam.ValidarParametro(txtNome.Text); } else { lblResultado.Text = "Favor preencher o nome."; controle = "ERRO"; } } ; // Valida se o E-mail foi preenchido if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "Digite seu e-mail") { eml.Email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); eml.Email = ValidParam.ValidarParametro(txtEmail.Text.Trim()); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "") { eml.Email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); eml.Email = ValidParam.ValidarParametro(txtEmail.Text.Trim()); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidaEmail(txtEmail.Text) == false) { lblResultado.Text = "Favor preencher um e-mail válido."; controle = "ERRO"; } } ; // Valida se e-mail já foi cadastrado. if (controle != "ERRO") { if (eml.Existe(txtEmail.Text) == true) { lblResultado.Text = "Este e-mail já esta cadastrado."; controle = "ERRO"; } } ; // Valida se é um humano a fazer o cadastro. if (controle != "ERRO") { if (txtCaptcha.Text != Session["CaptchaValue"].ToString()) { lblResultado.Text = "Favor digitar o número conforme imagem apresentada."; controle = "ERRO"; } } ; // Verifica se todas as verificações tiveram existo. if (controle == "OK") { eml.Inserir(); Email emailfuncionario = new Email(); //E-mail para funcionário entrar em contato com o cliente. emailfuncionario.enviar( "*****@*****.**", "Webmaster", "Mais um futuro cliente..." + eml.Nome + " Código para desconto é " + eml.Codigo.ToString(), "Solicitação de cadastro no Site TBViagens " + eml.Nome); Email emailcliente = new Email(); // Envio de e-mail para o cliente com o código de desconto. lblResultado.Text = emailcliente.enviar( eml.Email.ToString(), eml.Nome.ToString(), "<table width='100%' border='1' cellpadding='0' cellspacing='0'>" + " <tr bgcolor='#599100'> " + " <td> " + " <font color='#FFFFFF' size='+1'> " + " Olá " + eml.Nome + " seja bem vindo(a)" + " </font> " + " </td> " + " </tr>" + " </tr>" + " <td>" + " <table width='100%' border='0'> " + " <td>" + " Comprando um pacote de viagens receba 3% de desconto, encaminhando este e-mail para [email protected] <br><br> " + " Seu código promocional é : " + eml.Codigo.ToString() + "<br>" + " </td>" + " </tr>" + " </table> " + " </td>" + " </tr>" + " </tr>" + " <td>" + "<a href='http://www.tbviagens.com.br'><img src='http://www.tbviagens.com.br/img/logo_tbviagens.png' width='300' height='50'></a>" + " </td>" + " </tr>" + "</table> ", "Solicitação de cadastro no E-mail Maketing do Site TBViagens"); } }
protected void BtnCotacao_Click(object sender, EventArgs e) { string controle = "OK"; string nome_completo = ""; string email; // Valida Nome if (ValidParam.ValidarParametro(txtNomeCompleto.Text.Trim()) != "") { nome_completo = ValidParam.ValidarParametro(txtNomeCompleto.Text); } else { lblResultado.Text = "Favor preencher o nome."; controle = "ERRO"; }; // Valida se o E-mail foi preenchido if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "") { email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); email = ValidParam.ValidarParametro(email); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidaEmail(txtEmail.Text) == false) { lblResultado.Text = "Favor preencher um e-mail válido."; controle = "ERRO"; } } ; // Valida Telefone if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtCelular.Text.Trim()) != "") { txtCelular.Text = ValidParam.ValidarParametro(txtCelular.Text); } else { lblResultado.Text = "Favor preencher o telefone."; controle = "ERRO"; } } ; // Valida Origem if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtOrigem.Text.Trim()) != "") { txtOrigem.Text = ValidParam.ValidarParametro(txtOrigem.Text); } else { lblResultado.Text = "Favor preencher a origem."; controle = "ERRO"; } } ; // Valida Destino if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtDestino.Text.Trim()) != "") { txtDestino.Text = ValidParam.ValidarParametro(txtDestino.Text); } else { lblResultado.Text = "Favor preencher o destino."; controle = "ERRO"; } } ; // Valida Número de Adultos if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtNumeroAdultos.Text.Trim()) != "") { if (ValidParam.ValidarInteiroPositivo(txtNumeroAdultos.Text.Trim()) != false) { txtNumeroAdultos.Text = ValidParam.ValidarParametro(txtNumeroAdultos.Text); } else { lblResultado.Text = "Favor preencher o número de adultos."; controle = "ERRO"; }; } else { lblResultado.Text = "Favor preencher o número de adultos."; controle = "ERRO"; } } ; // Valida Número de Crianças if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtNumeroCriancas.Text.Trim()) != "") { if (ValidParam.ValidarInteiroPositivo(txtNumeroCriancas.Text.Trim()) != false) { txtNumeroCriancas.Text = ValidParam.ValidarParametro(txtNumeroCriancas.Text); } else { lblResultado.Text = "Favor preencher o número de crianças (até 12 anos)."; controle = "ERRO"; }; } else { lblResultado.Text = "Favor preencher o número de crianças (até 12 anos)."; controle = "ERRO"; } } ; // Valida Data de Partida if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtDtPartida.Text.Trim()) != "") { txtDtPartida.Text = ValidParam.ValidarParametro(txtDtPartida.Text); } else { lblResultado.Text = "Favor preencher a data de partida."; controle = "ERRO"; } } ; // Valida Data de Regresso if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtDtRegresso.Text.Trim()) != "") { txtDtRegresso.Text = ValidParam.ValidarParametro(txtDtRegresso.Text); } else { lblResultado.Text = "Favor preencher a data de regresso."; controle = "ERRO"; } } ; //Verifica se a data de partida é menor do que a de regresso if (controle != "ERRO") { if (Convert.ToDateTime(txtDtRegresso.Text.Trim()) < Convert.ToDateTime(txtDtPartida.Text.Trim())) { lblResultado.Text = "Favor preencher a data de regresso maior que a data de partida."; controle = "ERRO"; } } ; // Valida se é um humano a fazer o cadastro. if (controle != "ERRO") { if (txtCaptcha.Text != Session["CaptchaValue"].ToString()) { lblResultado.Text = "Favor digitar o número conforme imagem apresentada."; controle = "ERRO"; } } ; // Verifica se todas as verificações tiveram existo. if (controle == "OK") { ShowMessage.conversaoGoogle(this); Email emailfuncionario = new Email(); //E-mail para funcionário entrar em contato com o cliente. emailfuncionario.enviar( "*****@*****.**", "Webmaster", "<table width='100%' border='1' cellpadding='0' cellspacing='0'>" + " <tr bgcolor='#599100'> " + " <td> " + " <font color='#FFFFFF' size='+1'> " + " O senhor(a) <b> " + txtNomeCompleto.Text + "</b> solita uma reserva do pacote " + " </font> " + " </td> " + " </tr>" + " <tr>" + " <td>" + " <table width='100%' border='0'> " + " <tr>" + " <td align='center'>" + "LIGAR PARA O CLIENTE" + " </td>" + " </tr>" + " <tr>" + "<hr>" + "<b>Dados Pessoais</b><br/>" + "Nome Completo: " + txtNomeCompleto.Text + "<br/>" + "E-mail: " + txtEmail.Text + "<br/>" + "Telefone: " + txtCelular.Text + "<br/>" + "<hr>" + "<b>Dados da Viagem</b><br/>" + "Origem: " + txtOrigem.Text + "<br/>" + "Destino: " + txtDestino.Text + "<br/>" + "Número de Adultos: " + txtNumeroAdultos.Text + "<br/>" + "Número de Crianças: " + txtNumeroCriancas.Text + "<br/>" + "Data da Partida: " + txtDtPartida.Text + "<br/>" + "Data de Regresso: " + txtDtRegresso.Text + "<br/>" + "Observação: " + txtObs.Text + "<br/>" + " </td>" + " </tr>" + " </table> " + " </td> " + " </tr>" + " <td align='center'>" + " <a href='http://www.tbviagens.com.br'><img src='http://www.tbviagens.com.br/img/logo_tbviagens.png' width='300' height='50'></a> <br/>" + " <span class='style2'><a href='http://www.tbviagens.com.br'>www.tbviagens.com.br</a></span><br/>" + " <span class='style1'><strong>(11) 2305-3530</strong></span></td>" + " </td>" + " </tr>" + "</table> " , "Cotação WEB : " + txtNomeCompleto.Text + " " + txtCelular.Text); Email emailcliente = new Email(); // Envio de e-mail para o cliente lblResultado.Text = emailcliente.enviar( txtEmail.Text, txtNomeCompleto.Text, "<table width='100%' border='1' cellpadding='0' cellspacing='0'>" + " <tr bgcolor='#599100'> " + " <td> " + " <font color='#FFFFFF' size='+1'> " + " Olá <b>" + txtNomeCompleto.Text + "! </b>" + " </font> " + " </td> " + " </tr>" + " <tr>" + " <td>" + " <table width='100%' border='0'> " + " <tr>" + " <td>" + "<br/>" + " Meu nome é Priscila, faço parte da <b>TBViagens</b> e fiquei muito feliz pelo seu contato. :) </b><br/><br/>" + " Estou lhe escrevendo apenas para dizer que recebemos a sua solicitação de reserva, tá legal?<br/><br/>" + " Já estou organizando tudo aqui e dentro de algumas horas você receberá um novo e-mail meu já com a reserva.<br/><br/>" + " Até lá, acompanhe a gente nas redes sociais: <a href='https://www.facebook.com/tbviagens'> Facebook</a>, <a href='https://www.youtube.com/channel/UC-tTX62jaV8wH7fx-kp7A0g'>Youtube</a> e <a href='https://www.instagram.com/tbviagens/'>Instagram</a>! <br/><br/>" + " Um abraço <br/><br/><br/>" + " Priscila " + " </td>" + " </tr>" + " </table> " + " </td> " + " </tr>" + " <td align='center'>" + " <a href='http://www.tbviagens.com.br'><img src='http://www.tbviagens.com.br/img/logo_tbviagens.png' width='300' height='50'></a> <br/>" + " <span class='style2'><a href='http://www.tbviagens.com.br'>www.tbviagens.com.br</a></span><br/>" + " <span class='style1'><strong>(11) 2305-3530</strong></span></td>" + " </td>" + " </tr>" + "</table> ", "Solicitação de Reserva de Pacote Turístico feita a TBViagens em " + DateTime.Today.ToString("dd/MM/yyyy")); // Grava cliente na base de dados. EmailMkt eml = new EmailMkt(); eml.Email = txtEmail.Text; eml.Nome = txtNomeCompleto.Text; if (eml.Existe(txtEmail.Text) != true) { eml.Inserir(); } ; lblResultado.Text = "Solicitação de reserva enviada com sucesso!"; Session["nome_cliente"] = txtNomeCompleto.Text; Response.Redirect("obrigado.aspx"); } }
protected void btnGravar_Click(object sender, EventArgs e) { string controle = "OK"; EmailMkt eml = new EmailMkt(); // Valida Nome if (ValidParam.ValidarParametro(txtNome.Text.Trim()) != "Digite seu nome") { eml.Nome = ValidParam.ValidarParametro(txtNome.Text); } else { lblResultado.Text = "Favor preencher o nome."; controle = "ERRO"; }; // Valida Nome em branco if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtNome.Text.Trim()) != "") { eml.Nome = ValidParam.ValidarParametro(txtNome.Text); } else { lblResultado.Text = "Favor preencher o nome."; controle = "ERRO"; } } ; // Valida se o E-mail foi preenchido if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "Digite seu e-mail") { eml.Email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); eml.Email = ValidParam.ValidarParametro(txtEmail.Text.Trim()); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "") { eml.Email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); eml.Email = ValidParam.ValidarParametro(txtEmail.Text.Trim()); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidaEmail(txtEmail.Text) == false) { lblResultado.Text = "Favor preencher um e-mail válido."; controle = "ERRO"; } } ; // Valida se é um humano a fazer o cadastro. if (controle != "ERRO") { if (txtCaptcha.Text != Session["CaptchaValue"].ToString()) { lblResultado.Text = "Favor digitar o número conforme imagem apresentada."; controle = "ERRO"; } } ; // Verifica se todas as verificações tiveram existo. if (controle == "OK") { // Valida se e-mail já foi cadastrado. if (eml.Existe(txtEmail.Text) == false) { eml.Inserir(); } ; Email emailfuncionario = new Email(); //E-mail para funcionário entrar em contato com o cliente. emailfuncionario.enviar( "*****@*****.**", "Webmaster", "Cliente se cadastrou no sorteio: " + eml.Nome + " E-mail: " + eml.Email.ToString(), "Inscrição do Sorteio no Site TBViagens " + eml.Nome); Email emailcliente = new Email(); // Envio de e-mail para o cliente com o código de desconto. lblResultado.Text = emailcliente.enviar( eml.Email.ToString(), eml.Nome.ToString(), "<table width='100%' border='1' cellpadding='0' cellspacing='0'>" + " <tr bgcolor='#599100'> " + " <td> " + " <font color='#FFFFFF' size='+1'> " + " Olá " + eml.Nome + " sua inscrição foi realializada com sucesso!" + " </font> " + " </td> " + " </tr>" + " </tr>" + " <td>" + " <table width='100%' border='0'> " + " <td>" + " Boa Sorte! <br><br> " + " </td>" + " </tr>" + " </table> " + " </td>" + " </tr>" + " </tr>" + " <td>" + "<a href='http://www.tbviagens.com.br'><img src='http://www.tbviagens.com.br/img/logo_tbviagens.png' width='300' height='50'></a>" + " </td>" + " </tr>" + "</table> ", "Inscrição para Sorteio no Site TBViagens"); } }
protected void BtnCotacao_Click(object sender, EventArgs e) { string controle = "OK"; string nome_completo = ""; string email; // Valida Nome if (ValidParam.ValidarParametro(txtNomeCompleto.Text.Trim()) != "") { nome_completo = ValidParam.ValidarParametro(txtNomeCompleto.Text); } else { lblResultado.Text = "Favor preencher o nome ou apelido."; controle = "ERRO"; }; // Valida se o E-mail foi preenchido if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtEmail.Text.Trim()) != "") { email = ValidParam.ValidarEditor(txtEmail.Text.Trim()); email = ValidParam.ValidarParametro(email); } else { lblResultado.Text = "Favor preencher o e-mail."; controle = "ERRO"; } } ; if (controle != "ERRO") { if (ValidParam.ValidaEmail(txtEmail.Text) == false) { lblResultado.Text = "Favor preencher um e-mail válido."; controle = "ERRO"; } } ; // Valida Telefone if (controle != "ERRO") { if (ValidParam.ValidarParametro(txtCelular.Text.Trim()) != "") { txtCelular.Text = ValidParam.ValidarParametro(txtCelular.Text); } else { lblResultado.Text = "Favor preencher o telefone."; controle = "ERRO"; } } ; // Verifica se todas as verificações tiveram existo. if (controle == "OK") { ShowMessage.conversaoGoogle(this); Session["nome_cliente"] = txtNomeCompleto.Text; Email emailfuncionario = new Email(); //E-mail para funcionário entrar em contato com o cliente. emailfuncionario.enviar("*****@*****.**", "Webmaster", "<table width='100%' border='1' cellpadding='0' cellspacing='0'>" + " <tr bgcolor='#599100'> " + " <td> " + " <font color='#FFFFFF' size='+1'> " + " O senhor(a) <b> " + txtNomeCompleto.Text + "</b> solita uma cotação do pacote " + " </font> " + " </td> " + " </tr>" + " <tr>" + " <td>" + " <table width='100%' border='0'> " + " <tr>" + " <td align='center'>" + "Lead ativado" + " </td>" + " </tr>" + " <tr>" + "<hr>" + "<b>Dados Pessoais</b><br/>" + "Nome Completo: " + txtNomeCompleto.Text + "<br/>" + "E-mail: " + txtEmail.Text + "<br/>" + "Telefone: " + txtCelular.Text + "<br/>" + "<hr>" + " </td>" + " </tr>" + " </table> " + " </td> " + " </tr>" + " <td align='center'>" + " <a href='http://www.tbviagens.com.br'><img src='http://www.tbviagens.com.br/img/logo_tbviagens.png' width='300' height='50'></a> <br/>" + " <span class='style2'><a href='http://www.tbviagens.com.br'>www.tbviagens.com.br</a></span><br/>" + " <span class='style1'><strong>(11) 2305-3530</strong></span></td>" + " </td>" + " </tr>" + "</table> " , "Cotação WEB : " + txtNomeCompleto.Text + " " + txtCelular.Text); // Grava cliente na base de dados. EmailMkt eml = new EmailMkt(); eml.Email = txtEmail.Text; eml.Nome = txtNomeCompleto.Text; if (eml.Existe(txtEmail.Text) != true) { eml.Inserir(); } ; EmailFluxo ef = new EmailFluxo(); ef.Cd_Email = eml.Codigo; ef.Cd_Pacote = int.Parse(Request.QueryString["CD_PACOTE"].ToString()); if (ef.Valida() == false) { ef.InserirNoAgendador(); if (ef.Carregar()) { Email emailcliente = new Email(); // Envio de e-mail para o cliente string corpo; corpo = ""; // PNOME corpo = ef.Corpo_Email.ToString().Replace("*|PNOME|*", txtNomeCompleto.Text); lblResultado.Text = emailcliente.enviar(txtEmail.Text, txtNomeCompleto.Text, corpo, ef.Titulo_Email); ef.AtualizarStatusEmailEnviado("S", ef.Codigo.ToString()); //Grava log de envio Envio ev = new Envio(); ev.Envia(ef.Cd_Email.ToString(), ef.Cd_Pacote.ToString(), ef.Codigo.ToString()); } ; } lblResultado.Text = "Cotação enviada com sucesso!"; Response.Redirect("obrigado.aspx"); } }