private void btnDeletarPerfil_Click(object sender, EventArgs e)
 {
     if (codPerfilSelecionado < 0)
     {
         MessageBox.Show("Clique em um registro na grid antes de prosseguir!");
     }
     else
     {
         PerfilDTO PERF = new PerfilDTO();
         PERF.Id_Perfil = codPerfilSelecionado;
         int retorno = new BLL.PerfilBLL().DeletarPerfil(PERF);
         if (retorno > 0)
         {
             MessageBox.Show("Excluído com Sucesso");
             codPerfilSelecionado = -1;
             carregaGridPerfil();
             txbPerfil.Text         = "";
             cbxFuncionalidade.Text = "";
         }
     }
 }
        private void btnInserirPerfil_Click(object sender, EventArgs e)
        {
            if (txbPerfil.Text == "" || cbxFuncionalidade.Text == "")
            {
                MessageBox.Show("Por favor, preencha os campos obrigatórios...");
            }
            else
            {
                PerfilDTO PERF = new PerfilDTO();
                PERF.Perfil            = txbPerfil.Text;
                PERF.Id_Funcionalidade = Convert.ToInt32(cbxFuncionalidade.SelectedValue);

                int retorno = new BLL.PerfilBLL().InserePerfil(PERF);
                if (retorno > 0)
                {
                    MessageBox.Show("Gravado com Sucesso");
                    codPerfilSelecionado = -1;
                    carregaGridPerfil();
                    txbPerfil.Text         = "";
                    cbxFuncionalidade.Text = "";
                }
            }
        }
        private void btnEditarPerfil_Click(object sender, EventArgs e)
        {
            if (codPerfilSelecionado < 0)
            {
                MessageBox.Show("Clique em um registro na grid antes de prosseguir!");
            }
            else
            {
                PerfilDTO PERF = new PerfilDTO();
                PERF.Id_Perfil         = codPerfilSelecionado;
                PERF.Perfil            = txbPerfil.Text;
                PERF.Id_Funcionalidade = Convert.ToInt32(cbxFuncionalidade.SelectedValue);

                int retorno = new BLL.PerfilBLL().EditaPerfil(PERF);
                if (retorno > 0)
                {
                    MessageBox.Show("Alterado com Sucesso");
                    codPerfilSelecionado = -1;
                    carregaGridPerfil();
                    txbPerfil.Text         = "";
                    cbxFuncionalidade.Text = "";
                }
            }
        }