Esempio n. 1
0
        private void btnAtualiza_Click(object sender, EventArgs e)
        {
            string id = txtId.Text;

            if (id != "")
            {
                int id2 = Convert.ToInt32(txtId.Text);

                string usu   = txtNome.Text;
                string senha = txtSenha.Text;
                string email = txtEmail.Text;
                string tel   = txtTel.Text;
                if (DialogResult.Yes == MessageBox.Show("Tem certeza que deseja atualizar o registro?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2))
                {
                    UsuarioBLL usuario = new UsuarioBLL();
                    int        ret     = usuario.Atualiza(id2, usu, senha, email, tel);

                    if (ret != 0)
                    {
                        MessageBox.Show("Usuario Atualizado Com Sucesso", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Erro Inesperado");
                    }
                }
                AddData();
                LimpaCampos();
            }
            else
            {
                MessageBox.Show("Por Favor Selecione Um Usuario", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            TextBox txtid    = (TextBox)GridView1.Rows[e.RowIndex].Cells[0].Controls[0];
            TextBox txtnome  = (TextBox)GridView1.Rows[e.RowIndex].Cells[1].Controls[0];
            TextBox txtsenha = (TextBox)GridView1.Rows[e.RowIndex].Cells[2].Controls[0];
            TextBox txtemail = (TextBox)GridView1.Rows[e.RowIndex].Cells[3].Controls[0];
            TextBox txttel   = (TextBox)GridView1.Rows[e.RowIndex].Cells[4].Controls[0];

            int    id    = 3;
            string nome  = txtnome.Text;
            string senha = txtsenha.Text;
            string email = txtemail.Text;
            string tel   = txttel.Text;

            UsuarioBLL usuario = new UsuarioBLL();

            usuario.Atualiza(id, nome, senha, email, tel);
            AddData();
        }