private void dgvBanco_CellContentClick(object sender, DataGridViewCellEventArgs e) { int idBanco = Convert.ToInt32(dgvBanco.CurrentRow.Cells["Id_Banco"].Value); try { if (e.ColumnIndex == 1) { BANCO banco = (BANCO)dgvBanco.CurrentRow.DataBoundItem; EditarBanco formBanco = new EditarBanco(banco); formBanco.ShowDialog(); CargarGrillaBanco(); } else if (e.ColumnIndex == 2) { if (servicio.BancoDelete(idBanco).IsValid) { MessageBox.Show("El banco se eliminó correctamente"); CargarGrillaBanco(); } else { MessageBox.Show("Hubo inconvenientes al eliminar el banco, por favor intente nuevamente"); } } } catch (Exception ex) { MessageBox.Show("Ocurrió un error " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void EditarBanco_Click(object sender, RoutedEventArgs e) { ConsultorioSagradaFamilia.Models.Banco seleccion = (ConsultorioSagradaFamilia.Models.Banco)BancosGrid.SelectedItem; if (seleccion == null) { MessageBox.Show("Seleccione un banco"); return; } EditarBanco editarBanco = new EditarBanco(seleccion); Layout.Frame.Navigate(editarBanco); }