Exemple #1
0
        //[Compress]
        public JsonResult DescadastrarGravar(FormCollection collection)
        {
            int idcampanha = Convert.ToInt32(collection["idcampanha"]);
            int idaluno    = Convert.ToInt32(collection["idaluno"]);

            foreach (var s in collection)
            {
                if (Convert.ToString(s) == "mail_todos")
                {
                    Aluno aluno = new AlunoDB().Buscar(idaluno);
                    aluno.envio_email = Convert.ToInt32(collection["mail_todos"]);
                    aluno.Alterar();
                }
                else
                {
                    if (Convert.ToString(s).Substring(0, 4) == "chk_")
                    {
                        Aluno_curso aluno_curso = new Aluno_cursoDB().Buscar(Convert.ToInt32(Convert.ToString(s).Replace("chk_", "")));
                        aluno_curso.envio_email = Convert.ToInt32(collection[Convert.ToString(s)]);
                        aluno_curso.Alterar();
                    }
                }
            }

            //Verifica se já existe gravado o descadastramento para este aluno/curso
            bool existe = false;

            existe = new CampanhasDB().DescadastrarBusca(idcampanha, idaluno);
            if (!existe)
            {
                new CampanhasDB().Descadastrar(idcampanha, idaluno);
            }

            return(Json(new Retorno()));
        }
Exemple #2
0
        public Retorno Completar(int aluno, string cep, string endereco, string bairro, string cidade, string estado, string numero, string complemento)
        {
            Retorno retorno = new Retorno();

            if (aluno != 0)
            {
                AlunoDB db   = new AlunoDB();
                Aluno   alun = db.Buscar(aluno);


                if (alun != null)
                {
                    alun.cep         = cep;
                    alun.endereco    = endereco;
                    alun.bairro      = bairro;
                    alun.cidade      = cidade;
                    alun.estado      = estado;
                    alun.numero      = numero;
                    alun.complemento = complemento;
                    alun.flcorrecao  = 1;
                    alun.Alterar();

                    retorno.erro     = false;
                    retorno.mensagem = "Redirecionando...";
                    retorno.id       = alun.codigo;
                }
            }
            else
            {
                retorno.erro     = true;
                retorno.mensagem = "Conteúdo vazio";
            }
            return(retorno);
        }
Exemple #3
0
        public Retorno Esqueceu(string esqueceu)
        {
            Retorno retorno = new Retorno();

            if (esqueceu.Length > 2)
            {
                Aluno aluno = new AlunoDB().Email(esqueceu);

                if (aluno == null)
                {
                    retorno.retorno  = 0;
                    retorno.mensagem = "Dados incorretos.";
                }
                else
                {
                    retorno.retorno = 1;
                    retorno.id      = aluno.codigo;
                    new Envio_email()
                    {
                        para    = aluno.email,
                        assunto = "Dados de acesso - Cenbrap",
                        texto   = "Segue os dados de acceso conforme solicitado.<BR>Usuário: " + aluno.email + "<BR>Senha: " + aluno.senha
                    }.Salvar();
                    retorno.mensagem = "Dados enviados com sucesso.";
                }
            }
            else
            {
                retorno.retorno  = 0;
                retorno.mensagem = "Dados incorretos.";
            }

            return(retorno);
        }
Exemple #4
0
        public ActionResult Comunicado(string turma = "", int aluno = 0)
        {
            Aluno      al         = new AlunoDB().Buscar(aluno);
            Curso      curso      = new CursoDB().Buscar(turma);
            Comunicado comunicado = new ComunicadoDB().Buscar(curso.codigo, aluno);

            ViewBag.form = comunicado;

            if ((al != null) && (curso != null))
            {
                Aluno_curso     aluno_curso = new Aluno_cursoDB().Buscar(curso, al);
                Curso_adiamento adiamento   = new Curso_adiamentoDB().Ultimo(curso);
                Titulo_curso    titulo      = new Titulo_cursoDB().Buscar(curso.titulo_curso.codigo);

                if (aluno_curso != null)
                {
                    ViewBag.turma     = curso.titulo;
                    ViewBag.codturma  = curso.codigo;
                    ViewBag.aluno     = al.nome;
                    ViewBag.codaluno  = aluno;
                    ViewBag.adiamento = adiamento.para;
                    ViewBag.titulo    = titulo.titulo;
                    ViewBag.cursos    = new CursoDB().CursosHome(0, 0, 0);
                }
            }

            return(View());
        }
Exemple #5
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //pega o cookies painel
            HttpCookie cookie = HttpContext.Current.Request.Cookies["cenbrap_aluno"];

            //verifica se o cookie possui valor
            if (cookie != null)
            {
                //pega o valor do cookie
                int codigo = Convert.ToInt32(cookie.Value);

                //abre o painel e pesquisa no db
                AlunoDB DB   = new AlunoDB();
                Aluno   user = DB.Buscar(codigo);

                //verifica se o usuário existe
                if (user != null)
                {
                    base.OnActionExecuting(filterContext);
                }
                else
                {
                    //se não existe, redireciona para o index.
                    filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Login", action = "Index" }));
                }
            }
            else
            {
                //se os cookeis não existem, redireciona para o index
                filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Login", action = "Index" }));
            }
        }
Exemple #6
0
        public JsonResult Pagseguro(int id, int curso = 0)
        {
            Retorno retorno = new Retorno();

            Curso c;

            if (curso == 0)
            {
                c = new CursoDB().Buscar(300);
            }
            else
            {
                c = new CursoDB().Buscar(curso);
            }

            Aluno aluno = new AlunoDB().Buscar(id);

            if (aluno == null)
            {
                retorno.erro     = true;
                retorno.mensagem = "Não foi possível localizar o aluno.";
            }
            else
            {
                retorno = new Inclusao().Incluir(c, aluno, 9);
            }

            return(Json(retorno));
        }
Exemple #7
0
        public JsonResult ComunicadoFinalizar(int tipo, int curso, string dados, string turma, int aluno)
        {
            Comunicado comunicado = new Comunicado();

            comunicado.turma     = turma;
            comunicado.aluno     = aluno;
            comunicado.tipo      = tipo;
            comunicado.novocurso = curso;
            comunicado.dados     = dados;
            comunicado.Salvar();
            string result = "Informações gravadas com sucesso";

            Aluno           al        = new AlunoDB().Buscar(aluno);
            Curso           cur       = new CursoDB().Buscar(curso);
            Curso           cur2      = new CursoDB().Buscar(Convert.ToInt32(turma));
            Curso_adiamento adiamento = new Curso_adiamentoDB().Ultimo(cur2);

            ContaEnvio  contaEnvio = new ContaEnvio(1, "Cenbrap", "*****@*****.**", "*****@*****.**", "databenq206");
            EnviarEmail e          = new EnviarEmail();
            string      para       = "*****@*****.**";
            string      assunto    = "Comunicado CENBRAP - Formulário de adiamento de turma";
            string      msg        = "";

            msg += "Comunicado CENBRAP - Envio automático do formulário de adiamento de turma<br><br>Prezado(a) Aluno(a);<br><br>A Coordenação Pedagógica do Cenbrap procederá à seguinte alteração no seu cadastro, conforme sua autorização descrita abaixo.<br><br><strong>";
            msg += "TURMA: " + cur2.titulo + " - " + cur2.titulo1;
            msg += "<br>ALUNO: " + al.nome;
            msg += "<br>E-MAIL: " + al.email;
            if (tipo == 1)
            {
                msg += "<br>OPÇÃO: Quero continuar";
                msg += "<br><span style='background-color: yellow;'>NOVA DATA PREVISTA: " + adiamento.para.ToShortDateString() + "</span>";
            }
            if (tipo == 2)
            {
                msg += "<br>OPÇÃO: Quero mudar de turma/curso";
                msg += "<br>NOVA TURMA: " + cur.titulo + " - " + cur.titulo1;
            }
            if (tipo == 3)
            {
                msg += "<br>OPÇÃO: Quero meu dinheiro de volta";
                msg += "<br>DADOS: " + dados;
            }
            if (tipo == 4)
            {
                msg += "<br>OPÇÃO: Quero converter minha matrícula em assinatura do Medtv por 18 meses";
            }
            msg += "</strong><br><Br>Qualquer dúvida, entre em contato conosco.<br>Att,<br>Márcia Barros<br>Assessoria de Comunicação";

            string r  = e.EnviaMensagemEmail(para, assunto, msg, 0, contaEnvio, false);
            string r2 = e.EnviaMensagemEmail(al.email, assunto, msg, 0, contaEnvio, false);

            return(Json(result));
        }
Exemple #8
0
        public Retorno LoginMedTV(string email, string senha, int lembrar, bool entrar = false)
        {
            Retorno retorno = new Retorno();

            if (email.Length > 2 && senha.Length > 2)
            {
                Aluno aluno = new AlunoDB().BuscarMedTV(email, senha);

                if (aluno == null)
                {
                    retorno.retorno  = 0;
                    retorno.mensagem = "Dados incorretos.";
                }
                else
                {
                    if (new Aluno_MedTVDB().Ativo(aluno))
                    {
                        if (entrar)
                        {
                            CookiesMedTV(aluno.codigo, lembrar);
                        }

                        retorno.retorno  = 1;
                        retorno.id       = aluno.codigo;
                        retorno.mensagem = "Redirecionando...";

                        string _ga = Cookies_ga();
                        if (_ga != null && _ga != "")
                        {
                            new Aluno_navegacaoDB().Existe(aluno, _ga);
                        }
                    }
                    else
                    {
                        if (entrar)
                        {
                            CookiesMedTVAtivar(aluno.codigo);
                        }

                        retorno.retorno  = 2;
                        retorno.id       = aluno.codigo;
                        retorno.mensagem = "Ativar";
                    }
                }
            }
            else
            {
                retorno.retorno  = 0;
                retorno.mensagem = "Dados incorretos.";
            }

            return(retorno);
        }
Exemple #9
0
        public Retorno Login(string login, string senha, bool entrar = false)
        {
            Retorno retorno = new Retorno();

            if (login.Length > 2 && senha.Length > 2)
            {
                Aluno aluno = new AlunoDB().Buscar(login, senha);

                if (aluno == null)
                {
                    retorno.retorno  = 0;
                    retorno.mensagem = "Dados incorretos.";
                }
                else
                {
                    if (entrar)
                    {
                        CookiesPortal(aluno.codigo);
                    }

                    if (aluno.cep == "" || aluno.endereco == "" || aluno.cidade == "" || aluno.estado == "" || aluno.flcorrecao == 0)
                    {
                        retorno.retorno = 2;
                        retorno.id      = aluno.codigo;
                        retorno.link    = aluno.email;
                    }
                    else
                    {
                        retorno.retorno = 1;
                        retorno.id      = aluno.codigo;
                        retorno.link    = aluno.email;
                    }
                    retorno.mensagem = "Redirecionando...";

                    string _ga = Cookies_ga();
                    if (_ga != null && _ga != "")
                    {
                        new Aluno_navegacaoDB().Existe(aluno, _ga);
                    }
                }
            }
            else
            {
                retorno.retorno  = 0;
                retorno.mensagem = "Dados incorretos.";
            }

            return(retorno);
        }
Exemple #10
0
        public Aluno CPF(string cpf)
        {
            Aluno retorno = null;

            cpf = cpf.Replace(".", "").Replace("-", "").Replace(" ", "").Replace("/", "");

            if (cpf.Length == 11)
            {
                retorno = new AlunoDB().CPF(cpf);

                if (retorno != null)
                {
                    retorno.senha = "";
                }
            }
            return(retorno);
        }
Exemple #11
0
        protected void btn_salvar_Click(object sender, EventArgs e)
        {
            Aluno aluno = new Aluno()
            {
                ra = int.Parse(txt_RA.Text),
                //curso = Convert.ToInt64(ddlCursos.Text),
                curso            = ddlCursos.Text,
                data_de_ingresso = Convert.ToDateTime(txtDataIngressao.Text),
                nome_completo    = txtNomeCompleto.Text,
                rg                   = Convert.ToInt32(txtRG.Text),
                cpf                  = Convert.ToInt32(txtcpf.Text),
                telefone_fixo        = txtTelefone.Text,
                telefone_celular     = txtCelular.Text,
                nacionalidade        = Convert.ToInt32(ddlPaises.Text),
                nome_pai             = txt_nome_pai.Text,
                nome_mae             = txt_nome_mae.Text,
                end_cep              = txtCEP.Text,
                end_complemento      = txt_complemento.Text,
                end_bairro           = txt_bairro.Text,
                end_cidade           = txt_cidade.Text,
                tipo_logradouro      = txt_tipo_logradouro.Text,
                end_rua              = txtEnd.Text,
                telefone_emergencial = txt_tel_emergencia.Text,
                data_nascimento      = Convert.ToDateTime(txtDTNascimento.Text),
                email                = txtEmail.Text,
                sexo_id              = Convert.ToInt32(ddlSexo.Text),
                status_id            = Convert.ToInt32(ddlStatus.Text),
                tipo_id              = Convert.ToInt32(ddlTipo.Text),
                dt_inclusao          = Convert.ToDateTime(txt_dt_inclusao.Text),
                data_alteracao       = Convert.ToDateTime(txt_dt_alteracao.Text),
            };

            AlunoDB alunoDB = new AlunoDB();
            bool    status  = alunoDB.Salvar(aluno);


            if (status)
            {
                lblMSG.Text = "Registro Inserido!";
                LimparComponentes();
            }
            else
            {
                lblMSG.Text = "Erro ao inserir registro";
            }
        }
Exemple #12
0
        protected void btn_salvar_Click(object sender, EventArgs e)
        {
            Aluno aluno = new Aluno()
            {
                Ra                   = txt_RA.Text,
                Curso                = ddlCursos.Text,
                Data_de_ingresso     = Convert.ToDateTime(txtDataIngressao.Text),
                Nome_completo        = txtNomeCompleto.Text,
                Rg                   = txtRG.Text,
                Cpf                  = txtcpf.Text,
                Telefone_fixo        = txtTelefone.Text,
                Telefone_celular     = txtCelular.Text,
                Nacionalidade        = ddlPaises.Text,
                Nome_pai             = txt_nome_pai.Text,
                Nome_mae             = txt_nome_mae.Text,
                End_cep              = txtCEP.Text,
                End_complemento      = txt_complemento.Text,
                End_bairro           = txt_bairro.Text,
                End_cidade           = txt_cidade.Text,
                Tipo_logradouro      = txt_tipo_logradouro.Text,
                End_rua              = txtEnd.Text,
                Telefone_emergencial = txt_tel_emerg.Text,
                Data_nascimento      = Convert.ToDateTime(txtDTNascimento.Text),
                Email                = txtEmail.Text,
                Sexo_id              = ddlSexo.Text,
                Status_id            = ddlStatus.Text,
                Tipo_id              = ddlTipo.Text,
                Dt_inclusao          = Convert.ToDateTime(txt_dt_inclusao.Text),
                Data_alteracao       = Convert.ToDateTime(txt_dt_alteracao.Text),
            };

            AlunoDB alunoDB = new AlunoDB();
            bool    status  = alunoDB.Salvar(aluno);

            if (status)
            {
                Response.Write("<script>alert('Registro Inserido com Sucesso!');</script>");
                LimparComponentes();
            }
            else
            {
                Response.Write("<script>alert('Erro ao tentar inserir!');</script>");
            }
        }
Exemple #13
0
        public void Enviar()
        {
            string assunto = "Boas Vindas #NOME# - Cenbrap";
            string msg     = "Bom dia!<br><br>Fico feliz em ver seu recente cadastro em nosso site.<br><br>Meu nome é Marcia e escrevo-lhe apenas para me colocar à disposição no que precisar.<br><br>Qualquer informação, dúvida, etc., conte comigo, seja através deste e-mail, ou do telefone 0300 - 313 - 1538.<br><br>Receba minhas boas-vindas e também de toda nossa equipe!<br><br>Marcia Barros<br>[email protected]<br>0300 - 313 - 1538<br><br><img src='http://cenbrap.com.br/images/cenbrap_logo.png' width='150'>";

            //msg com o titulo do curso.
            msg = "Bom dia!<br><br>Fico feliz em ver seu recente cadastro em nosso site, e seu interesse no curso de #TITULOCURSO#.<br><br>Meu nome é Marcia e escrevo-lhe apenas para me colocar à disposição no que precisar.<br><br>Qualquer informação, dúvida, etc., conte comigo, seja através deste e-mail, ou do telefone 0300 - 313 - 1538.<br><br>Receba minhas boas-vindas e também de toda nossa equipe!<br><br>Marcia Barros<br>[email protected]<br>0300 - 313 - 1538<br><br><img src='http://cenbrap.com.br/images/cenbrap_logo.png' width='150'>";

            DateTime hoje   = DateTime.Now;
            DateTime inicio = DateTime.Now.AddDays(-1);
            DateTime fim    = DateTime.Now.AddDays(-1);

            if (hoje.DayOfWeek == DayOfWeek.Monday)
            {
                inicio = DateTime.Now.AddDays(-3);
            }

            List <Aluno> alunos = new AlunoDB().Listar(inicio.Date, fim.Date, "Boas Vindas%");

            foreach (var a in alunos)
            {
                string nome = "";
                if (a.sexo.ToLower().Substring(0, 1) == "F")
                {
                    nome = "Dra. ";
                }
                else
                {
                    nome = "Dr. ";
                }
                nome += a.nome;
                Envio_email ev = new Envio_email()
                {
                    para        = a.email,
                    assunto     = assunto.Replace("#NOME#", nome),
                    texto       = msg.Replace("#TITULOCURSO#", a.endereco),
                    data        = DateTime.Now,
                    envio_email = "*****@*****.**"
                };
                new Envio_emailDB().Salvar(ev);
            }
        }
Exemple #14
0
        public ActionResult Index(int aluno = 0, int curso = 0)
        {
            Retorno retorno = new Retorno();

            Curso c = new CursoDB().Buscar(curso);

            if (c == null || c.ativo == 0)
            {
                retorno.erro = true;
                if (c.ativo == 0)
                {
                    retorno.mensagem = "Curso com matrículas encerradas.";
                }
                else
                {
                    retorno.mensagem = "Ocorreu, tente novamente no site";
                }
            }
            else
            {
                Aluno a = new AlunoDB().Buscar(aluno);

                if (a == null)
                {
                    retorno.erro     = true;
                    retorno.mensagem = "Não foi possível localizar o aluno.";
                }
                else
                {
                    retorno = new Inclusao().Incluir(c, a, 3, pagImprimirBoleto: true);
                }
            }

            if (retorno.erro)
            {
                return(View(retorno));
            }
            else
            {
                return(Redirect(retorno.link));
            }
        }
Exemple #15
0
        public ActionResult PreMatricula(string curso, int aluno)
        {
            Curso c = new Curso();

            if (curso.All(char.IsDigit))
            {
                c = new CursoDB().Buscar(Convert.ToInt32(curso));
            }
            else
            {
                c = new CursoDB().Buscar(curso);
            }
            //Curso c = new CursoDB().Buscar(curso);
            Aluno a = new AlunoDB().Buscar(aluno);

            if (c == null || a == null)
            {
                return(RedirectToAction("index"));
            }

            return(View(new ContratoView(aluno, c.codigo)));
        }
Exemple #16
0
        public ActionResult Contrato(string curso, int aluno)
        {
            Curso c = new Curso();

            if (curso.All(char.IsDigit))
            {
                c = new CursoDB().Buscar(Convert.ToInt32(curso));
            }
            else
            {
                c = new CursoDB().Buscar(curso);
            }

            //Curso c = new CursoDB().Buscar(curso);
            Aluno a = new AlunoDB().Buscar(aluno);

            Aluno_cursoDB db  = new Aluno_cursoDB();
            int           qtd = db.Qtd(c);

            bool matriculado = new Aluno_cursoDB().MatriculadoCurso(aluno, c.codigo);

            if (matriculado)
            {
                return(RedirectToAction("Turma/" + curso + "/Matriculado/" + aluno));
            }
            else
            {
                if (c == null || a == null)
                {
                    return(RedirectToAction("index"));
                }

                //apenas pre-matricula
                if (c.ativo == 0)
                {
                    new Inclusao().PreMatricula(c, a);
                    return(RedirectToAction("Turma/" + curso + "/PreMatricula/" + aluno));
                }
                else
                {
                    if (c.vagas_esgotadas == 1)
                    {
                        new Inclusao().PreMatricula(c, a);
                        return(RedirectToAction("Turma/" + curso + "/ListaEspera/" + aluno));
                    }
                    else
                    {
                        if (a.cep == "" || a.endereco == "")
                        {
                            return(RedirectToAction("Turma/" + curso + "/Completar /" + aluno));
                        }
                    }

                    if (qtd >= c.total_alunos)
                    {
                        new Inclusao().PreMatricula(c, a);
                        return(RedirectToAction("Turma/" + curso + "/ListaEspera/" + aluno));
                    }
                    else
                    {
                        if ((qtd + 1) == c.total_alunos)
                        {
                            new Envio_emailDB().Salvar(new Envio_email()
                            {
                                para    = "[email protected];[email protected];[email protected]",
                                assunto = "Turma " + c.titulo1 + " - Limite de alunos atingido",
                                texto   = "A turma " + c.titulo1 + " teve seu limite de alunos (" + c.total_alunos + ") atingido em " + DateTime.Now + ".<br>Último cadastro realizado pelo aluno(a) " + a.nome,
                                data    = DateTime.Now
                            });
                        }

                        return(View(new ContratoView(aluno, c.codigo)));
                    }
                }
            }
        }
Exemple #17
0
        public Retorno Cadastro(AlunoCadastrar alunoview)
        {
            Retorno retorno = new Retorno();

            if (alunoview != null)
            {
                alunoview.cpf   = alunoview.cpf.TrimStart().TrimEnd();
                alunoview.email = alunoview.email.TrimStart().TrimEnd();

                if (new AlunoDB().ExisteEmail(alunoview.email) && alunoview.codigo == 0)
                {
                    retorno.erro     = true;
                    retorno.mensagem = "E-mail já cadastrado";
                }
                else
                {
                    Aluno aluno = new Aluno();
                    if (alunoview.codigo == 0)
                    {
                        Aluno alunoCPF = new AlunoDB().CPF(alunoview.cpf);
                        if (alunoCPF != null)
                        {
                            aluno = alunoview.Atualizar(alunoCPF);
                            aluno.Alterar();
                        }
                        else
                        {
                            aluno = alunoview.Retornar();
                            aluno.Salvar();
                        }
                    }
                    else
                    {
                        aluno = alunoview.Atualizar(new AlunoDB().Buscar(alunoview.codigo));
                        aluno.Alterar();
                    }

                    retorno.erro     = false;
                    retorno.mensagem = "Redirecionando...";
                    retorno.id       = new AlunoDB().CPF(alunoview.cpf).codigo;

                    string _ga = Cookies_ga();
                    if (_ga != null && _ga != "")
                    {
                        new Aluno_navegacaoDB().Existe(aluno, _ga);

                        //seleciona dos os _ga do periodo de lead (newsletter)
                        foreach (var n in new Newsletter_navegacaoDB().ListarEmail(aluno.email))
                        {
                            new Aluno_navegacaoDB().Existe(aluno, n._ga);
                        }
                    }
                }
            }
            else
            {
                retorno.erro     = true;
                retorno.mensagem = "Conteúdo vazio";
            }
            return(retorno);
        }
Exemple #18
0
        public Retorno CadastroMedTV(string nome, string email, string senha, string cpf, string ddd, string telefone, string cep, string endereco, string bairro, string cidade, string estado, string numero, string complemento)
        {
            Retorno retorno = new Retorno();

            if (nome != null && email != null && senha != null && cpf != null && nome != "" && email != "" && senha != "" && cpf != "")
            {
                cpf   = cpf.TrimStart().TrimEnd();
                email = email.TrimStart().TrimEnd();

                AlunoDB db    = new AlunoDB();
                Aluno   a_cpf = db.CPF(cpf);

                if (a_cpf != null)
                {
                    a_cpf.cep         = cep;
                    a_cpf.numero      = numero;
                    a_cpf.complemento = complemento;
                    a_cpf.endereco    = endereco;
                    a_cpf.bairro      = bairro;
                    a_cpf.cidade      = cidade;
                    a_cpf.estado      = estado;
                    a_cpf.ddd         = ddd;
                    a_cpf.telefone    = telefone;
                    a_cpf.flcorrecao  = 1;

                    a_cpf.Alterar();

                    Aluno_MedTV am = new Aluno_MedTVDB().Buscar(a_cpf);
                    if (am != null)
                    {
                        am.senha = senha;
                        am.Alterar();
                    }
                    else
                    {
                        am = new Aluno_MedTV()
                        {
                            aluno = a_cpf,
                            senha = senha
                        };
                        am.Salvar();
                    }
                    retorno.erro     = false;
                    retorno.mensagem = "Redirecionando...";
                    retorno.id       = a_cpf.codigo;
                    CookiesMedTVAtivar(retorno.id);
                }
                else
                {
                    if (new AlunoDB().ExisteEmail(email))
                    {
                        retorno.erro     = true;
                        retorno.mensagem = "E-mail já cadastrado";
                    }
                    else
                    {
                        Aluno aluno = new Aluno()
                        {
                            nome        = nome,
                            senha       = senha,
                            cpf         = cpf,
                            email       = email,
                            ddd         = ddd,
                            telefone    = telefone,
                            cep         = cep,
                            endereco    = endereco,
                            bairro      = bairro,
                            cidade      = cidade,
                            estado      = estado,
                            numero      = numero,
                            complemento = complemento,
                            flcorrecao  = 1
                        };
                        aluno.Salvar();

                        Aluno_MedTV am = new Aluno_MedTV()
                        {
                            aluno = aluno,
                            senha = senha
                        };
                        am.Salvar();

                        retorno.erro     = false;
                        retorno.mensagem = "Redirecionando...";
                        retorno.id       = aluno.codigo;
                        CookiesMedTVAtivar(retorno.id);
                    }
                }
            }
            else
            {
                retorno.erro     = true;
                retorno.mensagem = "Conteúdo vazio";
            }
            return(retorno);
        }
Exemple #19
0
        protected override IAsyncResult BeginExecuteCore(AsyncCallback callback, object state)
        {
            string _ga           = Cookies_ga();
            string identificador = "";

            if (Request.QueryString["identificador"] != null)
            {
                if (Request.QueryString["identificador"] != "")
                {
                    identificador = Request.QueryString["identificador"];
                }
            }
            if (Request.QueryString["_identificador"] != null)
            {
                if (Request.QueryString["_identificador"] != "")
                {
                    identificador = Request.QueryString["_identificador"];
                }
            }
            if (Request.QueryString["_id"] != null)
            {
                if (Request.QueryString["_id"] != "")
                {
                    identificador = Request.QueryString["_id"];
                }
            }

            if (identificador != "")
            {
                //Verifica se já tem Mídia
                MidiaDB midiaDB = new MidiaDB();
                if (!midiaDB.Existe(identificador))
                {
                    new Midia(0, new Midia_tipo(8, ""), new Painel(0), DateTime.Now, "Identificador " + identificador, "", 0, "", 0, 0, 0, 0, 0, 0, false, identificador).Salvar();
                }
            }

            //Se teve url de origem
            Uri uri = Request.UrlReferrer;

            if (uri != null)
            {
                new UrlOrigem(uri.Host, uri.PathAndQuery, Request.Url.OriginalString, Request.UserHostAddress, _ga, identificador).Salvar();
            }

            //Se recebeu o Cartaz
            string cartaz = Request.QueryString["cartaz"];

            if (cartaz != null)
            {
                if (cartaz != "")
                {
                    new MarcarCartaz().Marcar(cartaz, Request.UserHostAddress);
                }
            }

            //Se veio por email
            int idenviado   = 0;
            int i_idenviado = 0;

            if (Request.QueryString["idenviado"] != null)
            {
                if (Request.QueryString["idenviado"] != "")
                {
                    if (int.TryParse(Request.QueryString["idenviado"], out i_idenviado))
                    {
                        idenviado = i_idenviado;
                    }

                    int cont   = 0;
                    int i_cont = 0;
                    if (Request.QueryString["cont"] != null)
                    {
                        if (int.TryParse(Request.QueryString["cont"], out i_cont))
                        {
                            cont = i_cont;
                        }
                    }

                    if (idenviado != 0)
                    {
                        new Clicou(idenviado, cont);

                        //retorna o email do envio
                        if (_ga != null && _ga != "")
                        {
                            string email = new EnviadoDB().Email(idenviado);
                            if (email != "")
                            {
                                //Verifica se já é aluno e se o _ga está salvo para o aluno_navegacao
                                Aluno aluno = new AlunoDB().Email(email);
                                if (aluno != null)
                                {
                                    new Aluno_navegacaoDB().Existe(aluno, _ga);
                                }
                            }
                            else
                            {
                                Newsletter newsletter = new NewsletterDB().Buscar(email);
                                if (newsletter != null)
                                {
                                    new Newsletter_navegacaoDB().Existe(newsletter, _ga);
                                }
                            }
                        }
                    }
                }
            }

            //se _ga for diferente de ""
            if (_ga != null && _ga != "")
            {
                new Navegacao(Request.Url.AbsoluteUri, _ga, DateTime.Now);
            }

            return(base.BeginExecuteCore(callback, state));
        }