示例#1
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     if (dgvDetalle.Rows.Count > 0)
     {
         if (dgvDetalle.CurrentRow != null)
         {
             Int32  IDPaciente    = Convert.ToInt32(dgvDetalle.CurrentRow.Cells[0].Value.ToString());
             string NombreMascota = dgvDetalle.CurrentRow.Cells[1].Value.ToString();
             var    dResult       = MessageBox.Show("¿ESTÁ SEGURO DE ELIMINAR A " + NombreMascota + "?", "SGE SYSTEM'S", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (dResult == DialogResult.Yes)
             {
                 if (AdmClinica.DeletePaciente(IDPaciente))
                 {
                     MessageBox.Show("PACIENTE ELIMINADO CORRECTAMENTE", "SGE SYSTEM'S", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     PostConstructor();
                 }
                 else
                 {
                     MessageBox.Show("ERROR AL ELIMINAR EL PACIENTE", "SGE SYSTEM'S", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
 }