private void BtnEliminar_Click(object sender, EventArgs e) { if (dgvLotes.SelectedCells.Count > 0) { LoteNegocio neg = new LoteNegocio(); Lote l = (Lote)dgvLotes.CurrentRow.DataBoundItem; try { using (var popup = new Confirmacion(@"eliminar """ + l.ToString() + @"""")) { var R = popup.ShowDialog(); if (R == DialogResult.OK) { bool conf = popup.R; if (l != null && conf == true) { neg.EliminarLogico(l.IdLote); BindLotes.Remove(l); LlenarTabla(); } } } } catch (Exception ex) { Mensaje m = new Mensaje(ex.ToString()); m.ShowDialog(); } } else { Mensaje m = new Mensaje("Ningun item seleccionado."); m.ShowDialog(); } }
// sobreescribir toString() override public string ToString() { return($"{Subsistema.ToString()}-{Sector.ToString().PadLeft(2, '0')}-{Manzana.ToString().PadLeft(4, '0')}-{Lote.ToString().PadLeft(4, '0')}-{Nivel1.ToString().PadLeft(2, '0')}-{Nivel2.ToString().PadLeft(2, '0')}-{Fraccion.ToString().PadLeft(2, '0')}-{Toma.ToString().PadLeft(2, '0')}"); }