private void btnDelete_Click(object sender, EventArgs e) { Connection con = new Connection(); if (con.ExecutaComando(Comandos.Delete(Convert.ToInt32(dgvcliente.CurrentRow.Cells["id"].Value))) == true) { CarregarGRid(); } }
private void populaobjeto(Cliente cli) { cli.id = Convert.ToInt32(txtid.Text); cli.name = txtName.Text; cli.lastname = txtLastName.Text; cli.city = txtCity.Text; cli.estado = txtEstado.Text; Connection con = new Connection(); if (con.ExecutaComando(Comandos.Update(cli))) //sempre retorna um true qnd não especificado { MessageBox.Show("Cliente alterado com sucesso"); limparTxt(txtlist: new TextBox[] {txtid, txtName, txtLastName, txtCity, txtEstado}); CarregarGRid(); } }
private void btnNew_Click(object sender, EventArgs e) { Connection con = new Connection(); con.ExecutaComando(Comandos.Insert(txtName.Text, txtLastName.Text, txtCity.Text, txtEstado.Text)); }