コード例 #1
0
ファイル: Form1.cs プロジェクト: Baptista-Valdinei/Crud
 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();
     }
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Baptista-Valdinei/Crud
 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();
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: Baptista-Valdinei/Crud
 private void btnNew_Click(object sender, EventArgs e)
 {
     Connection con = new Connection();
     con.ExecutaComando(Comandos.Insert(txtName.Text, txtLastName.Text, txtCity.Text, txtEstado.Text));
 }