示例#1
0
        protected override void Execute(IPluginExecutionContext context, IOrganizationServiceFactory serviceFactory, IOrganizationService adminService, IOrganizationService userService)
        {
            try
            {
                var e = context.GetContextEntity();

                Intelbras.CRM2013.Domain.Model.Beneficio mBeneficio = e.Parse <Intelbras.CRM2013.Domain.Model.Beneficio>(context.OrganizationName, context.IsExecutingOffline);
                BeneficioService ServiceSolicitacaoBeneficio        = new BeneficioService(context.OrganizationName, context.IsExecutingOffline, adminService);

                switch (EnumConverter <MessageName>(context.MessageName.ToLower()))
                {
                case MessageName.Update:
                {
                    switch ((Stage)context.Stage)
                    {
                    case Stage.PostOperation:
                        ServiceSolicitacaoBeneficio.AtivarOrDesativado(mBeneficio);
                        break;
                    }
                    break;
                }
                }
            }
            catch (Exception erro)
            {
                throw new InvalidPluginExecutionException(erro.Message);
            }
        }
示例#2
0
        public Pollux.MSG0166 DefinirPropriedadesPlugin(ParametroBeneficio objModel)
        {
            Pollux.MSG0166         retMsgProp     = new Pollux.MSG0166(Domain.Enum.Sistemas.RetornaSistema(Domain.Enum.Sistemas.Sistema.CRM), objModel.ID.ToString());
            BeneficioService       benefService   = new BeneficioService(this.Organizacao, this.IsOffline);
            UnidadeNegocioService  unidNegService = new UnidadeNegocioService(this.Organizacao, this.IsOffline);
            EstabelecimentoService estabService   = new EstabelecimentoService(this.Organizacao, this.IsOffline);

            retMsgProp.CodigoBeneficio          = objModel.Beneficio.Id.ToString();
            retMsgProp.CodigoParametroBeneficio = objModel.ID.ToString();

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

            retMsgProp.BeneficioCodigo = benefObj.Codigo;

            var unidNegObj = unidNegService.BuscaUnidadeNegocio(objModel.UnidadeNegocio.Id);

            retMsgProp.CodigoUnidadeNegocio = unidNegObj.ChaveIntegracao;

            var estabObj = estabService.BuscaEstabelecimento(objModel.Estabelecimento.Id);

            retMsgProp.CodigoEstabelecimento = estabObj.Codigo;

            retMsgProp.TipoFluxoFinanceiro       = objModel.TipoFluxoFinanceiro;
            retMsgProp.EspecieDocumento          = objModel.EspecieDocumento;
            retMsgProp.ContaContabil             = objModel.ContaContabil;
            retMsgProp.CentroCusto               = objModel.CentroCusto;
            retMsgProp.PercentualAtingimentoMeta = objModel.AtingimentoMetaPrevisto;
            retMsgProp.PercentualCusto           = objModel.Custo;
            retMsgProp.Situacao         = objModel.Status;
            retMsgProp.Proprietario     = "259A8E4F-15E9-E311-9420-00155D013D39";
            retMsgProp.TipoProprietario = "systemuser";

            return(retMsgProp);
        }
示例#3
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);
        }
        protected override void Execute(IPluginExecutionContext context, IOrganizationServiceFactory serviceFactory, IOrganizationService adminService, IOrganizationService userService)
        {
            if ((Stage)context.Stage != Stage.PostOperation)
            {
                return;
            }

            switch (EnumConverter <MessageName>(context.MessageName.ToLower()))
            {
            case MessageName.Update:
                if (context.PostEntityImages.Contains("imagem") &&
                    context.PostEntityImages["imagem"] is Entity &&
                    context.PreEntityImages.Contains("imagem") &&
                    context.PreEntityImages["imagem"] is Entity)
                {
                    Domain.Model.BeneficioDoCanal beneficioCanalPreImage  = ((Entity)context.PreEntityImages["imagem"]).Parse <Domain.Model.BeneficioDoCanal>(context.OrganizationName, context.IsExecutingOffline, userService);
                    Domain.Model.BeneficioDoCanal beneficioCanalPostImage = ((Entity)context.PostEntityImages["imagem"]).Parse <Domain.Model.BeneficioDoCanal>(context.OrganizationName, context.IsExecutingOffline, userService);

                    if (beneficioCanalPreImage.ContaObj.Classificacao.Name.Equals(Intelbras.CRM2013.Domain.Enum.Conta.Classificacao.Dist_VAD) ||
                        beneficioCanalPreImage.ContaObj.Classificacao.Name.Equals(Intelbras.CRM2013.Domain.Enum.Conta.Classificacao.Dist_BoxMover))
                    {
                        if (!beneficioCanalPreImage.StatusBeneficio.Id.Equals(beneficioCanalPostImage.StatusBeneficio.Id))
                        {
                            BeneficioService bservice = new BeneficioService(context.OrganizationName, context.IsExecutingOffline, userService);
                            var beneficios            = bservice.ObterPor(beneficioCanalPostImage.Beneficio.Id);

                            if (beneficios.PassivelDeSolicitacao.Equals(true))
                            {
                                Domain.Integracao.MSG0165 msgBenefCanal = new Domain.Integracao.MSG0165(context.OrganizationName, context.IsExecutingOffline);
                                msgBenefCanal.Enviar(beneficioCanalPostImage);
                            }
                        }
                    }
                }
                break;

            case MessageName.SetStateDynamicEntity:

                Domain.Model.BeneficioDoCanal beneficioCanalPostImage1 = ((Entity)context.PostEntityImages["imagem"]).Parse <Domain.Model.BeneficioDoCanal>(context.OrganizationName, context.IsExecutingOffline, userService);

                if (beneficioCanalPostImage1.ContaObj.Classificacao.Name.Equals(Intelbras.CRM2013.Domain.Enum.Conta.Classificacao.Dist_VAD) ||
                    beneficioCanalPostImage1.ContaObj.Classificacao.Name.Equals(Intelbras.CRM2013.Domain.Enum.Conta.Classificacao.Dist_BoxMover))
                {
                    BeneficioService bs = new BeneficioService(context.OrganizationName, context.IsExecutingOffline, userService);
                    var beneficio       = bs.ObterPor(beneficioCanalPostImage1.Beneficio.Id);

                    if (beneficio.PassivelDeSolicitacao.Equals(true))
                    {
                        Domain.Integracao.MSG0165 msgBenefCanal = new Domain.Integracao.MSG0165(context.OrganizationName, context.IsExecutingOffline);
                        msgBenefCanal.Enviar(beneficioCanalPostImage1);
                    }
                }

                break;
            }
        }
示例#5
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);
        }