Exemplo n.º 1
0
        public Pollux.MSG0165 DefinirPropriedadesPlugin(BeneficioDoCanal objModel)
        {
            Pollux.MSG0165          retMsgProp         = new Pollux.MSG0165(Domain.Enum.Sistemas.RetornaSistema(Domain.Enum.Sistemas.Sistema.CRM), objModel.ID.ToString());
            BeneficioService        benefService       = new BeneficioService(this.Organizacao, this.IsOffline);
            StatusBeneficiosService statusBenefService = new StatusBeneficiosService(this.Organizacao, this.IsOffline);

            retMsgProp.CodigoBeneficioCanal = objModel.ID.ToString();
            retMsgProp.NomeBeneficioCanal   = objModel.Nome;
            retMsgProp.CodigoConta          = objModel.Canal.Id.ToString();
            retMsgProp.CodigoBeneficio      = objModel.Beneficio.Id.ToString();

            Beneficio benefObj = benefService.ObterPor(objModel.Beneficio.Id);

            retMsgProp.BeneficioCodigo      = benefObj.Codigo;
            retMsgProp.NomeBeneficio        = benefObj.Nome;
            retMsgProp.CodigoCategoria      = objModel.Categoria.Id.ToString();
            retMsgProp.CategoriaCodigo      = Int32.Parse(objModel.CategoriaObj.CodigoCategoria);
            retMsgProp.NomeCategoria        = objModel.CategoriaObj.Nome;
            retMsgProp.CodigoUnidadeNegocio = objModel.UnidadeNegocioObj.ChaveIntegracao;
            retMsgProp.NomeUnidadeNegocio   = objModel.UnidadeNegocioObj.Nome;

            if (objModel.StatusBeneficio != null)
            {
                retMsgProp.CodigoStatusBeneficio = objModel.StatusBeneficio.Id.ToString();
                StatusBeneficios statusBenefObj = statusBenefService.ObterPor(objModel.StatusBeneficio.Id);
                retMsgProp.NomeStatusBeneficio = statusBenefObj.Nome;
            }

            retMsgProp.CalcularVerba               = objModel.CalculaVerba;
            retMsgProp.AcumularVerba               = objModel.AcumulaVerba;
            retMsgProp.PassivelSolicitacao         = objModel.BeneficioObj.PassivelDeSolicitacao;
            retMsgProp.PossuiControleContaCorrente = objModel.BeneficioObj.PossuiControleContaCorrente;
            retMsgProp.Situacao         = objModel.Status;
            retMsgProp.Proprietario     = "259A8E4F-15E9-E311-9420-00155D013D39";
            retMsgProp.TipoProprietario = "systemuser";

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

            Intelbras.Message.Helper.MSG0165 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.MSG0165R1 retorno = CarregarMensagem <Pollux.MSG0165R1>(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);
        }
Exemplo n.º 3
0
 public string Enviar(BeneficioDoCanal objModel)
 {
     return(String.Empty);
 }
Exemplo n.º 4
0
        public string Executar(string mensagem, string numeroMensagem, Domain.Model.Usuario usuario)
        {
            try
            {
                usuarioIntegracao = usuario;
                BeneficioDoCanal beneficioCanalConsulta = null;
                List <Pollux.Entities.SolicitacaoBeneficio> lstRetorno = new List <Pollux.Entities.SolicitacaoBeneficio>();

                var xml = this.CarregarMensagem <Pollux.MSG0147>(mensagem);
                //BeneficioCanal
                if (!String.IsNullOrEmpty(xml.CodigoBeneficioCanal) && xml.CodigoBeneficioCanal.Length == 36)
                {
                    beneficioCanalConsulta = new Servicos.BeneficioDoCanalService(this.Organizacao, this.IsOffline).ObterPor(new Guid(xml.CodigoBeneficioCanal));
                    if (beneficioCanalConsulta == null)
                    {
                        resultadoPersistencia.Sucesso  = false;
                        resultadoPersistencia.Mensagem = "Valor do parâmetro " + xml.CodigoBeneficioCanal + " não existe.";
                        retorno.Add("Resultado", resultadoPersistencia);
                        return(CriarMensagemRetorno <Pollux.MSG0147R1>(numeroMensagem, retorno));
                    }
                }
                else
                {
                    resultadoPersistencia.Sucesso  = false;
                    resultadoPersistencia.Mensagem = "Parâmetro obrigatório para a consulta não enviado.";
                    retorno.Add("Resultado", resultadoPersistencia);
                    return(CriarMensagemRetorno <Pollux.MSG0147R1>(numeroMensagem, retorno));
                }
                //Solicitacao Beneficios

                List <SolicitacaoBeneficio> lstSolicitacaoBeneficioCrm = new List <SolicitacaoBeneficio>();
                if (xml.SolicitacaoAjuste.HasValue)
                {
                    lstSolicitacaoBeneficioCrm = new Servicos.SolicitacaoBeneficioService(this.Organizacao, this.IsOffline).ListarPorBeneficioCanalEAjusteSaldo(beneficioCanalConsulta.ID.Value, xml.SolicitacaoAjuste.Value);
                }
                else
                {
                    lstSolicitacaoBeneficioCrm = new Servicos.SolicitacaoBeneficioService(this.Organizacao, this.IsOffline).ListarPorBeneficioCanal(beneficioCanalConsulta.ID.Value);
                }

                if (lstSolicitacaoBeneficioCrm != null && lstSolicitacaoBeneficioCrm.Count > 0)
                {
                    var listaOrdenada = lstSolicitacaoBeneficioCrm.OrderByDescending(t => t.DataCriacao).ToList();
                    lstRetorno = this.DefinirRetorno(listaOrdenada);
                }
                else
                {
                    resultadoPersistencia.Sucesso  = true;
                    resultadoPersistencia.Mensagem = "Não foram encontrados registros que satisfaçam os critérios de pesquisa.";
                    retorno.Add("Resultado", resultadoPersistencia);
                    return(CriarMensagemRetorno <Pollux.MSG0147R1>(numeroMensagem, retorno));
                }
                if (lstRetorno != null && lstRetorno.Count > 0)
                {
                    resultadoPersistencia.Sucesso  = true;
                    resultadoPersistencia.Mensagem = "Integração ocorrida com sucesso!";
                    retorno.Add("SolicitacaoBeneficioItens", lstRetorno);
                    retorno.Add("Resultado", resultadoPersistencia);
                }
                else
                {
                    resultadoPersistencia.Sucesso  = true;
                    resultadoPersistencia.Mensagem = "Não foram encontrados registros que satisfaçam os critérios de pesquisa.";
                    retorno.Add("Resultado", resultadoPersistencia);
                }
                return(CriarMensagemRetorno <Pollux.MSG0147R1>(numeroMensagem, retorno));
            }
            catch (Exception e)
            {
                resultadoPersistencia.Sucesso  = false;
                resultadoPersistencia.Mensagem = SDKore.Helper.Error.Handler(e);
                retorno.Add("Resultado", resultadoPersistencia);
                return(CriarMensagemRetorno <Pollux.MSG0147R1>(numeroMensagem, retorno));
            }
        }