Esempio n. 1
0
        /// <summary>
        /// Função que Transmite a Entidade para a DAL fazer DELETE
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool Delete(MOD_pessoa objEnt)
        {
            using (TransactionScope objTrans = new TransactionScope())
            {
                try
                {
                    if (!BLL_Liberacoes.LiberaEdicaoAdm(Convert.ToInt64(objEnt.CodPessoa), new BLL_usuario().buscarPessoa(objEnt.CodPessoa)))
                    {
                        throw new Exception(modulos.acessoNegado);
                    }

                    #region Inicialização das variaveis

                    blnRetorno    = true;
                    blnRetornoLog = true;

                    #endregion

                    #region Movimentação da tabela Pessoa e Logs

                    objDAL     = new DAL_pessoa();
                    objDAL_Log = new DAL_log();

                    //Chama a função que converte as datas
                    objEnt.Logs = new BLL_pessoa_Log().CriarLog(objEnt, "Delete");
                    objEnt.Logs = new BLL_pessoa_Log().ValidaLog(objEnt.Logs);

                    blnRetorno    = objDAL.Delete(objEnt);
                    blnRetornoLog = objDAL_Log.inserir(objEnt.Logs);

                    #endregion

                    //Se der falso qualquer retorno a Transação deve ser Anulada
                    if (false.Equals(blnRetorno) || false.Equals(blnRetornoLog))
                    {
                        //finaliza a transação
                        objTrans.Dispose();
                        throw new Exception(modulos.MsgErroExcluir);
                    }
                    else
                    {
                        //completa a transação
                        objTrans.Complete();
                        return(true);
                    }
                }
                catch (SqlException exl)
                {
                    //finaliza a transação
                    objTrans.Dispose();
                    throw exl;
                }
                catch (Exception ex)
                {
                    //finaliza a transação
                    objTrans.Dispose();
                    throw ex;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Analisa os acessos e libera os controles de acordo com o nivel
        /// </summary>
        /// <param name="dataGrid"></param>
        internal void verPermRegiao(DataGridView dataGrid)
        {
            try
            {
                btnRegIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotInsCCB);
                btnRegEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotEditCCB, dataGrid);
                btnRegExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotExcCCB, dataGrid);
                btnRegVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotVisCCB, dataGrid);

                //verificando o botão Selecionar
                if (Text.Equals("Pesquisar Comum"))
                {
                    if (dataGrid.Rows.Count > 0)
                    {
                        btnRegSel.Visible = true;
                        btnRegSel.Enabled = true;
                    }
                    else
                    {
                        btnRegSel.Visible = true;
                        btnRegSel.Enabled = false;
                    }
                }
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermData(DataGridView dataGrid)
 {
     try
     {
         btnDataVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoImportaPessoa.RotVisImportaPessoa, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 internal void verPermMinisterio()
 {
     try
     {
         tabMinisterio.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotCCBAbaMinist);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 internal void verPermAlteraCargo()
 {
     try
     {
         gpoCargo.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoTipoReuniao.RotipoReuniaoCargo);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermAlteraMinist()
 {
     try
     {
         btnInserir.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotInsCCBMinist);
         btnExcluir.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCcb.RotExcCCBMinist, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermFotoTeoria(DataGridView dataGrid)
 {
     try
     {
         btnInserir.Enabled = BLL_Liberacoes.LiberaAcessoRotina(modulos.rotInsFotoTeoria);
         btnVisual.Enabled  = BLL_Liberacoes.LiberaAcessoRotina(modulos.rotInsFotoTeoria, dataGrid);
         btnExcluir.Enabled = BLL_Liberacoes.LiberaAcessoRotina(modulos.rotInsFotoTeoria, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 8
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermLista(DataGridView dataGrid)
 {
     try
     {
         MOD_acessoListaPresenca entAcesso = new MOD_acessoListaPresenca();
         btnIns.Enabled     = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotInsPresenca);
         btnExcluir.Enabled = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotExcPresenca, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 9
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermTipo(DataGridView dataGrid)
 {
     try
     {
         btnTipoIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoMetodo.RotInsMetodo);
         btnTipoEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoMetodo.RotEditMetodo, dataGrid);
         btnTipoExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoMetodo.RotExcMetodo, dataGrid);
         btnTipoVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoMetodo.RotVisMetodo, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 10
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermEstado(DataGridView dataGrid)
 {
     try
     {
         btnEstIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoRegional.RotInsRegional);
         btnEstEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoRegional.RotEditRegional, dataGrid);
         btnEstExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoRegional.RotExcRegional, dataGrid);
         btnEstVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoRegional.RotVisRegional, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 11
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermDesc(DataGridView dataGrid)
 {
     try
     {
         btnDescIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoDepartamento.RotInsDepartamento);
         btnDescEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoDepartamento.RotEditDepartamento, dataGrid);
         btnDescExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoDepartamento.RotExcDepartamento, dataGrid);
         btnDescVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoDepartamento.RotVisDepartamento, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 private void VerPermDesc(DataGridView dataGrid)
 {
     try
     {
         btnDescIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCargo.RotInsCargo);
         btnDescEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCargo.RotEditCargo, dataGrid);
         btnDescExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCargo.RotExcCargo, dataGrid);
         btnDescVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCargo.RotVisCargo, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 13
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermDesc(DataGridView dataGrid)
 {
     try
     {
         btnDescIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoEscala.RotInsEscala);
         btnDescEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoEscala.RotInsEscala, dataGrid);
         btnDescExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoEscala.RotInsEscala, dataGrid);
         btnDescVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoEscala.RotInsEscala, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermModulo(DataGridView dataGrid)
 {
     try
     {
         MOD_acessoModulos entAcesso = new MOD_acessoModulos();
         this.btnModIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotInsModulo);
         this.btnModEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotEditModulo, dataGrid);
         this.btnModExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotExcModulo, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 15
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermProg(DataGridView dataGrid)
 {
     try
     {
         MOD_acessoProgramas entAcesso = new MOD_acessoProgramas();
         this.btnProgIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotInsProgModulo);
         this.btnProgEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotEditProgModulo, dataGrid);
         this.btnProgExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(entAcesso.rotExcProgModulo, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 16
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermCidade(DataGridView dataGrid)
 {
     try
     {
         btnIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCidade.RotInsCidade);
         btnEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCidade.RotEditCidade, dataGrid);
         btnExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCidade.RotExcCidade, dataGrid);
         btnVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoCidade.RotVisCidade, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 17
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermDesc(DataGridView dataGrid)
 {
     try
     {
         btnDescIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoTipoReuniao.RotInsTipoReuniao);
         btnDescEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoTipoReuniao.RotEditTipoReuniao, dataGrid);
         btnDescExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoTipoReuniao.RotExcTipoReuniao, dataGrid);
         btnDescVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoTipoReuniao.RotVisTipoReuniao, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 18
0
 /// <summary>
 /// Analisa os acessos e libera os controles de acordo com o nivel
 /// </summary>
 /// <param name="dataGrid"></param>
 internal void verPermPessoa(DataGridView dataGrid)
 {
     try
     {
         //verificando o botão inserir
         btnPesIns.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoUsuario.RotInsUsuario);
         btnPesEditar.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoUsuario.RotEditUsuario, dataGrid);
         btnPesExc.Enabled    = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoUsuario.RotExcUsuario, dataGrid);
         btnPesVisual.Enabled = BLL_Liberacoes.LiberaAcessoRotina(MOD_acessoUsuario.RotVisUsuario, dataGrid);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 19
0
        /// <summary>
        /// Função que preenche o formulário para edição
        /// </summary>
        /// <param name="CodUsuario"></param>
        internal void preencher(string CodUsuario)
        {
            try
            {
                objBLL = new BLL_usuario();
                lista  = objBLL.buscarCod(CodUsuario);

                //Verifica se o usuario a ser editado não é o usuario 1
                BLL_Liberacoes.LiberaEdicaoAdm(Convert.ToInt32(Codigo), lista);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Função que Transmite a Entidade para a DAL fazer UPDATE
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool Update(MOD_pessoa objEnt, out List <MOD_pessoa> listaRetorno)
        {
            using (TransactionScope objTrans = new TransactionScope())
            {
                try
                {
                    if (BLL_Liberacoes.LiberaEdicaoAdm(Convert.ToInt64(objEnt.CodPessoa), new BLL_usuario().buscarPessoa(objEnt.CodPessoa)))
                    {
                        throw new Exception(modulos.acessoNegado);
                    }

                    #region Inicialização das variaveis

                    blnRetorno             = true;
                    blnRetornoInst         = true;
                    blnRetornoMet          = true;
                    blnRetornoFoto         = true;
                    blnRetornoLog          = true;
                    blnRetornoCCB          = true;
                    blnRetornoCCBLog       = true;
                    blnRetornoCCBDelete    = true;
                    blnRetornoCCBDeleteLog = true;
                    blnRetornoMetLog       = true;
                    blnRetornoInstLog      = true;

                    #endregion

                    #region Movimentação da tabela Pessoa e Logs

                    objDAL        = new DAL_pessoa();
                    objDAL_Log    = new DAL_log();
                    objBLL_Valida = new BLL_ValidacaoPessoa();

                    //Função que valida o Cpf
                    objEnt.Cpf = funcoes.FormataCpf(objEnt.Cpf);

                    //Chama a função que converte as datas
                    objEnt = objBLL_Valida.ConverteData(objEnt);

                    objEnt.Logs = new BLL_pessoa_Log().CriarLog(objEnt, "Update");
                    objEnt.Logs = new BLL_pessoa_Log().ValidaLog(objEnt.Logs);

                    blnRetorno    = objDAL.Update(objEnt);
                    blnRetornoLog = objDAL_Log.inserir(objEnt.Logs);

                    //verifica se o retorno foi false retorna Erro
                    if (false.Equals(blnRetorno) || false.Equals(blnRetornoLog))
                    {
                        throw new Exception(modulos.MsgErroSalvar);
                    }

                    #endregion

                    #region Movimentação da tabela PessoaInstrumento

                    //verifica se há registro na lista
                    if (null != objEnt.listaPessoaInstr && objEnt.listaPessoaInstr.Count > 0)
                    {
                        objBLL_PessoaInstr = new BLL_pessoaInstr();

                        blnRetornoInst = objBLL_PessoaInstr.Update(objEnt.listaPessoaInstr);

                        //verifica se o retorno foi false retorna Erro
                        if (false.Equals(blnRetornoInst))
                        {
                            throw new Exception(modulos.MsgErroSalvar);
                        }
                    }

                    #endregion

                    #region Movimento na tabela CCBPessoa

                    //verifica se há registro na lista
                    if (null != objEnt.listaCCBPessoa && objEnt.listaCCBPessoa.Count > 0)
                    {
                        objBLL_PessoaCCB = new BLL_pessoaCCB();

                        blnRetornoCCB = objBLL_PessoaCCB.Insert(objEnt.listaCCBPessoa.ToList());

                        //verifica se o retorno foi false e sai do for
                        if (false.Equals(blnRetornoCCB))
                        {
                            throw new Exception(modulos.MsgErroSalvar);
                        }
                    }

                    //verifica se há registro na lista Delete
                    if (null != objEnt.listaDeleteCCBPessoa && objEnt.listaDeleteCCBPessoa.Count > 0)
                    {
                        objBLL_PessoaCCB = new BLL_pessoaCCB();

                        blnRetornoCCBDelete = objBLL_PessoaCCB.Delete(objEnt.listaDeleteCCBPessoa);

                        //verifica se o retorno foi false e sai do for
                        if (false.Equals(blnRetornoCCBDelete))
                        {
                            throw new Exception(modulos.MsgErroSalvar);
                        }
                    }

                    #endregion

                    #region Movimentação da tabela PessoaMetodo

                    //verifica se há registro na lista
                    if (objEnt.listaPessoaMet != null && objEnt.listaPessoaMet.Count > 0)
                    {
                        objBLL_PessoaMetodo = new BLL_pessoaMetodo();

                        blnRetornoMet = objBLL_PessoaMetodo.Update(objEnt.listaPessoaMet);

                        //verifica se o retorno foi false e sai do for
                        if (false.Equals(blnRetornoMet))
                        {
                            throw new Exception(modulos.MsgErroSalvar);
                        }
                    }

                    #endregion

                    #region Movimentação da tabela Foto

                    //verifica se há registro na lista Foto
                    if (null != objEnt.FotoPessoa)
                    {
                        objBLL_PessoaFoto = new BLL_pessoaFoto();

                        if ("0" == objEnt.FotoPessoa.CodFoto)
                        {
                            blnRetornoFoto = objBLL_PessoaFoto.Insert(objEnt.FotoPessoa);
                        }
                        else if (null == objEnt.FotoPessoa.Foto)
                        {
                            blnRetornoFoto = objBLL_PessoaFoto.Delete(objEnt.FotoPessoa);
                        }
                        else
                        {
                            blnRetornoFoto = objBLL_PessoaFoto.Update(objEnt.FotoPessoa);
                        }

                        //verifica se o retorno foi false e sai do for
                        if (false.Equals(blnRetornoFoto))
                        {
                            throw new Exception(modulos.MsgErroSalvar);
                        }
                    }

                    #endregion

                    //Se der falso qualquer retorno a Transação deve ser Anulada
                    if (false.Equals(blnRetorno) || false.Equals(blnRetornoLog) ||
                        false.Equals(blnRetornoInst) || false.Equals(blnRetornoInstLog) || false.Equals(blnRetornoFoto) ||
                        false.Equals(blnRetornoMet) || false.Equals(blnRetornoMetLog) ||
                        false.Equals(blnRetornoCCB) || false.Equals(blnRetornoCCBDelete) || false.Equals(blnRetornoCCBDeleteLog) ||
                        false.Equals(blnRetornoCCBLog))
                    {
                        //finaliza a transação
                        objTrans.Dispose();
                        throw new Exception(modulos.MsgErroSalvar);
                    }
                    else
                    {
                        //Busca o Registro inserido para retornar para gravar na tabela de Importados com sucesso
                        objBLL_BuscaPessoa = new BLL_buscaPessoaPorCodPessoa();
                        listaRetorno       = objBLL_BuscaPessoa.Buscar(objEnt.CodPessoa);

                        //completa a transação
                        objTrans.Complete();

                        //Retorna a Confirmação que foi gravado na tabela Pessoa
                        return(true);
                    }
                }
                catch (SqlException exl)
                {
                    //finaliza a transação
                    objTrans.Dispose();
                    throw exl;
                }
                catch (Exception ex)
                {
                    //finaliza a transação
                    objTrans.Dispose();
                    throw ex;
                }
            }
        }