Ejemplo n.º 1
0
        public Pollux.MSG0167 DefinirPropriedadesPlugin(ParametroGlobal objModel)
        {
            Pollux.MSG0167 retMsgProp = new Pollux.MSG0167(Domain.Enum.Sistemas.RetornaSistema(Domain.Enum.Sistemas.Sistema.CRM), objModel.ID.ToString());
            TipodeParametroGlobalService tipoParamService = new TipodeParametroGlobalService(this.Organizacao, this.IsOffline);
            CategoriaService             catService       = new CategoriaService(this.Organizacao, this.IsOffline);
            BeneficioService             benefService     = new BeneficioService(this.Organizacao, this.IsOffline);
            UnidadeNegocioService        unidNegService   = new UnidadeNegocioService(this.Organizacao, this.IsOffline);

            retMsgProp.CodigoParametroGlobal = objModel.ID.Value.ToString();
            retMsgProp.NomeParametroGlobal   = objModel.Nome;

            var tipoParamObj = tipoParamService.ObterPor(objModel.TipoParametro.Id);

            retMsgProp.TipoParametroGlobal = tipoParamObj.Codigo;

            if (objModel.Classificacao != null)
            {
                retMsgProp.CodigoClassificacao = objModel.Classificacao.Id.ToString();
            }

            if (objModel.Compromisso != null)
            {
                retMsgProp.CodigoCompromisso = objModel.Compromisso.Id.ToString();
            }

            if (objModel.Categoria != null)
            {
                retMsgProp.CodigoCategoria = objModel.Categoria.Id.ToString();
                var catObj = catService.ObterPor(objModel.Categoria.Id);
                retMsgProp.CategoriaCodigo = Int32.Parse(catObj.CodigoCategoria);
            }

            if (objModel.Beneficio != null)
            {
                retMsgProp.CodigoBeneficio = objModel.Beneficio.Id.ToString();
                var benefObj = benefService.ObterPor(objModel.Beneficio.Id);
                retMsgProp.BeneficioCodigo = benefObj.Codigo;
            }

            if (objModel.NivelPosVenda != null)
            {
                retMsgProp.CodigoNivelPosVenda = objModel.NivelPosVenda.Id.ToString();
            }

            if (objModel.UnidadeNegocio != null)
            {
                var unidNegObj = unidNegService.BuscaUnidadeNegocio(objModel.UnidadeNegocio.Id);
                retMsgProp.CodigoUnidadeNegocio = unidNegObj.ChaveIntegracao;
            }

            retMsgProp.TipoDado             = objModel.TipoDado;
            retMsgProp.ValorParametroGlobal = objModel.Valor;
            retMsgProp.Situacao             = objModel.State;

            return(retMsgProp);
        }
Ejemplo n.º 2
0
        public string Enviar(ParametroGlobal objModel)
        {
            string resposta;

            Intelbras.Message.Helper.MSG0167 mensagem = DefinirPropriedadesPlugin(objModel);

            Domain.Servicos.Integracao integracao = new Servicos.Integracao(this.Organizacao, this.IsOffline);

            if (integracao.EnviarMensagemBarramento(mensagem.GenerateMessage(true), "1", "1", out resposta))
            {
                Intelbras.Message.Helper.MSG0167R1 retorno = CarregarMensagem <Pollux.MSG0167R1>(resposta);
                if (!retorno.Resultado.Sucesso)
                {
                    throw new ArgumentException("(CRM) " + retorno.Resultado.Mensagem);
                }
            }
            else
            {
                Intelbras.Message.Helper.ERR0001 erro001 = CarregarMensagem <Pollux.ERR0001>(resposta);
                throw new ArgumentException("(CRM) " + erro001.GenerateMessage(false));
            }
            return(resposta);
        }
Ejemplo n.º 3
0
 public ParametroGlobal DefinirPropriedades(Intelbras.Message.Helper.MSG0167 xml)
 {
     throw new NotImplementedException();
 }