Exemplo n.º 1
0
 private void btExcluir_Click(object sender, EventArgs e)
 {
     if (dgvFuncionarios.CurrentRow.Cells[0].Value != null)
     {
         DialogResult resp = MessageBox.Show("Deseja realmente excluir este registro?", "Excluir", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
         if (resp == System.Windows.Forms.DialogResult.Yes)
         {
             bool             status  = false;
             configuracoesBLL confbll = new configuracoesBLL();
             configuracoesDTO confdto = new configuracoesDTO();
             confdto.idfuncionario = dgvFuncionarios.CurrentRow.Cells[0].Value.ToString();
             status = confbll.excluir_funcionario(confdto);
             if (status == true)
             {
                 MessageBox.Show("Registro excluido com sucesso!");
                 dgvFuncionarios.Rows.Clear();
                 carregarRegistros();
             }
         }
     }
     else
     {
         MessageBox.Show("Escolha um registro para excluir.");
     }
 }