Esempio n. 1
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     try
     {
         parametro         = PrencherPropriedadesParametros();
         horario           = PrencherPropriedadesHorarios();
         horario.Parametro = parametro;
         int           id   = Convert.ToInt32(lblIDParametros.Text);
         int           idh  = Convert.ToInt32(lblIDHorarios.Text);
         ParametrosDAL pDAL = new ParametrosDAL();
         HorariosDAL   hDAl = new HorariosDAL();
         if (id == 0 && idh == 0)
         {
             MessageBox.Show("Não há coluna selecionada ");
             return;
         }
         else if (id != 0)
         {
             parametro.ID = id;
             pDAL.Deletar(parametro);
         }
         else if (idh != 0)
         {
             parametro.ID        = id;
             horario.ID          = idh;
             horario.ParametroID = parametro.ID;
             hDAl.Deletar(horario);
         }
         AtualizarForm();
         lblIDHorarios.Text   = "0";
         lblIDParametros.Text = "0";
         MessageBox.Show("Deletado com sucesso!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }