void BtnModificarClick(object sender, EventArgs e) { if (dgvTerceros.SelectedRows.Count > 0) { Tercero tercero = Tercero.FindByID(Convert.ToInt16(dgvTerceros.CurrentRow.Cells["ID"].Value.ToString())); var frmTercero = new FrmTercero(tercero); if (frmTercero.ShowDialog() == DialogResult.Yes) { CargarTerceros(); } } }
void BtnEliminarClick(object sender, EventArgs e) { if (dgvTerceros.SelectedRows.Count > 0) { Tercero tercero = Tercero.FindByID(Convert.ToInt16(dgvTerceros.CurrentRow.Cells["ID"].Value.ToString())); if (MessageBox.Show("¿Esta seguro de eliminar el tercero?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { tercero.Eliminado = true; tercero.FechaModificacion = DateTime.Now; tercero.Delete(); MessageBox.Show("Articulo eliminado con exito!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); CargarTerceros(); return; } } }