private void btnVisualizar_Click(object sender, EventArgs e) { long sel_id = 0; foreach (DataGridViewRow row in dgvInstrumentos.Rows) { if (row.Selected) { sel_id = Convert.ToInt64(row.Cells[0].Value); break; } } Instrumento instrumento; if (sel_id != 0) { instrumento = Servico.BuscarInstrumento(sel_id); if (instrumento.Excluido) { if (!Util.Confirm("Esse instrumento está excluído. Para visualizá-lo, você deve recuperar o registro.\n\nDeseja recuperar este instrumento?")) { return; } } Util.DisposeForm("Instrumentos.Visualizar"); Visualizar visualizar = new Visualizar(instrumento); visualizar.ShowDialog(); buscar(); } }
private void dgvInstrumentos_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { long sel_id = 0; Instrumento instrumento; if (e.RowIndex >= 0) { sel_id = Convert.ToInt64(dgvInstrumentos.Rows[e.RowIndex].Cells[0].Value); instrumento = Servico.BuscarInstrumento(sel_id); if (instrumento.Excluido) { if (!Util.Confirm("Esse instrumento está excluído. Para visualizá-lo, você deve recuperar o registro.\n\nDeseja recuperar este instrumento?")) { return; } } Util.DisposeForm("Instrumentos.Visualizar"); Visualizar visualizar = new Visualizar(instrumento); visualizar.ShowDialog(); buscar(); } }