private void BTModifSector_Click(object sender, EventArgs e) { try { if (DGV_Sectores.SelectedRows.Count != 1) { throw new Exception("Se debe seleccionar una fila a modificar"); } string IdAModificar = DGV_Sectores.SelectedRows[0].Cells[0].Value.ToString(); Sector SectorAModificar = new Sector(); SectorAModificar = sector.BuscarUno(IdAModificar); AgModSector modificarSector = new AgModSector(SectorAModificar) { StartPosition = FormStartPosition.CenterScreen }; modificarSector.ShowDialog(); ActualizarGrilla(); } catch (Exception err) { MessageBox.Show(err.Message, "Error"); } }
private void BTAgregarSector_Click(object sender, EventArgs e) { int UltimoId = sector.ObtenerUltimoId(); AgModSector agregarSector = new AgModSector(UltimoId) { StartPosition = FormStartPosition.CenterScreen }; agregarSector.ShowDialog(); ActualizarGrilla(); }