Ejemplo n.º 1
0
        public static List<ClienteDiretorInfo> ConverterDiretor(SinacorDiretorInfo pDiretor)
        {
            List<ClienteDiretorInfo> lRetorno = new List<ClienteDiretorInfo>();

            if (null != pDiretor.NM_DIRETOR_1 && pDiretor.NM_DIRETOR_1.Trim().Length > 0)
            {
                ClienteDiretorInfo lDiretor1 = new ClienteDiretorInfo();
                lDiretor1.DsNome = pDiretor.NM_DIRETOR_1;
                lDiretor1.DsIdentidade = pDiretor.CD_DOC_IDENT_DIR1;
                lDiretor1.NrCpfCnpj = pDiretor.CD_CPFCGC_DIR1.Value.ToString();
                lDiretor1.IdCliente = 0;
                lRetorno.Add(lDiretor1);
            }
            if (null != pDiretor.NM_DIRETOR_2 && pDiretor.NM_DIRETOR_2.Trim().Length > 0)
            {
                ClienteDiretorInfo lDiretor2 = new ClienteDiretorInfo();
                lDiretor2.DsNome = pDiretor.NM_DIRETOR_2;
                lDiretor2.DsIdentidade = pDiretor.CD_DOC_IDENT_DIR2;
                lDiretor2.NrCpfCnpj = pDiretor.CD_CPFCGC_DIR2.Value.ToString();
                lDiretor2.IdCliente = 0;
                lRetorno.Add(lDiretor2);
            }
            if (null != pDiretor.NM_DIRETOR_3 && pDiretor.NM_DIRETOR_3.Trim().Length > 0)
            {
                ClienteDiretorInfo lDiretor3 = new ClienteDiretorInfo();
                lDiretor3.DsNome = pDiretor.NM_DIRETOR_3;
                lDiretor3.DsIdentidade = pDiretor.CD_DOC_IDENT_DIR3;
                lDiretor3.NrCpfCnpj = pDiretor.CD_CPFCGC_DIR3.Value.ToString();
                lDiretor3.IdCliente = 0;
                lRetorno.Add(lDiretor3);
            }

            return lRetorno;
        }
Ejemplo n.º 2
0
        public static List <ClienteDiretorInfo> GetClienteDiretorPorIdCliente(ClienteInfo pParametros)
        {
            List <ClienteDiretorInfo> resposta = new List <ClienteDiretorInfo>();

            ConexaoDbHelper lAcessaDados = new ConexaoDbHelper();

            lAcessaDados.ConnectionStringName = gNomeConexaoCadastro;

            using (DbCommand lDbCommand = lAcessaDados.CreateCommand(CommandType.StoredProcedure, "cliente_diretor_lst_porcliente_sp"))
            {
                lAcessaDados.AddInParameter(lDbCommand, "@id_cliente", DbType.Int32, pParametros.IdCliente);

                DataTable lDataTable = lAcessaDados.ExecuteDbDataTable(lDbCommand);

                foreach (DataRow item in lDataTable.Rows)
                {
                    ClienteDiretorInfo lDiretor = new ClienteDiretorInfo();
                    lDiretor.NrCpfCnpj        = (item["ds_cpfcnpj"]).DBToString();
                    lDiretor.DsIdentidade     = (item["ds_identidade"]).DBToString();
                    lDiretor.DsNome           = (item["ds_nome"]).DBToString();
                    lDiretor.IdCliente        = (item["id_cliente"]).DBToInt32();
                    lDiretor.IdClienteDiretor = (item["id_cliente_diretor"]).DBToInt32();
                    lDiretor.CdOrgaoEmissor   = (item["cd_orgaoemissor"]).DBToString();
                    lDiretor.CdUfOrgaoEmissor = (item["cd_uforgaoemissordocumento"]).DBToString();
                    resposta.Add(lDiretor);
                }
            }

            return(resposta);
        }
Ejemplo n.º 3
0
        private static void LogarModificacao(ClienteDiretorInfo pParametro, int IdUsuarioLogado, string DescricaoUsuarioLogado)
        {
            ReceberEntidadeRequest <ClienteDiretorInfo> lEntrada = new ReceberEntidadeRequest <ClienteDiretorInfo>();

            lEntrada.Objeto = pParametro;
            ReceberObjetoResponse <ClienteDiretorInfo> lRetorno = ReceberClienteDiretor(lEntrada);

            LogCadastro.Logar(lRetorno.Objeto, IdUsuarioLogado, DescricaoUsuarioLogado, LogCadastro.eAcao.Receber);
        }
Ejemplo n.º 4
0
        private string ResponderExcluir()
        {
            string lRetorno = "";

            string lID = Request["Id"];

            if (!string.IsNullOrEmpty(lID))
            {
                RemoverEntidadeCadastroRequest <ClienteDiretorInfo> lRequest;

                RemoverEntidadeCadastroResponse lResponse;

                try
                {
                    ClienteDiretorInfo lClitelInfo = new ClienteDiretorInfo();

                    lClitelInfo.IdClienteDiretor = int.Parse(lID);

                    lRequest = new RemoverEntidadeCadastroRequest <ClienteDiretorInfo>()
                    {
                        EntidadeCadastro       = lClitelInfo,
                        DescricaoUsuarioLogado = base.UsuarioLogado.Nome,
                        IdUsuarioLogado        = base.UsuarioLogado.Id
                    };

                    try
                    {
                        lResponse = ServicoPersistenciaCadastro.RemoverEntidadeCadastro <ClienteDiretorInfo>(lRequest);

                        if (lResponse.StatusResposta == MensagemResponseStatusEnum.OK)
                        {
                            lRetorno = RetornarSucessoAjax("Dados Excluidos com sucesso", new object[] { });
                            base.RegistrarLogExclusao();
                        }
                        else
                        {
                            lRetorno = RetornarErroAjax(lResponse.DescricaoResposta);
                        }
                    }
                    catch (Exception exEnvioRequest)
                    {
                        lRetorno = RetornarErroAjax("Erro durante o envio do request para excluir os dados", exEnvioRequest);
                    }
                }
                catch (Exception exConversao)
                {
                    lRetorno = RetornarErroAjax("Erro ao converter os dados", exConversao);
                }
            }
            else
            {
                lRetorno = RetornarErroAjax("Foi enviada ação de cadastro sem objeto para excluir");
            }

            return(lRetorno);
        }
Ejemplo n.º 5
0
 public TransporteDiretor(ClienteDiretorInfo pDiretor, bool pExclusao)
 {
     this.Id             = pDiretor.IdClienteDiretor;
     this.Identidade     = pDiretor.DsIdentidade;
     this.ParentId       = pDiretor.IdCliente;
     this.UfOrgaoEmissor = pDiretor.CdUfOrgaoEmissor;
     this.OrgaoEmissor   = pDiretor.CdOrgaoEmissor;
     this.CPF            = pDiretor.NrCpfCnpj;
     this.Nome           = pDiretor.DsNome;
     this.Exclusao       = pExclusao;
 }
Ejemplo n.º 6
0
        private static ClienteDiretorInfo CriarRegistroClienteDiretorInfo(DataRow linha)
        {
            ClienteDiretorInfo lClienteDiretorInfo = new ClienteDiretorInfo();

            lClienteDiretorInfo.NrCpfCnpj        = linha["ds_cpfcnpj"].DBToString();
            lClienteDiretorInfo.DsIdentidade     = linha["ds_identidade"].DBToString();
            lClienteDiretorInfo.DsNome           = linha["ds_nome"].DBToString();
            lClienteDiretorInfo.IdCliente        = linha["id_cliente"].DBToInt32();
            lClienteDiretorInfo.IdClienteDiretor = linha["id_cliente_diretor"].DBToInt32();
            lClienteDiretorInfo.CdUfOrgaoEmissor = linha["cd_uforgaoemissordocumento"].DBToString();
            lClienteDiretorInfo.CdOrgaoEmissor   = linha["cd_orgaoemissor"].DBToString();
            return(lClienteDiretorInfo);
        }
Ejemplo n.º 7
0
        public ClienteDiretorInfo ToClienteDiretorInfo()
        {
            ClienteDiretorInfo lDiretor = new ClienteDiretorInfo()
            {
                CdOrgaoEmissor   = this.OrgaoEmissor,
                CdUfOrgaoEmissor = this.UfOrgaoEmissor,
                DsIdentidade     = this.Identidade,
                DsNome           = this.Nome,
                IdCliente        = this.ParentId,
                IdClienteDiretor = this.Id,
                NrCpfCnpj        = this.CPF
            };

            return(lDiretor);
        }
Ejemplo n.º 8
0
        private string ResponderCarregarHtmlComDados()
        {
            ConsultarEntidadeCadastroRequest <ClienteDiretorInfo>  lRequest;
            ConsultarEntidadeCadastroResponse <ClienteDiretorInfo> lResponse;

            bool lExcluir = true;

            ClienteDiretorInfo lDados = new ClienteDiretorInfo(Request["Id"]);

            lRequest = new ConsultarEntidadeCadastroRequest <ClienteDiretorInfo>()
            {
                EntidadeCadastro       = lDados,
                DescricaoUsuarioLogado = base.UsuarioLogado.Nome,
                IdUsuarioLogado        = base.UsuarioLogado.Id
            };

            lResponse = this.ServicoPersistenciaCadastro.ConsultarEntidadeCadastro <ClienteDiretorInfo>(lRequest);

            btnSalvar.Visible = UsuarioPode("Salvar", "923DF791-18B0-4761-8276-10D99FBA71CE");

            NovoDiretor.Visible = UsuarioPode("Incluir", "4239f749-5c0c-4fd0-abdd-281d94a11744", "923DF791-18B0-4761-8276-10D99FBA71CE");

            lExcluir = UsuarioPode("Excluir", "1898E735-06A4-445F-A6FC-C8E4635832FF");


            if (lResponse.StatusResposta == MensagemResponseStatusEnum.OK)
            {
                if (lResponse.Resultado.Count == 0 && NovoDiretor.Visible)
                {
                    btnSalvar.Visible = true;
                }

                IEnumerable <TransporteDiretor> lLista = from ClienteDiretorInfo t
                                                         in lResponse.Resultado
                                                         select new TransporteDiretor(t, lExcluir);

                hidClientes_Diretores_ListaJson.Value = JsonConvert.SerializeObject(lLista);
            }
            else
            {
                //RetornarErroAjax("Erro ao consultar os Diretores do cliente", lResponse.DescricaoResposta);
            }

            //hidDadosCompletos_PF.Value = JsonConvert.SerializeObject(lClientePf);

            return(string.Empty);    //só para obedecer assinatura
        }