/// <summary>
        /// Função DELETE - Utilzada para Excluir os dados na Base
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool Delete(MOD_importaPessoaItem objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela
                bool blnRetorno = false;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>
                {
                    //parametros da tabela principal
                    new SqlParameter("@CodImportaPessoaItem", Convert.ToInt64(objEnt.CodImportaPessoaItem))
                };

                return(blnRetorno = objAcessa.executar(objDAL.StrDelete, objParam));
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Função que Transmite a Entidade para a DAL fazer INSERT
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool Insert(MOD_importaPessoaItem objEnt)
        {
            using (TransactionScope objTrans = new TransactionScope())
            {
                try
                {
                    bool blnRetorno    = true;
                    bool blnRetornoLog = true;

                    //verifica se há registro na lista
                    if (null != objEnt)
                    {
                        if ("0" == objEnt.CodImportaPessoaItem)
                        {
                            objDAL = new DAL_importaPessoaItem();

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

                            //Busca o proximo ID para inserir o registro
                            objEnt.CodImportaPessoaItem = Convert.ToString(RetornaId());

                            blnRetorno    = objDAL.Insert(objEnt);
                            blnRetornoLog = new DAL_log().inserir(objEnt.Logs);
                        }
                    }

                    //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.MsgErroSalvar);
                    }
                    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;
                }
            }
        }
示例#3
0
        /// <summary>
        /// Função que criar os dados para tabela Logs
        /// <para>Parametro ent - Informar a Tabela que está sendo alterada</para>
        /// <para>Parametro Operacao - Informar se é Insert ou Update</para>
        /// </summary>
        /// <param name="ent"></param>
        /// <param name="Operacao"></param>
        /// <returns></returns>
        public MOD_log CriarLog(MOD_importaPessoaItem ent, string Operacao)
        {
            try
            {
                //preenche os dados para salvar na tabela Logs
                ent.Logs            = new MOD_log();
                ent.Logs.Data       = DateTime.Now.ToString("dd/MM/yyyy");
                ent.Logs.Hora       = DateTime.Now.ToString("HH:mm");
                ent.Logs.CodUsuario = Convert.ToString(modulos.CodUsuario);

                if (Operacao.Equals("Insert"))
                {
                    ent.Logs.CodRotina  = Convert.ToString(new MOD_acessoImportaPessoaItem().RotEditImportaPessoaItem);
                    ent.Logs.Ocorrencia = "Foi Inserido o registro nº < " + ent.CodImportaPessoaItem + " > " +
                                          "gerado através da Importação nº < " + ent.CodImportaPessoa + " > " + "do Irmão(ã): < " + ent.CodPessoa + " - " + ent.Nome + " > ";
                }
                else if (Operacao.Equals("Update"))
                {
                    ent.Logs.CodRotina  = Convert.ToString(new MOD_acessoImportaPessoaItem().RotEditImportaPessoaItem);
                    ent.Logs.Ocorrencia = "Foi feito Alteração do registro nº < " + ent.CodImportaPessoaItem + " > " +
                                          "gerado através da Importação nº < " + ent.CodImportaPessoa + " > " + "do Irmão(ã): < " + ent.CodPessoa + " - " + ent.Nome + " > ";
                }
                else
                {
                    ent.Logs.CodRotina  = Convert.ToString(new MOD_acessoImportaPessoaItem().RotEditImportaPessoaItem);
                    ent.Logs.Ocorrencia = "Foi Excluido o registro nº < " + ent.CodImportaPessoaItem + " > " +
                                          "gerado através da Importação nº < " + ent.CodImportaPessoa + " > " + "do Irmão(ã): < " + ent.CodPessoa + " - " + ent.Nome + " > ";
                }

                ent.Logs.NomePc = modulos.DescPc;
                ent.Logs.IpPc   = modulos.IpPc;
                ent.Logs.CodCCB = modulos.CodRegional;

                return(ent.Logs);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception exl)
            {
                throw exl;
            }
        }
        /// <summary>
        /// Função que faz DELETE na Tabela ImportaPessoaItem
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool excluir(MOD_importaPessoaItem objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela
                bool blnRetorno = false;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>();

                //se não estiver marcado, é feita a inclusao na tabela
                if (!Convert.ToInt64(objEnt.CodImportaPessoa).Equals(0))
                {
                    //parametros da tabela principal
                    objParam.Add(new SqlParameter("@CodImportaPessoaItem", Convert.ToInt64(objEnt.CodImportaPessoaItem)));
                    blnRetorno = objAcessa.executar(strDelete, objParam);
                }

                //retorna o blnRetorno da tabela principal
                return(blnRetorno);
            }
            catch (SqlException exl)
            {
                if (exl.Number.Equals(547))
                {
                    throw new Exception("Impossivel excluir. Quebra de integridade!");
                }
                else
                {
                    throw new Exception("Erro: " + exl.Message + "\n" + "Erro nº: " + exl.Number);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#5
0
        /// <summary>
        /// Função que converte as data em inteiro para salvar no Banco de dados
        /// </summary>
        /// <param name="lista"></param>
        public MOD_importaPessoaItem ConverteData(MOD_importaPessoaItem ent)
        {
            try
            {
                ent.DataCadastro     = string.IsNullOrEmpty(ent.DataCadastro) ? null : funcoes.DataInt(ent.DataCadastro);
                ent.HoraCadastro     = string.IsNullOrEmpty(ent.HoraCadastro) ? null : funcoes.HoraInt(ent.HoraCadastro);
                ent.Cpf              = string.IsNullOrEmpty(ent.Cpf) ? null : funcoes.FormataCpf(ent.Cpf);
                ent.DataNasc         = string.IsNullOrEmpty(ent.DataNasc) ? null : funcoes.DataInt(ent.DataNasc);
                ent.DataBatismo      = string.IsNullOrEmpty(ent.DataBatismo) ? null : funcoes.DataInt(ent.DataBatismo);
                ent.DataApresentacao = string.IsNullOrEmpty(ent.DataApresentacao) ? null : funcoes.DataInt(ent.DataApresentacao);
                ent.DataUltimoTeste  = string.IsNullOrEmpty(ent.DataUltimoTeste) ? null : funcoes.DataInt(ent.DataUltimoTeste);
                ent.DataInicioEstudo = string.IsNullOrEmpty(ent.DataInicioEstudo) ? null : funcoes.DataInt(ent.DataInicioEstudo);

                return(ent);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
 /// <summary>
 /// Função que Retorna uma Lista Preenchida com os Valores Pesquisados
 /// </summary>
 /// <param name="objDtb"></param>
 /// <returns></returns>
 public MOD_pessoa CriarDadosPessoa(MOD_importaPessoaItem objEnt_Item)
 {
     try
     {
         //instancia a lista
         MOD_pessoa objEnt_Pessoa = new MOD_pessoa
         {
             //adiciona os campos às propriedades
             Ativo             = "Sim",
             DataCadastro      = objEnt_Item.DataCadastro,
             HoraCadastro      = objEnt_Item.HoraCadastro,
             CodCargo          = objEnt_Item.CodCargo,
             Nome              = objEnt_Item.Nome,
             DataNasc          = objEnt_Item.DataNasc,
             Cpf               = objEnt_Item.Cpf,
             Rg                = objEnt_Item.Rg,
             Sexo              = objEnt_Item.Sexo,
             DataBatismo       = objEnt_Item.DataBatismo,
             CodCidadeRes      = objEnt_Item.CodCidadeRes,
             EndRes            = objEnt_Item.EndRes,
             NumRes            = objEnt_Item.NumRes,
             BairroRes         = objEnt_Item.BairroRes,
             ComplRes          = objEnt_Item.ComplRes,
             Telefone1         = objEnt_Item.Telefone1,
             Telefone2         = objEnt_Item.Telefone2,
             Celular1          = objEnt_Item.Celular1,
             Celular2          = objEnt_Item.Celular2,
             Email             = objEnt_Item.Email,
             CodCCB            = objEnt_Item.CodCCB,
             EstadoCivil       = objEnt_Item.EstadoCivil,
             DataApresentacao  = objEnt_Item.DataApresentacao,
             PaisCCB           = objEnt_Item.PaisCCB,
             Pai               = objEnt_Item.Pai,
             Mae               = objEnt_Item.Mae,
             FormacaoFora      = objEnt_Item.FormacaoFora,
             LocalFormacao     = objEnt_Item.LocalFormacao,
             QualFormacao      = objEnt_Item.QualFormacao,
             OutraOrquestra    = objEnt_Item.OutraOrquestra,
             Orquestra1        = objEnt_Item.Orquestra1,
             Funcao1           = objEnt_Item.Funcao1,
             Orquestra2        = objEnt_Item.Orquestra2,
             Funcao2           = objEnt_Item.Funcao2,
             Orquestra3        = objEnt_Item.Orquestra3,
             Funcao3           = objEnt_Item.Funcao3,
             CodInstrumento    = objEnt_Item.CodInstrumento,
             Desenvolvimento   = objEnt_Item.Desenvolvimento,
             DataUltimoTeste   = objEnt_Item.DataUltimoTeste,
             DataInicioEstudo  = objEnt_Item.DataInicioEstudo,
             ExecutInstrumento = objEnt_Item.ExecutInstrumento,
             CodCCBGem         = objEnt_Item.CodCCBGem,
             OrgaoEmissor      = objEnt_Item.OrgaoEmissor
         };
         //retorna a lista com os valores pesquisados
         return(objEnt_Pessoa);
     }
     catch (SqlException exl)
     {
         throw exl;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#7
0
        /// <summary>
        /// Função que Transmite a Entidade para a Classe Pessoas Importar os dados
        /// </summary>
        /// <param name="objEnt"></param>
        /// <param name="listaRetorno"></param>
        /// <returns></returns>
        public bool Import(MOD_importaPessoaItem objEnt, out MOD_pessoa listaRetorno)
        {
            using (TransactionScope objTrans = new TransactionScope())
            {
                try
                {
                    bool blnRetorno = true;

                    #region Movimentação da tabela Pessoa

                    IBLL_Pessoa objBLL_Pessoa = new BLL_pessoa();
                    IBLL_buscaPessoaDuplicada objBLL_BuscaPessoaDuplicada = new BLL_buscaPessoaDuplicada();
                    IBLL_buscaPessoa          objBLL_BuscaPessoa          = new BLL_buscaPessoaPorCpf();
                    List <MOD_pessoa>         listaPessoa = new List <MOD_pessoa>();

                    /*Faz uma busca na tabela pessoas para verificar se há alguma pessoa já cadastrada pelo CPF*/
                    listaPessoa = objBLL_BuscaPessoa.Buscar(objEnt.Cpf);

                    /*Caso a busca retorna que há uma pessoa cadastrada para esse CPF*/
                    if (listaPessoa.Count > 0)
                    {
                        /*Verifico se os parâmetros permite a atualização de pessoas na importação*/
                        if ("Não".Equals(modulos.listaParametros[0].AlteraDadosImportPessoa))
                        {
                            listaRetorno = listaPessoa[0];
                            //finaliza a transação
                            objTrans.Dispose();
                            return(true);
                        }
                        else
                        {
                            objEnt.CodPessoa = listaPessoa[0].CodPessoa;

                            /*Chama a classe Pessoa para Inserir o registro na Tabela
                             * Informa uma entidade Pessoa com os dados*/
                            blnRetorno = objBLL_Pessoa.Update(new BLL_listaImportaPessoa().CriarDadosPessoa(objEnt), out listaPessoa);
                        }
                    }
                    else /*Caso a busca por CPF não retorne uma pessoa cadastrada*/
                    {
                        /*Verifico se há pessoa cadastrada de aplicando os filtros Nome, DataNascimento e CidadeRes*/
                        listaPessoa = objBLL_BuscaPessoaDuplicada.Buscar(objEnt.Nome, objEnt.DataNasc, objEnt.CodCidadeRes);

                        /*Caso a busca retorna que há uma pessoa cadastrada para os dados informados*/
                        if (listaPessoa.Count > 0)
                        {
                            /*Verifico se os parâmetros permite a atualização de pessoas na importação*/
                            if ("Não".Equals(modulos.listaParametros[0].AlteraDadosImportPessoa))
                            {
                                listaRetorno = listaPessoa[0];
                                //finaliza a transação
                                objTrans.Dispose();
                                return(true);
                            }
                            else
                            {
                                objEnt.CodPessoa = listaPessoa[0].CodPessoa;

                                /*Chama a classe Pessoa para Inserir o registro na Tabela
                                 * Informa uma entidade Pessoa com os dados*/
                                blnRetorno = objBLL_Pessoa.Update(new BLL_listaImportaPessoa().CriarDadosPessoa(objEnt), out listaPessoa);
                            }
                        }
                    }

                    /*Verifica se o código da Pessoa é igual a zero
                     * Caso for igual a zero chama a clausula INSERT para inserir novo registro*/
                    if ("0".Equals(objEnt.CodPessoa))
                    {
                        /*Chama a classe Pessoa para Inserir o registro na Tabela
                         * Informa uma entidade Pessoa com os dados*/
                        blnRetorno = objBLL_Pessoa.Insert(new BLL_listaImportaPessoa().CriarDadosPessoa(objEnt), out listaPessoa);
                    }

                    #endregion

                    //Se der falso qualquer retorno a Transação deve ser Anulada
                    if (false.Equals(blnRetorno))
                    {
                        //finaliza a transação
                        objTrans.Dispose();
                        throw new Exception(modulos.MsgErroSalvar);
                    }

                    /*Caso não aconteça nenhum erro e a variavel retorna True, completa a transação*/
                    objTrans.Complete();

                    //Dados retornados para a classe superior
                    listaRetorno = listaPessoa[0];

                    //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;
                }
            }
        }
        /// <summary>
        /// Função que faz INSERT e UPDATE na Tabela ImportaPessoaItem
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool salvar(MOD_importaPessoaItem objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela ImportaPessoaItem
                bool blnRetorno = false;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>();

                //se não estiver marcado, é feita a inclusao na tabela
                if (Convert.ToInt64(objEnt.CodImportaPessoaItem).Equals(0))
                {
                    //parametros da tabela principal
                    objParam.Add(new SqlParameter("@CodImportaPessoaItem", retornaId()));
                    objParam.Add(new SqlParameter("@CodImportaPessoa", string.IsNullOrEmpty(objEnt.CodImportaPessoa) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodImportaPessoa) as object));
                    objParam.Add(new SqlParameter("@DataCadastro", string.IsNullOrEmpty(objEnt.DataCadastro) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataCadastro) as object));
                    objParam.Add(new SqlParameter("@HoraCadastro", string.IsNullOrEmpty(objEnt.HoraCadastro) ? DBNull.Value as object : Convert.ToInt16(objEnt.HoraCadastro) as object));
                    objParam.Add(new SqlParameter("@CodCargo", string.IsNullOrEmpty(objEnt.CodCargo) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodCargo) as object));
                    objParam.Add(new SqlParameter("@Nome", string.IsNullOrEmpty(objEnt.Nome) ? DBNull.Value as object : objEnt.Nome as object));
                    objParam.Add(new SqlParameter("@DataNasc", string.IsNullOrEmpty(objEnt.DataNasc) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataNasc) as object));
                    objParam.Add(new SqlParameter("@Cpf", string.IsNullOrEmpty(objEnt.Cpf) ? DBNull.Value as object : objEnt.Cpf as object));
                    objParam.Add(new SqlParameter("@Rg", string.IsNullOrEmpty(objEnt.Rg) ? DBNull.Value as object : objEnt.Rg as object));
                    objParam.Add(new SqlParameter("@Sexo", string.IsNullOrEmpty(objEnt.Sexo) ? DBNull.Value as object : objEnt.Sexo as object));
                    objParam.Add(new SqlParameter("@DataBatismo", string.IsNullOrEmpty(objEnt.DataBatismo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataBatismo) as object));
                    objParam.Add(new SqlParameter("@CodCidadeRes", string.IsNullOrEmpty(objEnt.CodCidadeRes) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCidadeRes) as object));
                    objParam.Add(new SqlParameter("@EndRes", string.IsNullOrEmpty(objEnt.EndRes) ? DBNull.Value as object : objEnt.EndRes as object));
                    objParam.Add(new SqlParameter("@NumRes", string.IsNullOrEmpty(objEnt.NumRes) ? DBNull.Value as object : objEnt.NumRes as object));
                    objParam.Add(new SqlParameter("@BairroRes", string.IsNullOrEmpty(objEnt.BairroRes) ? DBNull.Value as object : objEnt.BairroRes as object));
                    objParam.Add(new SqlParameter("@ComplRes", string.IsNullOrEmpty(objEnt.ComplRes) ? DBNull.Value as object : objEnt.ComplRes as object));
                    objParam.Add(new SqlParameter("@Telefone1", string.IsNullOrEmpty(objEnt.Telefone1) ? DBNull.Value as object : objEnt.Telefone1 as object));
                    objParam.Add(new SqlParameter("@Telefone2", string.IsNullOrEmpty(objEnt.Telefone2) ? DBNull.Value as object : objEnt.Telefone2 as object));
                    objParam.Add(new SqlParameter("@Celular1", string.IsNullOrEmpty(objEnt.Celular1) ? DBNull.Value as object : objEnt.Celular1 as object));
                    objParam.Add(new SqlParameter("@Celular2", string.IsNullOrEmpty(objEnt.Celular2) ? DBNull.Value as object : objEnt.Celular2 as object));
                    objParam.Add(new SqlParameter("@Email", string.IsNullOrEmpty(objEnt.Email) ? DBNull.Value as object : objEnt.Email as object));
                    objParam.Add(new SqlParameter("@CodCCB", string.IsNullOrEmpty(objEnt.CodCCB) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCCB) as object));
                    objParam.Add(new SqlParameter("@EstadoCivil", string.IsNullOrEmpty(objEnt.EstadoCivil) ? DBNull.Value as object : objEnt.EstadoCivil as object));
                    objParam.Add(new SqlParameter("@DataApresentacao", string.IsNullOrEmpty(objEnt.DataApresentacao) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataApresentacao) as object));
                    objParam.Add(new SqlParameter("@PaisCCB", string.IsNullOrEmpty(objEnt.PaisCCB) ? DBNull.Value as object : objEnt.PaisCCB as object));
                    objParam.Add(new SqlParameter("@Pai", string.IsNullOrEmpty(objEnt.Pai) ? DBNull.Value as object : objEnt.Pai as object));
                    objParam.Add(new SqlParameter("@Mae", string.IsNullOrEmpty(objEnt.Mae) ? DBNull.Value as object : objEnt.Mae as object));
                    objParam.Add(new SqlParameter("@FormacaoFora", string.IsNullOrEmpty(objEnt.FormacaoFora) ? DBNull.Value as object : objEnt.FormacaoFora as object));
                    objParam.Add(new SqlParameter("@LocalFormacao", string.IsNullOrEmpty(objEnt.LocalFormacao) ? DBNull.Value as object : objEnt.LocalFormacao as object));
                    objParam.Add(new SqlParameter("@QualFormacao", string.IsNullOrEmpty(objEnt.QualFormacao) ? DBNull.Value as object : objEnt.QualFormacao as object));
                    objParam.Add(new SqlParameter("@OutraOrquestra", string.IsNullOrEmpty(objEnt.OutraOrquestra) ? DBNull.Value as object : objEnt.OutraOrquestra as object));
                    objParam.Add(new SqlParameter("@Orquestra1", string.IsNullOrEmpty(objEnt.Orquestra1) ? DBNull.Value as object : objEnt.Orquestra1 as object));
                    objParam.Add(new SqlParameter("@Funcao1", string.IsNullOrEmpty(objEnt.Funcao1) ? DBNull.Value as object : objEnt.Funcao1 as object));
                    objParam.Add(new SqlParameter("@Orquestra2", string.IsNullOrEmpty(objEnt.Orquestra2) ? DBNull.Value as object : objEnt.Orquestra2 as object));
                    objParam.Add(new SqlParameter("@Funcao2", string.IsNullOrEmpty(objEnt.Funcao2) ? DBNull.Value as object : objEnt.Funcao2 as object));
                    objParam.Add(new SqlParameter("@Orquestra3", string.IsNullOrEmpty(objEnt.Orquestra3) ? DBNull.Value as object : objEnt.Orquestra3 as object));
                    objParam.Add(new SqlParameter("@Funcao3", string.IsNullOrEmpty(objEnt.Funcao3) ? DBNull.Value as object : objEnt.Funcao3 as object));
                    objParam.Add(new SqlParameter("@CodInstrumento", string.IsNullOrEmpty(objEnt.CodInstrumento) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodInstrumento) as object));
                    objParam.Add(new SqlParameter("@Desenvolvimento", string.IsNullOrEmpty(objEnt.Desenvolvimento) ? DBNull.Value as object : objEnt.Desenvolvimento as object));
                    objParam.Add(new SqlParameter("@DataUltimoTeste", string.IsNullOrEmpty(objEnt.DataUltimoTeste) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataUltimoTeste) as object));
                    objParam.Add(new SqlParameter("@DataInicioEstudo", string.IsNullOrEmpty(objEnt.DataInicioEstudo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataInicioEstudo) as object));
                    objParam.Add(new SqlParameter("@ExecutInstrumento", string.IsNullOrEmpty(objEnt.ExecutInstrumento) ? DBNull.Value as object : objEnt.ExecutInstrumento as object));
                    objParam.Add(new SqlParameter("@Importado", string.IsNullOrEmpty(objEnt.Importado) ? DBNull.Value as object : objEnt.Importado as object));
                    objParam.Add(new SqlParameter("@CodPessoa", string.IsNullOrEmpty(objEnt.CodPessoa) ? DBNull.Value as object : Convert.ToInt64(objEnt.CodPessoa) as object));

                    blnRetorno = objAcessa.executar(strInsert, objParam);
                }
                else
                {
                    //parametros da tabela principal
                    objParam.Add(new SqlParameter("@CodImportaPessoaItem", Convert.ToInt64(objEnt.CodImportaPessoaItem) as object));
                    objParam.Add(new SqlParameter("@CodImportaPessoa", string.IsNullOrEmpty(objEnt.CodImportaPessoa) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodImportaPessoa) as object));
                    objParam.Add(new SqlParameter("@DataCadastro", string.IsNullOrEmpty(objEnt.DataCadastro) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataCadastro) as object));
                    objParam.Add(new SqlParameter("@HoraCadastro", string.IsNullOrEmpty(objEnt.HoraCadastro) ? DBNull.Value as object : Convert.ToInt16(objEnt.HoraCadastro) as object));
                    objParam.Add(new SqlParameter("@CodCargo", string.IsNullOrEmpty(objEnt.CodCargo) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodCargo) as object));
                    objParam.Add(new SqlParameter("@Nome", string.IsNullOrEmpty(objEnt.Nome) ? DBNull.Value as object : objEnt.Nome as object));
                    objParam.Add(new SqlParameter("@DataNasc", string.IsNullOrEmpty(objEnt.DataNasc) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataNasc) as object));
                    objParam.Add(new SqlParameter("@Cpf", string.IsNullOrEmpty(objEnt.Cpf) ? DBNull.Value as object : objEnt.Cpf as object));
                    objParam.Add(new SqlParameter("@Rg", string.IsNullOrEmpty(objEnt.Rg) ? DBNull.Value as object : objEnt.Rg as object));
                    objParam.Add(new SqlParameter("@Sexo", string.IsNullOrEmpty(objEnt.Sexo) ? DBNull.Value as object : objEnt.Sexo as object));
                    objParam.Add(new SqlParameter("@DataBatismo", string.IsNullOrEmpty(objEnt.DataBatismo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataBatismo) as object));
                    objParam.Add(new SqlParameter("@CodCidadeRes", string.IsNullOrEmpty(objEnt.CodCidadeRes) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCidadeRes) as object));
                    objParam.Add(new SqlParameter("@EndRes", string.IsNullOrEmpty(objEnt.EndRes) ? DBNull.Value as object : objEnt.EndRes as object));
                    objParam.Add(new SqlParameter("@NumRes", string.IsNullOrEmpty(objEnt.NumRes) ? DBNull.Value as object : objEnt.NumRes as object));
                    objParam.Add(new SqlParameter("@BairroRes", string.IsNullOrEmpty(objEnt.BairroRes) ? DBNull.Value as object : objEnt.BairroRes as object));
                    objParam.Add(new SqlParameter("@ComplRes", string.IsNullOrEmpty(objEnt.ComplRes) ? DBNull.Value as object : objEnt.ComplRes as object));
                    objParam.Add(new SqlParameter("@Telefone1", string.IsNullOrEmpty(objEnt.Telefone1) ? DBNull.Value as object : objEnt.Telefone1 as object));
                    objParam.Add(new SqlParameter("@Telefone2", string.IsNullOrEmpty(objEnt.Telefone2) ? DBNull.Value as object : objEnt.Telefone2 as object));
                    objParam.Add(new SqlParameter("@Celular1", string.IsNullOrEmpty(objEnt.Celular1) ? DBNull.Value as object : objEnt.Celular1 as object));
                    objParam.Add(new SqlParameter("@Celular2", string.IsNullOrEmpty(objEnt.Celular2) ? DBNull.Value as object : objEnt.Celular2 as object));
                    objParam.Add(new SqlParameter("@Email", string.IsNullOrEmpty(objEnt.Email) ? DBNull.Value as object : objEnt.Email as object));
                    objParam.Add(new SqlParameter("@CodCCB", string.IsNullOrEmpty(objEnt.CodCCB) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCCB) as object));
                    objParam.Add(new SqlParameter("@EstadoCivil", string.IsNullOrEmpty(objEnt.EstadoCivil) ? DBNull.Value as object : objEnt.EstadoCivil as object));
                    objParam.Add(new SqlParameter("@DataApresentacao", string.IsNullOrEmpty(objEnt.DataApresentacao) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataApresentacao) as object));
                    objParam.Add(new SqlParameter("@PaisCCB", string.IsNullOrEmpty(objEnt.PaisCCB) ? DBNull.Value as object : objEnt.PaisCCB as object));
                    objParam.Add(new SqlParameter("@Pai", string.IsNullOrEmpty(objEnt.Pai) ? DBNull.Value as object : objEnt.Pai as object));
                    objParam.Add(new SqlParameter("@Mae", string.IsNullOrEmpty(objEnt.Mae) ? DBNull.Value as object : objEnt.Mae as object));
                    objParam.Add(new SqlParameter("@FormacaoFora", string.IsNullOrEmpty(objEnt.FormacaoFora) ? DBNull.Value as object : objEnt.FormacaoFora as object));
                    objParam.Add(new SqlParameter("@LocalFormacao", string.IsNullOrEmpty(objEnt.LocalFormacao) ? DBNull.Value as object : objEnt.LocalFormacao as object));
                    objParam.Add(new SqlParameter("@QualFormacao", string.IsNullOrEmpty(objEnt.QualFormacao) ? DBNull.Value as object : objEnt.QualFormacao as object));
                    objParam.Add(new SqlParameter("@OutraOrquestra", string.IsNullOrEmpty(objEnt.OutraOrquestra) ? DBNull.Value as object : objEnt.OutraOrquestra as object));
                    objParam.Add(new SqlParameter("@Orquestra1", string.IsNullOrEmpty(objEnt.Orquestra1) ? DBNull.Value as object : objEnt.Orquestra1 as object));
                    objParam.Add(new SqlParameter("@Funcao1", string.IsNullOrEmpty(objEnt.Funcao1) ? DBNull.Value as object : objEnt.Funcao1 as object));
                    objParam.Add(new SqlParameter("@Orquestra2", string.IsNullOrEmpty(objEnt.Orquestra2) ? DBNull.Value as object : objEnt.Orquestra2 as object));
                    objParam.Add(new SqlParameter("@Funcao2", string.IsNullOrEmpty(objEnt.Funcao2) ? DBNull.Value as object : objEnt.Funcao2 as object));
                    objParam.Add(new SqlParameter("@Orquestra3", string.IsNullOrEmpty(objEnt.Orquestra3) ? DBNull.Value as object : objEnt.Orquestra3 as object));
                    objParam.Add(new SqlParameter("@Funcao3", string.IsNullOrEmpty(objEnt.Funcao3) ? DBNull.Value as object : objEnt.Funcao3 as object));
                    objParam.Add(new SqlParameter("@CodInstrumento", string.IsNullOrEmpty(objEnt.CodInstrumento) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodInstrumento) as object));
                    objParam.Add(new SqlParameter("@Desenvolvimento", string.IsNullOrEmpty(objEnt.Desenvolvimento) ? DBNull.Value as object : objEnt.Desenvolvimento as object));
                    objParam.Add(new SqlParameter("@DataUltimoTeste", string.IsNullOrEmpty(objEnt.DataUltimoTeste) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataUltimoTeste) as object));
                    objParam.Add(new SqlParameter("@DataInicioEstudo", string.IsNullOrEmpty(objEnt.DataInicioEstudo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataInicioEstudo) as object));
                    objParam.Add(new SqlParameter("@ExecutInstrumento", string.IsNullOrEmpty(objEnt.ExecutInstrumento) ? DBNull.Value as object : objEnt.ExecutInstrumento as object));
                    objParam.Add(new SqlParameter("@Importado", string.IsNullOrEmpty(objEnt.Importado) ? DBNull.Value as object : objEnt.Importado as object));
                    objParam.Add(new SqlParameter("@CodPessoa", string.IsNullOrEmpty(objEnt.CodPessoa) ? DBNull.Value as object : Convert.ToInt64(objEnt.CodPessoa) as object));

                    blnRetorno = objAcessa.executar(strUpdate, objParam);
                }
                //retorna o blnRetorno da tabela principal
                return(blnRetorno);
            }
            catch (SqlException exl)
            {
                if (exl.Number.Equals(2601))
                {
                    throw new Exception("Não foi possivel salvar o registro, já que criaram" + "\n" +
                                        "valores duplicados na base de dados.");
                }
                else
                {
                    throw new Exception("Erro: " + exl.Message + "\n" + "Erro nº: " + exl.Number);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// Função que Retorna uma Lista Preenchida com os Valores Pesquisados
        /// </summary>
        /// <param name="objDtb"></param>
        /// <returns></returns>
        public List <MOD_importaPessoaItem> CriarLista(DataTable objDtb)
        {
            try
            {
                //instancia a lista
                List <MOD_importaPessoaItem> lista = new List <MOD_importaPessoaItem>();
                //faz um loop no DataTable e preenche a lista
                foreach (DataRow row in objDtb.Rows)
                {
                    //instancia a entidade
                    MOD_importaPessoaItem ent = new MOD_importaPessoaItem();
                    //adiciona os campos às propriedades
                    ent.CodImportaPessoaItem = (string)(row.IsNull("CodImportaPessoaItem") ? Convert.ToString(null) : Convert.ToString(row["CodImportaPessoaItem"]).PadLeft(6, '0'));
                    ent.CodImportaPessoa     = (string)(row.IsNull("CodImportaPessoa") ? Convert.ToString(null) : Convert.ToString(row["CodImportaPessoa"]).PadLeft(6, '0'));
                    ent.DataCadastro         = (string)(row.IsNull("DataCadastro") ? Convert.ToString(null) : funcoes.IntData(row["DataCadastro"].ToString()));
                    ent.HoraCadastro         = (string)(row.IsNull("HoraCadastro") ? Convert.ToString(null) : funcoes.IntHora(row["HoraCadastro"].ToString()));
                    ent.CodCargo             = (string)(row.IsNull("CodCargo") ? Convert.ToString(null) : Convert.ToString(row["CodCargo"]).PadLeft(3, '0'));
                    ent.DescCargo            = (string)(row.IsNull("DescCargo") ? null : row["DescCargo"]);
                    ent.Nome              = (string)(row.IsNull("Nome") ? null : row["Nome"]);
                    ent.DataNasc          = (string)(row.IsNull("DataNasc") ? Convert.ToString(null) : funcoes.IntData(row["DataNasc"].ToString()));
                    ent.Cpf               = (string)(row.IsNull("Cpf") ? null : row["Cpf"]);
                    ent.Rg                = (string)(row.IsNull("Rg") ? null : row["Rg"]);
                    ent.OrgaoEmissor      = (string)(row.IsNull("OrgaoEmissor") ? null : row["OrgaoEmissor"]);
                    ent.Sexo              = (string)(row.IsNull("Sexo") ? null : row["Sexo"]);
                    ent.DataBatismo       = (string)(row.IsNull("DataBatismo") ? Convert.ToString(null) : funcoes.IntData(row["DataBatismo"].ToString()));
                    ent.CodCidadeRes      = (string)(row.IsNull("CodCidadeRes") ? Convert.ToString(null) : Convert.ToString(row["CodCidadeRes"]).PadLeft(6, '0'));
                    ent.CidadeRes         = (string)(row.IsNull("CidadeRes") ? null : row["CidadeRes"]);
                    ent.EstadoRes         = (string)(row.IsNull("EstadoRes") ? null : row["EstadoRes"]);
                    ent.CepRes            = (string)(row.IsNull("CepRes") ? null : funcoes.FormataString("#####-###", row["CepRes"].ToString()));
                    ent.EndRes            = (string)(row.IsNull("EndRes") ? null : row["EndRes"]);
                    ent.NumRes            = (string)(row.IsNull("NumRes") ? null : row["NumRes"]);
                    ent.BairroRes         = (string)(row.IsNull("BairroRes") ? null : row["BairroRes"]);
                    ent.ComplRes          = (string)(row.IsNull("ComplRes") ? null : row["ComplRes"]);
                    ent.Telefone1         = (string)(row.IsNull("Telefone1") ? null : row["Telefone1"]);
                    ent.Telefone2         = (string)(row.IsNull("Telefone2") ? null : row["Telefone2"]);
                    ent.Celular1          = (string)(row.IsNull("Celular1") ? null : row["Celular1"]);
                    ent.Celular2          = (string)(row.IsNull("Celular2") ? null : row["Celular2"]);
                    ent.Email             = (string)(row.IsNull("Email") ? null : row["Email"]);
                    ent.CodCCB            = (string)(row.IsNull("CodCCB") ? Convert.ToString(null) : Convert.ToString(row["CodCCB"]).PadLeft(6, '0'));
                    ent.CodigoCCB         = (string)(row.IsNull("CodigoCCB") ? null : row["CodigoCCB"]);
                    ent.DescricaoCCB      = (string)(row.IsNull("DescricaoCCB") ? null : row["DescricaoCCB"]);
                    ent.EstadoCivil       = (string)(row.IsNull("EstadoCivil") ? null : row["EstadoCivil"]);
                    ent.DataApresentacao  = (string)(row.IsNull("DataApresentacao") ? Convert.ToString(null) : funcoes.IntData(row["DataApresentacao"].ToString()));
                    ent.Pai               = (string)(row.IsNull("Pai") ? null : row["Pai"]);
                    ent.Mae               = (string)(row.IsNull("Mae") ? null : row["Mae"]);
                    ent.FormacaoFora      = (string)(row.IsNull("FormacaoFora") ? null : row["FormacaoFora"]);
                    ent.LocalFormacao     = (string)(row.IsNull("LocalFormacao") ? null : row["LocalFormacao"]);
                    ent.QualFormacao      = (string)(row.IsNull("QualFormacao") ? null : row["QualFormacao"]);
                    ent.OutraOrquestra    = (string)(row.IsNull("OutraOrquestra") ? null : row["OutraOrquestra"]);
                    ent.Orquestra1        = (string)(row.IsNull("Orquestra1") ? null : row["Orquestra1"]);
                    ent.Funcao1           = (string)(row.IsNull("Funcao1") ? null : row["Funcao1"]);
                    ent.Orquestra2        = (string)(row.IsNull("Orquestra2") ? null : row["Orquestra2"]);
                    ent.Funcao2           = (string)(row.IsNull("Funcao2") ? null : row["Funcao2"]);
                    ent.CodInstrumento    = (string)(row.IsNull("CodInstrumento") ? Convert.ToString(null) : Convert.ToString(row["CodInstrumento"]).PadLeft(5, '0'));
                    ent.DescInstrumento   = (string)(row.IsNull("DescInstrumento") ? null : row["DescInstrumento"]);
                    ent.Desenvolvimento   = (string)(row.IsNull("Desenvolvimento") ? null : row["Desenvolvimento"]);
                    ent.DataUltimoTeste   = (string)(row.IsNull("DataUltimoTeste") ? Convert.ToString(null) : funcoes.IntData(row["DataUltimoTeste"].ToString()));
                    ent.DataInicioEstudo  = (string)(row.IsNull("DataInicioEstudo") ? Convert.ToString(null) : funcoes.IntData(row["DataInicioEstudo"].ToString()));
                    ent.ExecutInstrumento = (string)(row.IsNull("ExecutInstrumento") ? null : row["ExecutInstrumento"]);
                    ent.CodCCBGem         = (string)(row.IsNull("CodCCBGem") ? Convert.ToString(null) : Convert.ToString(row["CodCCBGem"]).PadLeft(6, '0'));
                    ent.CodigoCCBGem      = (string)(row.IsNull("CodigoCCBGem") ? null : row["CodigoCCBGem"]);
                    ent.DescricaoCCBGem   = (string)(row.IsNull("DescricaoCCBGem") ? null : row["DescricaoCCBGem"]);
                    ent.Sequencia         = Convert.ToString(lista.Count + 1).PadLeft(5, '0');

                    //adiciona os dados à lista
                    lista.Add(ent);
                }
                //retorna a lista com os valores pesquisados
                return(lista);
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#10
0
        /// <summary>
        /// Função INSERT - Utilzada para Inserir os dados na Base
        /// </summary>
        /// <param name="objEnt"></param>
        /// <returns></returns>
        public bool Insert(MOD_importaPessoaItem objEnt)
        {
            try
            {
                //Varivel boleana que retorna se foi executado ou não no Banco
                //Tabela ImportaPessoaItem
                bool blnRetorno = false;
                //Declara a lista de parametros da tabela
                List <SqlParameter> objParam = new List <SqlParameter>
                {
                    //parametros da tabela principal
                    new SqlParameter("@CodImportaPessoaItem", string.IsNullOrEmpty(objEnt.CodImportaPessoaItem) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodImportaPessoaItem) as object),
                    new SqlParameter("@CodImportaPessoa", string.IsNullOrEmpty(objEnt.CodImportaPessoa) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodImportaPessoa) as object),
                    new SqlParameter("@DataCadastro", string.IsNullOrEmpty(objEnt.DataCadastro) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataCadastro) as object),
                    new SqlParameter("@HoraCadastro", string.IsNullOrEmpty(objEnt.HoraCadastro) ? DBNull.Value as object : Convert.ToInt16(objEnt.HoraCadastro) as object),
                    new SqlParameter("@CodCargo", string.IsNullOrEmpty(objEnt.CodCargo) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodCargo) as object),
                    new SqlParameter("@Nome", string.IsNullOrEmpty(objEnt.Nome) ? DBNull.Value as object : objEnt.Nome as object),
                    new SqlParameter("@DataNasc", string.IsNullOrEmpty(objEnt.DataNasc) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataNasc) as object),
                    new SqlParameter("@Cpf", string.IsNullOrEmpty(objEnt.Cpf) ? DBNull.Value as object : objEnt.Cpf as object),
                    new SqlParameter("@Rg", string.IsNullOrEmpty(objEnt.Rg) ? DBNull.Value as object : objEnt.Rg as object),
                    new SqlParameter("@Sexo", string.IsNullOrEmpty(objEnt.Sexo) ? DBNull.Value as object : objEnt.Sexo as object),
                    new SqlParameter("@DataBatismo", string.IsNullOrEmpty(objEnt.DataBatismo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataBatismo) as object),
                    new SqlParameter("@CodCidadeRes", string.IsNullOrEmpty(objEnt.CodCidadeRes) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCidadeRes) as object),
                    new SqlParameter("@EndRes", string.IsNullOrEmpty(objEnt.EndRes) ? DBNull.Value as object : objEnt.EndRes as object),
                    new SqlParameter("@NumRes", string.IsNullOrEmpty(objEnt.NumRes) ? DBNull.Value as object : objEnt.NumRes as object),
                    new SqlParameter("@BairroRes", string.IsNullOrEmpty(objEnt.BairroRes) ? DBNull.Value as object : objEnt.BairroRes as object),
                    new SqlParameter("@ComplRes", string.IsNullOrEmpty(objEnt.ComplRes) ? DBNull.Value as object : objEnt.ComplRes as object),
                    new SqlParameter("@Telefone1", string.IsNullOrEmpty(objEnt.Telefone1) ? DBNull.Value as object : objEnt.Telefone1 as object),
                    new SqlParameter("@Telefone2", string.IsNullOrEmpty(objEnt.Telefone2) ? DBNull.Value as object : objEnt.Telefone2 as object),
                    new SqlParameter("@Celular1", string.IsNullOrEmpty(objEnt.Celular1) ? DBNull.Value as object : objEnt.Celular1 as object),
                    new SqlParameter("@Celular2", string.IsNullOrEmpty(objEnt.Celular2) ? DBNull.Value as object : objEnt.Celular2 as object),
                    new SqlParameter("@Email", string.IsNullOrEmpty(objEnt.Email) ? DBNull.Value as object : objEnt.Email as object),
                    new SqlParameter("@CodCCB", string.IsNullOrEmpty(objEnt.CodCCB) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCCB) as object),
                    new SqlParameter("@EstadoCivil", string.IsNullOrEmpty(objEnt.EstadoCivil) ? DBNull.Value as object : objEnt.EstadoCivil as object),
                    new SqlParameter("@DataApresentacao", string.IsNullOrEmpty(objEnt.DataApresentacao) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataApresentacao) as object),
                    new SqlParameter("@PaisCCB", string.IsNullOrEmpty(objEnt.PaisCCB) ? DBNull.Value as object : objEnt.PaisCCB as object),
                    new SqlParameter("@Pai", string.IsNullOrEmpty(objEnt.Pai) ? DBNull.Value as object : objEnt.Pai as object),
                    new SqlParameter("@Mae", string.IsNullOrEmpty(objEnt.Mae) ? DBNull.Value as object : objEnt.Mae as object),
                    new SqlParameter("@FormacaoFora", string.IsNullOrEmpty(objEnt.FormacaoFora) ? DBNull.Value as object : objEnt.FormacaoFora as object),
                    new SqlParameter("@LocalFormacao", string.IsNullOrEmpty(objEnt.LocalFormacao) ? DBNull.Value as object : objEnt.LocalFormacao as object),
                    new SqlParameter("@QualFormacao", string.IsNullOrEmpty(objEnt.QualFormacao) ? DBNull.Value as object : objEnt.QualFormacao as object),
                    new SqlParameter("@OutraOrquestra", string.IsNullOrEmpty(objEnt.OutraOrquestra) ? DBNull.Value as object : objEnt.OutraOrquestra as object),
                    new SqlParameter("@Orquestra1", string.IsNullOrEmpty(objEnt.Orquestra1) ? DBNull.Value as object : objEnt.Orquestra1 as object),
                    new SqlParameter("@Funcao1", string.IsNullOrEmpty(objEnt.Funcao1) ? DBNull.Value as object : objEnt.Funcao1 as object),
                    new SqlParameter("@Orquestra2", string.IsNullOrEmpty(objEnt.Orquestra2) ? DBNull.Value as object : objEnt.Orquestra2 as object),
                    new SqlParameter("@Funcao2", string.IsNullOrEmpty(objEnt.Funcao2) ? DBNull.Value as object : objEnt.Funcao2 as object),
                    new SqlParameter("@Orquestra3", string.IsNullOrEmpty(objEnt.Orquestra3) ? DBNull.Value as object : objEnt.Orquestra3 as object),
                    new SqlParameter("@Funcao3", string.IsNullOrEmpty(objEnt.Funcao3) ? DBNull.Value as object : objEnt.Funcao3 as object),
                    new SqlParameter("@CodInstrumento", string.IsNullOrEmpty(objEnt.CodInstrumento) ? DBNull.Value as object : Convert.ToInt16(objEnt.CodInstrumento) as object),
                    new SqlParameter("@CodCCBGem", string.IsNullOrEmpty(objEnt.CodCCBGem) ? DBNull.Value as object : Convert.ToInt32(objEnt.CodCCBGem) as object),
                    new SqlParameter("@Desenvolvimento", string.IsNullOrEmpty(objEnt.Desenvolvimento) ? DBNull.Value as object : objEnt.Desenvolvimento as object),
                    new SqlParameter("@DataUltimoTeste", string.IsNullOrEmpty(objEnt.DataUltimoTeste) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataUltimoTeste) as object),
                    new SqlParameter("@DataInicioEstudo", string.IsNullOrEmpty(objEnt.DataInicioEstudo) ? DBNull.Value as object : Convert.ToInt32(objEnt.DataInicioEstudo) as object),
                    new SqlParameter("@ExecutInstrumento", string.IsNullOrEmpty(objEnt.ExecutInstrumento) ? DBNull.Value as object : objEnt.ExecutInstrumento as object),
                    new SqlParameter("@Importado", string.IsNullOrEmpty(objEnt.Importado) ? DBNull.Value as object : objEnt.Importado as object),
                    new SqlParameter("@CodPessoa", string.IsNullOrEmpty(objEnt.CodPessoa) ? DBNull.Value as object : Convert.ToInt64(objEnt.CodPessoa) as object),
                    new SqlParameter("@OrgaoEmissor", string.IsNullOrEmpty(objEnt.OrgaoEmissor) ? DBNull.Value as object : objEnt.OrgaoEmissor as object),
                };

                return(blnRetorno = objAcessa.executar(objDAL.StrInsert, objParam));
            }
            catch (SqlException exl)
            {
                throw exl;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }