private void dgExpedientes_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgExpedientes.Columns[e.ColumnIndex] == bEditar) { //editar PostgresDataAccess.Expediente exp = Datos.ObtenerExpediente((int)dgExpedientes["id_expediente", e.RowIndex].Value); Expediente Editar = new Expediente(exp); if (Editar.ShowDialog() == DialogResult.OK) { ListadoExpedientes_Load(this, new EventArgs()); } } if (dgExpedientes.Columns[e.ColumnIndex] == bEliminar) { // eliminar if (MessageBox.Show(this, "¿Desea realmente borrar este expediente?", "Borrar Expediente", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (Datos.EliminarExpediente((int)dgExpedientes["id_expediente", e.RowIndex].Value) == true) { dgExpedientes.Rows.RemoveAt(e.RowIndex); } else { MessageBox.Show("No se puede eliminar el expediente. Compruebe que\nno hayan recursos asignados a este expediente y reitere la operación", "Mensaje de ZEUS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } }
private void btnAceptar_Click(object sender, EventArgs e) { bool ok = true; if (listCalles.SelectedIndices.Count == 0) { MessageBox.Show("Debe seleccionar un resultado", "Falta Selección", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { btnGenerar.Blink = false; direccion = new Direccion(); // establecer dirección y cerrar diálogos switch (DC[listCalles.SelectedIndices[0]].TipoRef) { case /*Geocodificacion.*/ TipoReferencia.Tramo: ok = false; direccion.Calle1 = DC[listCalles.SelectedIndices[0]].Dato1 + " " + DC[listCalles.SelectedIndices[0]].Dato2; direccion.Comuna = DC[listCalles.SelectedIndices[0]].Dato3; break; case /*Geocodificacion.*/ TipoReferencia.Altura: direccion.Calle1 = DC[listCalles.SelectedIndices[0]].Dato1; direccion.Comuna = DC[listCalles.SelectedIndices[0]].Dato3; direccion.Ubicacion = DC[listCalles.SelectedIndices[0]].Punto1; direccion.Altura = int.Parse(DC[listCalles.SelectedIndices[0]].Dato2); break; case /*Geocodificacion.*/ TipoReferencia.Esquina: direccion.Calle1 = DC[listCalles.SelectedIndices[0]].Dato1; direccion.Calle2 = DC[listCalles.SelectedIndices[0]].Dato2; direccion.Comuna = DC[listCalles.SelectedIndices[0]].Dato3; direccion.Ubicacion = DC[listCalles.SelectedIndices[0]].Punto1; break; default: break; } // generar expediente PlugData.Direccion = direccion; if (ok) { Expediente expediente = new Expediente(); DialogResult dr = expediente.ShowDialog(); if (dr == DialogResult.OK) { this.DialogResult = DialogResult.OK; this.Close(); } } else { MessageBox.Show("Debe ingresar un punto para poder generar un expediente (ingresar una coincidencia, o generarlo manualmente)", "Sistema ZEUS"); } } }