public MsgRegistroNegocios AdaptaDataSetNegocioToMsgNegocio(DataSetNegocioOutrosBancos dataset, IList <string> erros)
        {
            _log.TraceMethodStart();

            MsgRegistroNegocios msg = new MsgRegistroNegocios();

            if (dataset.RegistroNegocioOutrosBancos != null && dataset.RegistroNegocioOutrosBancos.Any())
            {
                msg = AdaptarDataSetNegociosRegistroNegociosToMsgNegocios(dataset.RegistroNegocioOutrosBancos.First(), erros);
            }

            _log.TraceMethodEnd();

            return(msg);
        }
Esempio n. 2
0
        public DataSetNegocioOutrosBancos SelecionarNegocios(ParametroIntegracaoPessoa param, string cod_pessoa, string cod_filial = null)
        {
            _log.TraceMethodStart();

            CucCluParametro parametrosLogin = GerarParametroCUC(param);

            ConfiguracaoURICUC configuracaoURICUC          = ConfiguracaoCUCService.BuscarURI(ConstantesInegracao.URLConfiguracao.CadastroNegocios, _configuracaoCUC);
            EndpointAddress    address                     = new EndpointAddress(configuracaoURICUC.URI);
            CucClwCadastroNegocioOutrosBancosClient client = new CucClwCadastroNegocioOutrosBancosClient(CucClwCadastroNegocioOutrosBancosClient.EndpointConfiguration.BasicHttpBinding_ICucClwCadastroNegocioOutrosBancos, address);

            try
            {
                var ret = client.Selecionar(parametrosLogin, cod_pessoa, cod_filial);
                RetornoIntegracaoNegocios retorno = GerarRetornoIntegracaoNegocios(ret);

                if (retorno.Excecao != null)
                {
                    throw new ApplicationException($"Retorno serviço CUC - {ret.Excecao.Mensagem}");
                }

                if (string.IsNullOrWhiteSpace(retorno.Xml))
                {
                    throw new ApplicationException("Dados não encontrados para os parâmetros informados");
                }

                XmlSerializer xmlSerialize = new XmlSerializer(typeof(DataSetNegocioOutrosBancos));

                var valor_serealizado = new StringReader(retorno.Xml);

                DataSetNegocioOutrosBancos dataSetNegocios = (DataSetNegocioOutrosBancos)xmlSerialize.Deserialize(valor_serealizado);

                _log.TraceMethodEnd();

                return(dataSetNegocios);
            }
            catch (TimeoutException timeoutEx)
            {
                client.Abort();
                throw new Exception("Tempo de conexão expirado", timeoutEx);
            }
            catch (EndpointNotFoundException endPointEx)
            {
                throw new Exception("Caminho do serviço não disponível ou inválido", endPointEx);
            }
        }
Esempio n. 3
0
        public RetornoIntegracaoNegocios AtualizarNegocios(ParametroIntegracaoPessoa param, DataSetNegocioOutrosBancos dataSetNegocios)
        {
            _log.TraceMethodStart();

            string stringXML           = string.Empty;
            XmlSerializerNamespaces ns = new XmlSerializerNamespaces();

            ns.Add("", "");
            XmlSerializer x = new XmlSerializer(typeof(DataSetNegocioOutrosBancos));

            using (StringWriter textWriter = new StringWriter())
            {
                x.Serialize(textWriter, dataSetNegocios, ns);
                stringXML = textWriter.ToString();
            }

            _log.Trace("XML Gerado: " + stringXML);
            _log.TraceMethodEnd();

            return(AtualizarNegocios(param, stringXML));
        }