private void btAdicionar_Click(object sender, EventArgs e) { FormAddOpcionais form = new FormAddOpcionais(); form.ShowDialog(); opcional.Create(form.Op); AtualizaDGV(); }
private void btViewMode_Click(object sender, EventArgs e) { if (dgvPesquisar.CurrentRow != null) { int key = int.Parse(dgvAdicionados.CurrentRow.Cells[0].Value.ToString()); FormAddOpcionais form = new FormAddOpcionais(opcional.Read(key), false); form.ShowDialog(this); } else { MessageBox.Show("Selecione uma linha para visualizar!", "Ops...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void btEditar_Click(object sender, EventArgs e) { if (dgvPesquisar.CurrentRow != null) { int key = int.Parse(dgvPesquisar.CurrentRow.Cells[0].Value.ToString()); FormAddOpcionais form = new FormAddOpcionais(opcional.Read(key), true); form.ShowDialog(this); opcional.Update(form.Op); AtualizaDGV(); } else { MessageBox.Show("Selecione uma linha para editar!", "Ops...", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }