protected void cmdLogin_Click(object sender, EventArgs e) { try { AlunoDTO dto = new AlunoDTO(); dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + hdEmail.Value.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); if (!String.IsNullOrEmpty(hdId.Value)) { dto.idAluno = int.Parse(hdId.Value); } dto.email = hdEmail.Value; dto.situacao = "A"; AlunoBRL brl = new AlunoBRL(); if (brl.updateAlunoSenhaByEmaileId(dto)) { lblResultado.Text = "Senha alterada com sucesso. <br>Favor acessar o link <a href='Login'>Login</a> para entrar no sistema."; desabilitaCampos(); } else { lblResultado.Text = "Erro ao tentar mudar a senha, entrar em contato com o administrador"; } } catch (Exception ex) { lblResultado.Text = "Erro aconteceu. <br> " + ex.ToString(); } }
protected void cmdVerificar_Click(object sender, EventArgs e) { if (Page.IsValid) { try { AlunoDTO dto = new AlunoDTO(); dto.ano = DateTime.Now.Year + 1; dto.cpf = txtCPF.Text.Replace(".", "").Replace("-", ""); AlunoBRL brl = new AlunoBRL(); var dtAluno = brl.searchAlunoByCPF(dto); if (dtAluno != null && dtAluno.Rows.Count > 0) { lblResultado.ControlStyle.ForeColor = System.Drawing.Color.Blue; lblResultado.Text = "PARABÉNS: Seu CPF está cadastrado no processo seletivo."; } else { lblResultado.ControlStyle.ForeColor = System.Drawing.Color.Red; lblResultado.Text = "Seu CPF não está cadastrado no processo seletivo do ano " + dto.ano; } } catch (Exception ex) { throw ex; } finally { lblResultado.Visible = true; } } }
private void preencherGrid() { AlunoBRL alunoBRL = new AlunoBRL(); this.grdAluno.DataSource = alunoBRL.allUser(); this.grdAluno.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request.Params["id"] != null) { CriptQuery.SecureQueryString qs = new SecureQueryString(Request["id"]); string _email = qs["email"]; AlunoDTO dto = new AlunoDTO(); dto.situacao = "A"; dto.email = _email; AlunoBRL brl = new AlunoBRL(); DataTable dtAluno = brl.searchAlunoByEmail(dto); if (dtAluno != null && dtAluno.Rows.Count > 0) { if (brl.updateAlunoSituacao(dto)) { lblResultado.Text = "E-mail " + _email + " do aluno(a) ativado(a) com sucesso."; } else { lblResultado.Text = "Erro ao ativar e-mail. Tente novamente ou entre em contato conosco."; } } else { lblResultado.Text = "Aluno(a) não existente. Entre em contato conosco pelo link Contato"; } } } }
private void preencherGridAluno() { //HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; if (Session != null && !Session["S"].Equals("P")) //0 é para os administradores { AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(Session["I"].ToString()); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchDadosPrincipais(dto); grdDadosAluno.DataSource = dt; grdDadosAluno.DataBind(); if (dt != null && dt.Rows.Count > 0) { //if (!String.IsNullOrEmpty(dt.Rows[0]["Numero"].ToString())) txtNumero.Text = dt.Rows[0]["Numero"].ToString(); String imagem = dt.Rows[0]["Foto"].ToString(); if (!String.IsNullOrEmpty(imagem)) { lblImagem.Text = "<img src='http://s3.amazonaws.com/BEPiD/" + imagem + "' style='border-radius:20px; width:200px;'/>"; cmdEnviarImagem.Visible = false; } } } else { //pnlAdministrativo.Visible = true; //this.MasterPageFile = "~/Adm.Master"; } }
private void preencherGridAluno() { if (Session["SAluno"] != null) { if (Session["SAluno"].Equals("A")) { AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(Session["IAluno"].ToString()); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchDadosPrincipais(dto); grdDadosAluno.DataSource = dt; grdDadosAluno.DataBind(); if (dt != null && dt.Rows.Count > 0) { //if (!String.IsNullOrEmpty(dt.Rows[0]["Numero"].ToString())) txtNumero.Text = dt.Rows[0]["Numero"].ToString(); String imagem = dt.Rows[0]["Foto"].ToString(); if (!String.IsNullOrEmpty(imagem)) { lblImagem.Text = "<img src='http://s3.amazonaws.com/BEPiD/" + imagem + "' style='border-radius:20px; width:200px;'/>"; cmdEnviarImagem.Visible = false; } } } } }
protected void cmdCadastrar_Click(object sender, EventArgs e) { try { lblResultado.Text = ""; if (Page.IsValid) { if (BEPiD.Business.Util.Validacao.IsValidCPF(txtCPF.Text)) { AlunoDTO dto = new AlunoDTO(); dto.agencia = txtAgencia.Text; dto.nome = txtNome.Text; dto.bancoNome = txtNomeBanco.Text; dto.bancoNumero = txtNrBanco.Text; dto.celular = txtCelular.Text; dto.cidade = txtCidade.Text; dto.conta = txtConta.Text; dto.cpf = txtCPF.Text; //dto.dataNascimento = Convert.ToDateTime(txtDataNascimento.Text.Replace("/", "-")); dto.email = txtEmail.Text; dto.endereco = txtEndereco.Text; dto.estado = cmbEstado.Text; dto.identidade = txtIdentidade.Text; dto.nome = txtNome.Text; dto.nomeUniversidade = txtUniversidade.Text; dto.orgao = txtOrgao.Text; //dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + txtEmail.Text.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); dto.telefone = txtTelefone.Text; dto.cep = txtCEP.Text; dto.estadoCivil = cmbEstadoCivil.SelectedValue.ToString(); dto.nacionalidade = txtNacionalidade.Text; //dto.dataDeExpedicao = Convert.ToDateTime(txtDataExpedicao.Text.Replace("/", "-")); //pegando idaluno //HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; dto.idAluno = int.Parse(Session["IAluno"].ToString()); AlunoBRL _brl = new AlunoBRL(); if (_brl.updateAluno(dto)) { //enviando e-mail de cadastro //enviadEmailAdministradores(); //enviado e-mail para o usuário //enviadEmailAtivacao(); Response.Redirect("DadosPessoais?Situacao=1"); } } else { lblResultado.Text = "Digite um CPF válido."; } } } catch (Exception ex) { lblResultado.Text = "Ops! Um erro aconteceu! - " + ex.Message.ToString() + "<Br>" + ex.StackTrace.ToString(); } }
protected void cmdBuscar_Click(object sender, EventArgs e) { try { AlunoDTO dto = new AlunoDTO(); if (txtNome.Text.Length > 0) { dto.nome = txtNome.Text; } if (txtAno.Text.Length > 0) { dto.ano = int.Parse(txtAno.Text); } if (!cmbSituacao.SelectedValue.Equals("")) { dto.situacao = cmbSituacao.SelectedValue.ToString(); } AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchAlunosGeral(dto); grdAluno.DataSource = dt; grdAluno.DataBind(); calculaTotal(dt); } catch (Exception ex) { throw ex; } }
private void preencherGrid() { AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.allUser(); grdAluno.DataSource = dt; grdAluno.DataBind(); }
protected void lnkEsqueceuASenha_Click(object sender, EventArgs e) { if (Page.IsValid) { try { if (!String.IsNullOrEmpty(txtUsuario.Text)) { AlunoDTO dto = new AlunoDTO(); dto.email = txtUsuario.Text; dto.situacao = "A"; AlunoBRL brl = new AlunoBRL(); DataTable dtEmail = brl.searchAlunoByEmail(dto); if (dtEmail != null && dtEmail.Rows.Count > 0) { CriptQuery.SecureQueryString qs = new SecureQueryString(); qs["Email"] = txtUsuario.Text; qs["Id"] = dtEmail.Rows[0]["IdAluno"].ToString(); //qs["Tipo"] = "Professor"; string[] emails = new string[1]; emails[0] = txtUsuario.Text; //string _pw = cript2.code.business.SimpleCripto.Decrypt(dtEmail.Rows[0]["PWProfessor"].ToString(), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); StringBuilder str = new StringBuilder(); str.Append(@" Segue o link abaixo para alterar a senha solicitada através do sistema BEPiD UCB. <br> Lembre-se de nunca passar a sua senha para ninguém, toda senha é confidencial e intransferível. "); str.Append(@" <Br><Br> Acesse o link ou copie cole no browser: http://aluno.bepiducb.com.br/LoginAlterarSenha?e=" + qs.ToString() + " <br> e digite nova senha."); str.Append(@" <Br><Br> Em caso de dúvidas, entre em contato conosco pelo menu Contato"); BEPiD.Business.Util.EmailEnvio.enviaEmail(emails, "E-mail automático de senha - aluno.bepiducb.com.br", str.ToString()); lblResultado.Text = "Foi enviado para seu e-mail."; } else { lblResultado.Text = "O e-mail não está cadastrado, entrar em contato com o administrador."; } } else { lblResultado.Text = "Favor, digite o seu e-mail no campo de e-mail para verificação!"; txtUsuario.Focus(); } } catch (Exception ex) { throw ex; } } }
private void preencherDados(String id) { AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(id); AlunoBRL brl = new AlunoBRL(); this.grdAluno.DataSource = brl.searchDadosPrincipais(dto); this.grdAluno.DataBind(); }
protected void cmdCadastrar_Click(object sender, EventArgs e) { try { if (Page.IsValid) { if (BEPiD.Business.Util.Validacao.IsValidCPF(txtCPF.Text)) { AlunoDTO dto = new AlunoDTO(); dto.agencia = txtAgencia.Text; dto.bancoNome = txtNomeBanco.Text; dto.bancoNumero = txtNrBanco.Text; dto.celular = txtCelular.Text; dto.cidade = txtCidade.Text; dto.conta = txtConta.Text; dto.cpf = txtCPF.Text; dto.dataNascimento = formataDataYYYYMMDD(txtDataNascimento.Text); dto.email = txtEmail.Text; dto.endereco = txtEndereco.Text; dto.estado = cmbEstado.SelectedValue.ToString(); dto.identidade = txtIdentidade.Text; dto.nome = txtNome.Text; dto.nomeUniversidade = txtUniversidade.Text; dto.orgao = txtOrgao.Text; dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + txtEmail.Text.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); dto.telefone = txtTelefone.Text; dto.cep = txtCEP.Text; dto.estadoCivil = cmbEstadoCivil.SelectedValue.ToString(); dto.nacionalidade = txtNacionalidade.Text; AlunoBRL _brl = new AlunoBRL(); if (_brl.insertAluno(dto)) { //enviando e-mail de cadastro enviadEmailAdministradores(); //enviado e-mail para o usuário enviadEmailAtivacao(); Response.Redirect("Aluno?Situacao=1"); } } else { lblResultado.Text = "Digite um CPF válido."; } } } catch (Exception ex) { lblResultado.Text = "Ops! Um erro aconteceu! - " + ex.Message.ToString() + "<Br>" + ex.StackTrace.ToString(); } }
private void preencheGrid() { AlunoDTO dto = new AlunoDTO(); dto.situacao = "P"; dto.ano = 2015; // this.gridAluno.Attributes["style"] = @"mso-number-format:'\@'"; AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchAlunoInscricao(dto); this.gridAluno.DataSource = dt; this.gridAluno.DataBind(); }
private void preencherGridAluno() { hdIdAluno.Value = Session["IdAluno"].ToString(); //HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; hdIdProfessor.Value = Session["I"].ToString(); AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(hdIdAluno.Value); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchDadosPrincipais(dto); grdAluno.DataSource = dt; grdAluno.DataBind(); }
protected void cmdLogin_Click(object sender, EventArgs e) { try { if (Session["Tipo"].Equals("Professor")) { ProfessorDTO dto = new ProfessorDTO(); dto.pwProfessor = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + Session["Email"].ToString().Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); dto.idProfessor = int.Parse(Session["Id"].ToString()); dto.emailProfessor = Session["Email"].ToString(); ProfessorBRL brl = new ProfessorBRL(); if (brl.updateProfessorSenhaByEmaileId(dto)) { lblResultado.Text = "Senha alterada com sucesso. <br>Favor acessar o link <a href='Login?Professor=S'>Login</a> para entrar no sistema."; desabilitaCampos(); } else { lblResultado.Text = "Erro ao tentar mudar a senha, entrar em contato com o administrador"; } } else if (Session["Tipo"].Equals("Aluno")) { AlunoDTO dto = new AlunoDTO(); dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + Session["Email"].ToString().Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); dto.idAluno = int.Parse(Session["Id"].ToString()); dto.email = Session["Email"].ToString(); AlunoBRL brl = new AlunoBRL(); if (brl.updateAlunoSenhaByEmaileId(dto)) { lblResultado.Text = "Senha alterada com sucesso. <br>Favor acessar o link <a href='Login'>Login</a> para entrar no sistema."; desabilitaCampos(); } else { lblResultado.Text = "Erro ao tentar mudar a senha, entrar em contato com o administrador"; } } } catch (Exception ex) { lblResultado.Text = "Erro aconteceu. <br> " + ex.ToString(); } }
protected void cmdLogar_Click(object sender, EventArgs e) { if (Page.IsValid) { try { AlunoDTO dto = new AlunoDTO(); dto.email = txtUsuario.Text; dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPass.Text + txtUsuario.Text.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); dto.ano = DateTime.Now.Year; AlunoBRL brl = new AlunoBRL(); DataTable dtTable = brl.searchUserLogin(dto); if (dtTable != null && dtTable.Rows.Count > 0) { string _nome = HttpUtility.UrlEncode(dtTable.Rows[0]["Nome"].ToString(), Encoding.GetEncoding(28597)).Replace("+", " "); if (Request.QueryString["ReturnUrl"] == null) { CriarCookie(_nome, dtTable.Rows[0]["Email"].ToString(), dtTable.Rows[0]["IdAluno"].ToString(), dtTable.Rows[0]["Situacao"].ToString(), ""); FormsAuthentication.SetAuthCookie("webformAlunoAutentication", false); Response.Redirect("/Alunos/Default", true); } else { FormsAuthentication.RedirectFromLoginPage("webformAutentication", true); } } else { lblResultado.Text = "E-mail ou senha inválidos. <Br>Tente novamente ou entre em contato conosco."; } } catch (Exception ex) { throw ex; } } }
protected void cmdImprimir_Click(object sender, EventArgs e) { try { HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(Session["I"].ToString()); dto.aceiteTermo = "S"; AlunoBRL brl = new AlunoBRL(); brl.updateAlunoAceiteTermo(dto); } catch (Exception ex) { throw ex; } }
protected void cmdBuscar_Click(object sender, EventArgs e) { try { AlunoDTO dto = new AlunoDTO(); if (txtNome.Text.Length > 0) { dto.nome = txtNome.Text; } if (txtAno.Text.Length > 0) { dto.ano = int.Parse(txtAno.Text); } if (!cmbSituacao.SelectedValue.Equals("")) { dto.situacao = cmbSituacao.SelectedValue.ToString(); } if (!cmbProfessores.SelectedValue.Equals("0")) { dto.idProfessor = int.Parse(cmbProfessores.SelectedValue.ToString()); } if (!cmbAvaliacao.SelectedValue.Equals("")) { dto.tipoAvaliacao = cmbAvaliacao.SelectedValue.ToString(); } AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchAlunosGeral(dto); grdAluno.DataSource = dt; grdAluno.DataBind(); lblAlunos.Text = "Total de registros encontrados: " + dt.Rows.Count; } catch (Exception ex) { throw ex; } }
private void preencherGrid() { AlunoDTO dto = new AlunoDTO(); dto.nome = txtNome.Text; dto.ano = int.Parse(txtAno.Text); dto.sexo = cmbSexo.SelectedValue.ToString(); dto.nomeUniversidade = cmbInstituicao.SelectedValue.ToString(); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.allUserInscricao(dto); grdAluno.DataSource = dt; grdAluno.DataBind(); lblAlunos.Text = "Total de alunos cadastrados: " + dt.Rows.Count; //calculaTotal(dt); }
protected void grdAluno_RowCommand(object sender, GridViewCommandEventArgs e) { AlunoDTO dto = new AlunoDTO(); if (e.CommandName == "Inativar") { int index = int.Parse((string)e.CommandArgument); int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString()); dto.idAluno = IdAluno; dto.situacao = "I"; AlunoBRL brl = new AlunoBRL(); if (brl.updateAlunoSituacaoById(dto)) { Response.Redirect("AllUser"); } } else if (e.CommandName == "Ativar") { int index = int.Parse((string)e.CommandArgument); int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString()); dto.idAluno = IdAluno; dto.situacao = "A"; AlunoBRL brl = new AlunoBRL(); if (brl.updateAlunoSituacaoById(dto)) { Response.Redirect("AllUser"); } } else if (e.CommandName == "Nome") { int index = int.Parse((string)e.CommandArgument); int IdAluno = int.Parse(grdAluno.DataKeys[index]["IdAluno"].ToString()); //Session.Add("IdUsuarioDetalhe", IdAluno.ToString()); Response.Redirect("DetailUser?id=" + IdAluno.ToString()); } }
private void preencherDadosUsuario() { AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(Request.Params["id"].ToString()); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchDadosPrincipais(dto); if (dt != null && dt.Rows.Count > 0) { lblNumeroAluno.Text = "Número do Kit: " + dt.Rows[0]["Numero"].ToString(); lblNomeAluno.Text = dt.Rows[0]["Nome"].ToString(); lblEmailAluno.Text = dt.Rows[0]["Email"].ToString(); lblImagem.Text = "<img src='http://s3.amazonaws.com/BEPiD/" + dt.Rows[0]["Foto"].ToString() + "' style='border-radius:20px; width:200px;'/>"; } else { lblNumeroAluno.Text = "Não consegui achar o aluno."; } }
protected void cmdBuscar_Click(object sender, EventArgs e) { try { AlunoDTO dto = new AlunoDTO(); if (txtAno.Text.Length > 0) { dto.ano = int.Parse(txtAno.Text); } dto.situacao = cmbSituacao.SelectedValue.ToString(); AlunoBRL brl = new AlunoBRL(); grdAluno.DataSource = brl.searchAlunosCompraDevices(dto); grdAluno.DataBind(); } catch (Exception ex) { throw ex; } }
private void enviadEmailAdministradores(AlunoDTO dto) { StringBuilder str = new StringBuilder(); str.Append(@"<img src='http://www.bepiducb.com.br/img/Untitled-2.png' width='180'/><Br><br> O(a) aluno(a) " + txtNome.Text + ", instituição: " + cmbInstituicao.SelectedValue.ToString() + ", CPF: " + txtCPF.Text + ", e-mail: " + txtEmail.Text + " acaba de se cadastrar no sistema BEPiD UCB para o processo seletivo " + dto.ano); AlunoBRL brl = new AlunoBRL(); String total = brl.searchTotalAlunoInscricao(dto); str.Append(@"<br><br><b> Temos o total de: " + total + " aluno(s) cadastrado(s).</b>"); string[] _emails = new string[4]; //_emails[0] = "*****@*****.**"; //_emails[1] = "*****@*****.**"; _emails[0] = "*****@*****.**"; _emails[1] = "*****@*****.**"; _emails[2] = "*****@*****.**"; _emails[3] = "*****@*****.**"; BEPiD.Business.Util.EmailEnvio.enviaEmail(_emails, "E-mail automático de cadastro bepiducb.com.br", str.ToString()); }
private void preencherGrid() { AlunoDTO dto = new AlunoDTO(); dto.nome = txtNome.Text; if (!String.IsNullOrEmpty(txtAno.Text)) { dto.ano = int.Parse(txtAno.Text); } dto.sexo = cmbSexo.SelectedValue.ToString(); dto.nomeUniversidade = cmbInstituicao.SelectedValue.ToString(); if (!String.IsNullOrEmpty(cmbTipoAluno.SelectedValue.ToString())) { dto.idTipoAluno = int.Parse(cmbTipoAluno.SelectedValue.ToString()); } dto.situacao = cmbSituacao.SelectedValue.ToString(); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.allUserInscricao(dto); grdAluno.DataSource = dt; grdAluno.DataBind(); lblAlunos.Text = "Total de alunos cadastrados: " + dt.Rows.Count; //adicionando sessao para pegar na pagina de excel.- Session.Add("dtUsuario", dt); //ativa o botao para gerar o excel this.cmdGerarExcel.Visible = true; //calculaTotal(dt); }
private void buscarDadosAlunos() { AlunoDTO dto = new AlunoDTO(); //HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; dto.idAluno = int.Parse(Session["IAluno"].ToString()); AlunoBRL brl = new AlunoBRL(); DataTable dt = brl.searchDadosPrincipais(dto); if (dt != null && dt.Rows.Count > 0) { txtNome.Text = dt.Rows[0]["Nome"].ToString(); txtAgencia.Text = dt.Rows[0]["Agencia"].ToString(); txtNomeBanco.Text = dt.Rows[0]["BancoNome"].ToString(); txtNrBanco.Text = dt.Rows[0]["BancoNR"].ToString(); txtCelular.Text = dt.Rows[0]["Celular"].ToString(); txtCidade.Text = dt.Rows[0]["Cidade"].ToString(); txtConta.Text = dt.Rows[0]["Conta"].ToString(); txtCPF.Text = dt.Rows[0]["CPF"].ToString(); txtDataNascimento.Text = BEPiD.Business.Util.Data.formataDataRetornoFormulario(dt.Rows[0]["DataNascimento"].ToString()); txtEmail.Text = dt.Rows[0]["Email"].ToString(); txtEndereco.Text = dt.Rows[0]["Endereco"].ToString(); cmbEstado.SelectedValue = dt.Rows[0]["Estado"].ToString(); txtIdentidade.Text = dt.Rows[0]["Identidade"].ToString(); txtNome.Text = dt.Rows[0]["Nome"].ToString(); txtUniversidade.Text = dt.Rows[0]["NomeUniversidade"].ToString(); txtOrgao.Text = dt.Rows[0]["Orgao"].ToString(); //txtPassword.Text = ""; txtTelefone.Text = dt.Rows[0]["Telefone"].ToString(); txtCEP.Text = dt.Rows[0]["CEP"].ToString(); cmbEstadoCivil.SelectedValue = dt.Rows[0]["EstadoCivil"].ToString(); txtNacionalidade.Text = dt.Rows[0]["Nacionalidade"].ToString(); txtDataExpedicao.Text = BEPiD.Business.Util.Data.formataDataRetornoFormulario(dt.Rows[0]["DataExpedicaoIdentidade"].ToString()); } }
protected void cmdLogin_Click(object sender, EventArgs e) { // try //{ if (Page.IsValid) { if (hdProfessor.Value.Equals("P")) { ProfessorDTO dto = new ProfessorDTO(); dto.emailProfessor = txtEmail.Text; dto.pwProfessor = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + txtEmail.Text.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); ProfessorBRL brl = new ProfessorBRL(); DataTable dtTable = brl.searchProfessor(dto); if (dtTable != null && dtTable.Rows.Count > 0) { string _nome = HttpUtility.UrlEncode(dtTable.Rows[0]["NomeProfessor"].ToString(), Encoding.GetEncoding(28597)).Replace("+", " "); CriarCookie(_nome, dtTable.Rows[0]["EmailProfessor"].ToString(), dtTable.Rows[0]["IdProfessor"].ToString(), "P", ""); Response.Redirect("Dados.aspx"); } else { lblResultado.Text = "E-mail ou senha inválidos. <Br>Tente novamente ou entre em contato conosco."; } } else if (hdProfessor.Value.Equals("A")) { AlunoDTO dto = new AlunoDTO(); dto.email = txtEmail.Text; dto.password = cript2.code.business.SimpleCripto.Encrypt(txtPassword.Text + txtEmail.Text.Substring(0, 2), System.Configuration.ConfigurationManager.AppSettings["cript2Hash"].ToString()); AlunoBRL brl = new AlunoBRL(); DataTable dtTable = brl.searchUserLogin(dto); if (dtTable != null && dtTable.Rows.Count > 0) { string _nome = HttpUtility.UrlEncode(dtTable.Rows[0]["Nome"].ToString(), Encoding.GetEncoding(28597)).Replace("+", " "); CriarCookie(_nome, dtTable.Rows[0]["Email"].ToString(), dtTable.Rows[0]["IdAluno"].ToString(), "A", dtTable.Rows[0]["CPF"].ToString()); Response.Redirect("Dados.aspx"); } else { lblResultado.Text = "E-mail ou senha inválidos. <Br>Tente novamente ou entre em contato conosco."; } } } //} //catch (Exception ex) //{ // enviaEmailError(txtEmail.Text, ex.ToString() + ex.StackTrace.ToString()); //} }
protected void cmdEnviar_Click(object sender, EventArgs e) { AlunoDTO dto = null; try { if (Page.IsValid) { //verifica se as inscricoes foram encerradas if (BEPiD.Business.Util.Validacao.isInscricaoEncerrada(_dia, _mes, _ano)) { Response.Redirect("InscricoesEncerradas"); } if (BEPiD.Business.Util.Validacao.IsValidCPF(txtCPF.Text)) { dto = new AlunoDTO(); dto.celular = txtCelular.Text; dto.cidade = txtCidade.Text; dto.cpf = txtCPF.Text.Replace(".", "").Replace("-", ""); dto.dataNascimento = Convert.ToDateTime(txtDataNascimento.Text.Replace("/", "-")); dto.email = txtEmail.Text; dto.endereco = txtEndereco.Text; dto.estado = cmbEstado.SelectedValue.ToString(); dto.identidade = txtIdentidade.Text; dto.nome = txtNome.Text; dto.nomeUniversidade = cmbInstituicao.SelectedValue.ToString(); dto.orgao = txtOrgao.Text; dto.telefone = txtTelefone.Text; dto.cep = txtCEP.Text; dto.estadoCivil = cmbEstadoCivil.SelectedValue.ToString(); dto.nacionalidade = cmbNacionalidade.SelectedValue.ToString(); dto.ano = 2017; dto.sexo = cmbSexo.SelectedValue.ToString(); dto.dataDeExpedicao = Convert.ToDateTime(txtDataExpedicaoRG.Text.Replace("/", "-")); dto.nomeDaMae = txtNomedaMae.Text; dto.inglesLeitura = rdLeitura.SelectedValue.ToString(); dto.inglesEscrita = rdEscrita.SelectedValue.ToString(); dto.inglesComunicacaoVerbal = rdComunicacaoVerbal.SelectedValue.ToString(); dto.curso = txtCurso.Text; dto.semestre = cmbSemestre.SelectedValue.ToString(); dto.previsaoFormatura = formataMMYYYY(txtPrevisaoFormatura.Text); dto.ocupacaoAtual = cmbOcupacaoAtual.SelectedValue.ToString(); dto.situacao = "P"; dto.naturalidade = txtNatural.Text; if (!String.IsNullOrEmpty(this.rdTipoAluno.SelectedValue)) { dto.idTipoAluno = int.Parse(rdTipoAluno.SelectedValue.ToString()); } else { lblResultado.Text = "<Br>Atenção: escolha o tipo de vaga."; lblResultado.Visible = true; } //verifica se é designer ou developer if (this.rdTipoAluno.SelectedValue.Equals("1") && String.IsNullOrEmpty(txtLinkPortifolio.Text)) { lblResultado.Text = "<br>Atenção: Se você está se inscrevendo para designer, é necessário colocar um link de portifólio"; lblResultado.Visible = true; } else { dto.linkPortifolio = txtLinkPortifolio.Text; } AlunoBRL _brl = new AlunoBRL(); //verifica se já existe o cpf e e-mail if (_brl.verifyCPFAndEmail(dto)) { lblResultado.Text = "<br>Atenção: já existe esse CPF/E-mail cadastrado no nosso banco de dados."; lblResultado.Visible = true; } else { if (_brl.insertAlunoInscricao(dto)) { //enviando e-mail de cadastro enviadEmailAdministradores(dto); //enviado e-mail para o usuário enviadEmailAluno(dto); //System.Threading.Thread.Sleep(2); Response.Redirect("ProcessoSeletivoSucesso.aspx", false); } } } else { lblResultado.Text = "<br>Digite um CPF válido."; lblResultado.Visible = true; } } } catch (Exception ex) { lblResultado.Text = "<br>Ops! Um erro aconteceu! - estamos tentando resolver o mais rápido possível."; lblResultado.Visible = true; //envia email de erro. enviarEmailParaAdministradordoSite(dto, ex); } }
protected void cmdEnviarImagem_Click(object sender, EventArgs e) { try { if (String.IsNullOrEmpty(txtNumero.Text)) { lblImagem.Text = "Digite o número do seu Kit"; txtNumero.Focus(); return; } else { int tamanho = flUploadImagem.PostedFile.ContentLength; if (tamanho <= 4000000) { string filename = System.IO.Path.GetFileName(flUploadImagem.PostedFile.FileName); filename = Guid.NewGuid() + filename; TransferUtility fileTransferUtility = new TransferUtility(System.Configuration.ConfigurationManager.AppSettings["AccessKey"].ToString(), System.Configuration.ConfigurationManager.AppSettings["SecretKey"].ToString()); var uploadRequest = new Amazon.S3.Transfer.TransferUtilityUploadRequest(); uploadRequest.InputStream = flUploadImagem.PostedFile.InputStream; uploadRequest.BucketName = "BEPiD"; uploadRequest.Key = filename; uploadRequest.StorageClass = S3StorageClass.ReducedRedundancy; uploadRequest.CannedACL = S3CannedACL.PublicRead; fileTransferUtility.Upload(uploadRequest); lblImagem.Text = "<img src='http://s3.amazonaws.com/BEPiD/" + filename.ToString() + "' style='border-radius:30px;'/>"; string urlImagem = "http://s3.amazonaws.com/BEPiD/" + filename.ToString(); HttpWebRequest httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(urlImagem); HttpWebResponse httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse(); Stream stream = httpWebReponse.GetResponseStream(); System.Drawing.Image objImage = System.Drawing.Image.FromStream(stream); int w = objImage.Width; int h = objImage.Height; if (w <= 500 && h <= 500) { //atualizar o banco de dados. //HttpCookie Session = Request.Cookies["BEPiDUCB.Site"]; AlunoDTO dto = new AlunoDTO(); dto.idAluno = int.Parse(Session["I"].ToString()); if (txtNumero.Text.Length > 0) { dto.numero = int.Parse(txtNumero.Text); } dto.foto = filename.ToString(); AlunoBRL alunoBRL = new AlunoBRL(); if (alunoBRL.updateAlunoNumeroMaquinaImagem(dto)) { //lblImagem.Text = "Foto enviada com sucesso."; //cmdEnviarImagem.Visible = false; //esconde o botao. } else { } //sResponse.Write("Não feito"); } else { lblImagem.Text = "A imagem deve a largura e altura de no máximo 500 pixels."; } } else { lblImagem.Text = "A imagem deve ser menor do que 4.000.000 bytes."; } } } catch (Exception ex) { lblImagem.Text = ex.Message.ToString() + " - " + ex.StackTrace.ToString(); } }