Esempio n. 1
0
 private void buttonEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridViewData.RowCount > 0)
         {
             int        IdTurno = Int32.Parse(dataGridViewData.Rows[IdRowSelect].Cells["Id"].Value.ToString());
             cFAT100010 Alert   = new cFAT100010("Información", String.Format("¿Desea eliminar el registro {0}?", IdTurno), MessageBoxIcon.Question);
             Alert.ShowDialog();
             if (Alert.DialogResult == DialogResult.Yes)
             {
                 IdRowSelect = dataGridViewData.CurrentRow.Index;
                 TurnML Turn = new TurnML()
                 {
                     Id = IdTurno
                 };
                 TurnBLL.Delete(Turn);
                 dataGridViewData.Rows.Remove(dataGridViewData.CurrentRow);
             }
         }
         else
         {
             cFAT100010 Alert = new cFAT100010("Información", "No hay datos", MessageBoxIcon.Information);
             Alert.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(String.Format("buttonEliminar_Click: {0}", ex), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }