Exemple #1
0
    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 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 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);
        }
    }
Exemple #4
0
    public static int UpdateSenhaResponsavel(Responsaveis r, int resId)
    {
        int retorno = 0;

        try
        {
            IDbConnection objConnection;
            IDbCommand    objCommand;

            string sql = "UPDATE res_responsaveis SET res_senha = ?res_senha WHERE res_id = ?res_id;";

            objConnection = Mapped.Connection();
            objCommand    = Mapped.Command(sql, objConnection);

            // Parametrização

            // Dados
            objCommand.Parameters.Add(Mapped.Parameter("?res_senha", r.Res_senha));

            // Endereco
            objCommand.Parameters.Add(Mapped.Parameter("?res_id", resId));

            objCommand.ExecuteNonQuery();

            objConnection.Close();
            objConnection.Dispose();
            objCommand.Dispose();
        }
        catch (Exception ex)
        {
            retorno = -2;
        }
        return(retorno);
    }
Exemple #5
0
    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);
        }
    }
Exemple #6
0
        public async Task GivenBuscaPaginadaAsync(int skip, int take)
        {
            var query = new GetResponsaveisQuery()
            {
                Skip = skip,
                Take = take
            };
            var responsaveis = Responsaveis.ToList();

            responsaveis.AddRange(await Mediator.SendAsync(query));
            Responsaveis = responsaveis;
        }
    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");
        }
    }
Exemple #8
0
    public static int Insert(Pessoas pessoa, Responsaveis responsavel)
    {
        int retorno = 0;

        try
        {
            IDbConnection objConnection;
            IDbCommand    objCommand;

            string sql = "INSERT INTO pes_pessoas(pes_nome, pes_dataNascimento, pes_sexo) VALUES(?pes_nome,?pes_dataNascimento,?pes_sexo);";
            sql += "INSERT INTO res_responsaveis(res_email, res_senha,pes_id) VALUES(?res_email,?res_senha, last_insert_id()); ";

            objConnection = Mapped.Connection();
            objCommand    = Mapped.Command(sql, objConnection);

            //parametrização

            //Pessoa
            objCommand.Parameters.Add(Mapped.Parameter("?pes_nome", pessoa.Pes_nome));
            objCommand.Parameters.Add(Mapped.Parameter("?pes_dataNascimento", pessoa.Pes_dataNascimento));
            objCommand.Parameters.Add(Mapped.Parameter("?pes_sexo", pessoa.Pes_sexo));
            //fim Pessoa
            //Responsavel
            objCommand.Parameters.Add(Mapped.Parameter("?res_email", responsavel.Res_email));
            objCommand.Parameters.Add(Mapped.Parameter("?res_senha", responsavel.Res_senha));
            //Fim Responsavel


            objCommand.ExecuteNonQuery();

            objConnection.Close();
            objConnection.Dispose();
            objCommand.Dispose();
        }
        catch (Exception ex)
        {
            retorno = -2;
        }
        return(retorno);
    }
Exemple #9
0
    public static DataSet SelectIdPorEmail(Responsaveis r)
    {
        DataSet       ds = new DataSet();
        IDbConnection objConnection;
        IDbCommand    objCommand;
        IDataAdapter  objDataAdapter;

        string sql = "select res_id from res_responsaveis where res_email = ?res_email";

        objConnection = Mapped.Connection();
        objCommand    = Mapped.Command(sql, objConnection);

        objCommand.Parameters.Add(Mapped.Parameter("?res_email", r.Res_email));

        objDataAdapter = Mapped.Adapter(objCommand);
        objDataAdapter.Fill(ds);

        objConnection.Close();
        objConnection.Dispose();
        objCommand.Dispose();

        return(ds);
    }
Exemple #10
0
 public void ThenTheResult(int responsaveisQuantity)
 {
     Assert.AreEqual(responsaveisQuantity, Responsaveis.Count());
 }