protected void btnContinuar_Click(object sender, EventArgs e) { Responsaveis r = new Responsaveis(); int resId = Convert.ToInt32(Session["idResponsavel"]); if (txtSenha.Text == txtRepeteSenha.Text) { r.Res_senha = txtSenha.Text; switch (ResponsavelBD.UpdateSenhaResponsavel(r, resId)) { case 0: Session.Remove("idResponsavel"); Response.Redirect("Login.aspx"); break; case -2: break; } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalSenhaErrada').modal('show');</script>", false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(id); if (ds.Tables[0].Rows.Count >= 1) { ltlTitulo.Text = "<h1>" + ds.Tables[0].Rows[0]["pes_nome"].ToString() + "</h1>"; txtNome.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString(); txtCPF.Text = ds.Tables[0].Rows[0]["pes_cpf"].ToString(); txtRG.Text = ds.Tables[0].Rows[0]["pes_rg"].ToString(); ddlSexo.SelectedValue = ds.Tables[0].Rows[0]["pes_sexo"].ToString() == "M" ? "1" : "2"; txtDataNascimento.Text = ds.Tables[0].Rows[0]["pes_dataNascimento"].ToString().Substring(0, 10); // FAZER OS CONTATOS } else { // ERRO } } }
protected void btnAlterarEmail_Click(object sender, EventArgs e) { Responsaveis r = new Responsaveis(); int pesId = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(pesId); string emailAntigo = ds.Tables[0].Rows[0]["res_email"].ToString(); if (txtEmailAntigo.Text == emailAntigo) { if (ResponsavelBD.ValidaEmail(txtEmailNovo.Text)) { int resId = Convert.ToInt32(Session["idResponsavel"]); r.Res_email = txtEmailNovo.Text; switch (ResponsavelBD.UpdateEmailResponsavel(r, resId)) { case 0: Response.Redirect("ExibirPerfil.aspx"); break; case -2: Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroInformações').modal('show');</script>", false); break; } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalEmailNovoEmUso').modal('show');</script>", false); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalEmailAntigoErrado').modal('show');</script>", false); } }
protected void btnSalvarSenha_Click(object sender, EventArgs e) { Responsaveis r = new Responsaveis(); int pesId = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(pesId); string senhaAntiga = ds.Tables[0].Rows[0]["res_senha"].ToString(); if (txtSenhaAntiga.Text == senhaAntiga) { int resId = Convert.ToInt32(Session["idResponsavel"]); r.Res_senha = txtNovaSenha.Text; switch (ResponsavelBD.UpdateSenhaResponsavel(r, resId)) { case 0: Response.Redirect("Login.aspx"); break; case -2: Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroInformações').modal('show');</script>", false); break; } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalSenhaAntigaErrada').modal('show');</script>", false); } }
protected void btn_Click(object sender, EventArgs e) { Pessoas p = new Pessoas(); Responsaveis r = new Responsaveis(); p.Pes_nome = txtNome.Text + " " + txtSobrenome.Text; p.Pes_dataNascimento = Convert.ToDateTime(txtData.Text); if (ddlSexo.SelectedValue == "1") { p.Pes_sexo = "Masculino"; } else if (ddlSexo.SelectedValue == "2") { p.Pes_sexo = "Feminino"; } else if (ddlSexo.SelectedValue == "3") { p.Pes_sexo = "Outro"; } if (ResponsavelBD.ValidaEmail(txtEmail.Text)) { if (txtEmail.Text == txtConfirmaEmail.Text) { r.Res_email = txtEmail.Text; if (txtSenha.Text == txtConfirmaSenha.Text) { r.Res_senha = txtSenha.Text; switch (ResponsavelBD.Insert(p, r)) { case 0: Response.Redirect("Login.aspx"); break; case -2: break; } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroCadastroSenha').modal('show');</script>", false); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroCadastroEmail').modal('show');</script>", false); } } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroCadastroEmailJaCadastrado').modal('show');</script>", false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int pesId = Convert.ToInt32(Session["idPessoa"]); switch (ResponsavelBD.InsertInicialEndereco(pesId)) { case 0: DataSet ds = ResponsavelBD.SelectDados(pesId); DataSet end = ResponsavelBD.SelectEndereco(pesId); if (ds.Tables[0].Rows[0]["pes_cpf"] != null) { txtCPF.Text = ds.Tables[0].Rows[0]["pes_cpf"].ToString(); } if (ds.Tables[0].Rows[0]["pes_rg"] != null) { txtRG.Text = ds.Tables[0].Rows[0]["pes_rg"].ToString(); } if (end.Tables[0].Rows[0]["end_logradouro"] != null) { txtEndereco.Text = end.Tables[0].Rows[0]["end_logradouro"].ToString(); } if (end.Tables[0].Rows[0]["end_numero"] != null) { txtNumero.Text = end.Tables[0].Rows[0]["end_numero"].ToString(); } if (end.Tables[0].Rows[0]["end_bairro"] != null) { txtBairro.Text = end.Tables[0].Rows[0]["end_cidade"].ToString(); } if (end.Tables[0].Rows[0]["end_cidade"] != null) { txtCidade.Text = end.Tables[0].Rows[0]["end_bairro"].ToString(); } if (end.Tables[0].Rows[0]["end_estado"] != null) { txtEstado.Text = end.Tables[0].Rows[0]["end_estado"].ToString(); } break; case -2: Response.Redirect("Index.aspx"); break; } } }
protected void btnFimCadastro_Click(object sender, EventArgs e) { int pesId = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(pesId); DataSet end = ResponsavelBD.SelectEndereco(pesId); int endId = Convert.ToInt32(end.Tables[0].Rows[0]["end_id"]); Pessoas pessoa = new Pessoas(); Endereco endereco = new Endereco(); pessoa.Pes_cpf = txtCPF.Text; pessoa.Pes_rg = txtRG.Text; endereco.End_logradouro = txtEndereco.Text; endereco.End_cidade = txtCidade.Text; endereco.End_bairro = txtBairro.Text; endereco.End_estado = txtEstado.Text; endereco.End_numero = txtNumero.Text; endereco.End_pais = "Brasil"; switch (ResponsavelBD.UpdateResponsavel(pessoa, pesId)) { case 0: switch (ResponsavelBD.UpdateEnderecoResponsavel(endereco, endId)) { case 0: if (Convert.ToInt32(Request.QueryString["valid"]) == 2) { Response.Redirect("CadastroDesaparecido.aspx"); } else { Response.Redirect("CadastroVulneravel.aspx"); } break; case -2: Response.Redirect("Index.aspx"); break; } break; case -2: Response.Redirect("Index.aspx"); break; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["isLoggedIn"].ToString() == "True") { int pesId = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(pesId); string cpf = ""; string rg = ""; Boolean end = false; if (ds.Tables[0].Rows[0]["pes_cpf"] != null) { cpf = ds.Tables[0].Rows[0]["pes_cpf"].ToString(); } if (ds.Tables[0].Rows[0]["pes_rg"] != null) { rg = ds.Tables[0].Rows[0]["pes_rg"].ToString(); } if (ds.Tables[0].Rows[0]["end_id"] != null) { end = true; } txtAguarde.Text = "Redirecionando"; if (rg == "" || cpf == "" || end == false) { Response.Redirect("CadastroFinalResponsavel.aspx?valid=2"); txtAguarde.Text = rg + " e " + cpf; } else { Response.Redirect("CadastroDesaparecido.aspx"); } } else { Response.Redirect("Login.aspx"); } } }
protected void btnEntrar_Click(object sender, EventArgs e) { if (ResponsavelBD.ValidaEmail(txtEmail.Text)) { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalEmailInvalido').modal('show');</script>", false); } else { Responsaveis r = new Responsaveis(); r.Res_email = txtEmail.Text; DataSet ds = ResponsavelBD.SelectIdPorEmail(r); Session["idResponsavel"] = Convert.ToInt32(ds.Tables[0].Rows[0]["res_id"]); Response.Redirect("EsqueciASenhaMeio.aspx"); } }
protected void btnEntrar_Click(object sender, EventArgs e) { DataSet dsL = ResponsavelBD.SelectLogin(txtEmail.Text, txtSenha.Text); if (dsL.Tables[0].Rows.Count == 1) { int pesId = Convert.ToInt32(dsL.Tables[0].Rows[0]["pes_id"]); DataSet dsD = ResponsavelBD.SelectDados(pesId); Session["nomeResponsavel"] = dsD.Tables[0].Rows[0]["pes_nome"].ToString(); Session["emailResponsavel"] = dsD.Tables[0].Rows[0]["res_email"].ToString(); Session["idResponsavel"] = Convert.ToInt32(dsD.Tables[0].Rows[0]["res_id"]); Session["idPessoa"] = Convert.ToInt32(dsD.Tables[0].Rows[0]["pes_id"]); Session["isLoggedIn"] = "true"; Response.Redirect("Index.aspx"); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroLogin').modal('show');</script>", false); } }
protected void btnSalvarDados_Click(object sender, EventArgs e) { Pessoas p = new Pessoas(); int pesId = Convert.ToInt32(Session["idPessoa"]); p.Pes_nome = txtNome.Text; p.Pes_cpf = txtCPF.Text; p.Pes_rg = txtRG.Text; DateTime dataN = Convert.ToDateTime(txtDataNascimento.Text); p.Pes_dataNascimento = dataN; if (ddlSexo.SelectedValue == "1") { p.Pes_sexo = "Masculino"; } else if (ddlSexo.SelectedValue == "2") { p.Pes_sexo = "Feminino"; } else if (ddlSexo.SelectedValue == "3") { p.Pes_sexo = "Outro"; } switch (ResponsavelBD.UpdateDadosPessoais(p, pesId)) { case 0: Response.Redirect("ExibirPerfil.aspx"); break; case -2: Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>$('#modalErroInformações').modal('show');</script>", false); break; } }
protected void Page_Load(object sender, EventArgs e) { int id = Convert.ToInt32(Session["idPessoa"]); DataSet ds = ResponsavelBD.SelectDados(id); if (ds.Tables[0].Rows.Count >= 1) { ltlTitulo.Text = "<h1>" + ds.Tables[0].Rows[0]["pes_nome"].ToString() + "</h1>"; ltlNomeUsuario.Text = ds.Tables[0].Rows[0]["pes_nome"].ToString(); ltlCPF.Text = ds.Tables[0].Rows[0]["pes_cpf"].ToString(); ltlRG.Text = ds.Tables[0].Rows[0]["pes_rg"].ToString(); ltlSexo.Text = ds.Tables[0].Rows[0]["pes_sexo"].ToString() == "M" ? "Masculino" : "Feminino"; ltlDataNascimento.Text = ds.Tables[0].Rows[0]["pes_dataNascimento"].ToString().Substring(0, 10); DataSet dsC = ResponsavelBD.SelectContatos(id); ltlEmail.Text = ds.Tables[0].Rows[0]["res_email"].ToString(); rptContatos.DataSource = dsC; } else { // ERRO } }