public string Enviar(ArquivoDeSellOut objModel, ref string nomeAbrevRet, ref string codigoClienteRet) { string retMsg = String.Empty; Intelbras.Message.Helper.MSG0162 mensagem = this.DefinirPropriedades(objModel); Domain.Servicos.Integracao integracao = new Servicos.Integracao(this.Organizacao, this.IsOffline); if (integracao.EnviarMensagemBarramento(mensagem.GenerateMessage(true), "1", "1", out retMsg)) { Intelbras.Message.Helper.MSG0162R1 retorno = CarregarMensagem <Pollux.MSG0162R1>(retMsg); if (retorno.Resultado.Sucesso) { //if (!String.IsNullOrEmpty(retorno.NomeAbreviado)) // nomeAbrevRet = retorno.NomeAbreviado; //if (retorno.CodigoCliente.HasValue) // codigoClienteRet = retorno.CodigoCliente.Value.ToString(); } else { throw new Exception(string.Concat(retorno.Resultado.Mensagem)); } } else { Intelbras.Message.Helper.ERR0001 erro001 = CarregarMensagem <Pollux.ERR0001>(retMsg); throw new Exception(string.Concat(erro001.GenerateMessage(false))); } return(retMsg); }
public Pollux.MSG0162 DefinirPropriedades(ArquivoDeSellOut objModel) { #region Propriedades Crm->Xml Pollux.MSG0162 msg0162 = new Pollux.MSG0162(itb.RetornaSistema(itb.Sistema.CRM), Helper.Truncate(objModel.Nome, 40)); //msg0162.CodigoArquivoSellout = objModel. #endregion return(msg0162); }
public ArquivoDeSellOut DefinirPropriedades(Intelbras.Message.Helper.MSG0162 xml) { var crm = new ArquivoDeSellOut(this.Organizacao, this.IsOffline); #region Propriedades Crm->Xml if (!String.IsNullOrEmpty(xml.CodigoArquivoSellout)) { crm.ID = new Guid(xml.CodigoArquivoSellout); } if (xml.DataEnvio.HasValue) { crm.DataDeEnvio = xml.DataEnvio.Value; } else { resultadoPersistencia.Sucesso = false; resultadoPersistencia.Mensagem = "Data de Envio não Informada."; return(crm); } if (xml.StatusProcessamento.HasValue) { if (xml.StatusProcessamento.Value != 2) { crm.RazaoStatus = xml.StatusProcessamento.Value; } } else { resultadoPersistencia.Sucesso = false; resultadoPersistencia.Mensagem = "Status de Processamento não Informada."; return(crm); } if (xml.Situacao.HasValue) { crm.Status = xml.Situacao.Value; } crm.Nome = xml.Nome; if (xml.DataProcessamento.HasValue) { crm.DataDeProcessamento = xml.DataProcessamento.Value; } if (!String.IsNullOrEmpty(xml.CodigoConta)) { crm.Conta = new Lookup(new Guid(xml.CodigoConta.ToString()), "account"); } else { resultadoPersistencia.Sucesso = false; resultadoPersistencia.Mensagem = "Canal relacionado ao arquivo de Sell Out não Informada."; return(crm); } crm.IntegradoEm = DateTime.Now; crm.IntegradoPor = usuarioIntegracao.NomeCompleto; crm.UsuarioIntegracao = xml.LoginUsuario; crm.Origem = xml.OrigemArquivo; #endregion return(crm); }