Example #1
0
 public void TestEnvioOcorrenciaASTEC()
 {
     var service = new Domain.Servicos.OcorrenciaService(this.OrganizationName, this.IsOffline);
     // new Guid("8C69D160-7F68-E711-80CB-0050568DED44")
     var ocorrenciaTest = (new Domain.Servicos.RepositoryService()).Ocorrencia.ObterPor("OCOR-918578-M2D7N1");
     var result         = service.IntegracaoBarramento(ocorrenciaTest);
 }
Example #2
0
        protected override void Execute(IPluginExecutionContext context, IOrganizationServiceFactory serviceFactory, IOrganizationService adminService, IOrganizationService userService)
        {
            Entity  entidade = new Entity();
            Feriado feriado  = new Feriado(context.OrganizationName, context.IsExecutingOffline);

            switch (Util.Utilitario.ConverterEnum <Domain.Enum.Plugin.MessageName>(context.MessageName))
            {
                #region Create

            case Domain.Enum.Plugin.MessageName.Create:
                entidade = (Entity)context.InputParameters["Target"];
                feriado  = entidade.Parse <Feriado>(context.OrganizationName, context.IsExecutingOffline);
                List <Ocorrencia> lstOcorrenciasCreate = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline).ListarOcorrenciasRecalculaSLA(feriado);

                (new Domain.Servicos.RepositoryService()).Ocorrencia.Update(lstOcorrenciasCreate);

                break;

                #endregion

                #region Update

            case Domain.Enum.Plugin.MessageName.Update:

                var feriadoUpdade = ((Entity)context.PostEntityImages["imagem"]).Parse <Feriado>(context.OrganizationName, context.IsExecutingOffline, adminService);

                List <Ocorrencia> lstOcorrenciasUpdate = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline).ListarOcorrenciasRecalculaSLA(feriadoUpdade);

                (new Domain.Servicos.RepositoryService()).Ocorrencia.Update(lstOcorrenciasUpdate);

                break;

                #endregion
            }
        }
Example #3
0
        public string Executar(string mensagem, string numeroMensagem, Domain.Model.Usuario usuario)
        {
            usuarioIntegracao = usuario;
            var xml = this.CarregarMensagem <Pollux.MSG0315>(mensagem);

            if (!resultadoPersistencia.Sucesso)
            {
                retorno.Add("Resultado", resultadoPersistencia);
                return(CriarMensagemRetorno <Pollux.MSG0315R1>(numeroMensagem, retorno));
            }

            List <Ocorrencia> lstOcorrencia = new Domain.Servicos.OcorrenciaService(this.Organizacao, this.IsOffline).ListarOcorrenciasPorNumeroSerie(xml.NumeroSerieProduto);

            if (lstOcorrencia == null || lstOcorrencia.Count == 0)
            {
                resultadoPersistencia.Sucesso  = true;
                resultadoPersistencia.Mensagem = "Ocorrência(s) não encontrada(s).";
                return(CriarMensagemRetorno <Pollux.MSG0315R1>(numeroMensagem, retorno));
            }

            resultadoPersistencia.Sucesso  = true;
            resultadoPersistencia.Mensagem = "Integração Ocorrida com sucesso.";
            retorno.Add("Ocorrencia", this.GerarListaOcorrencias(lstOcorrencia));
            retorno.Add("Resultado", resultadoPersistencia);

            return(CriarMensagemRetorno <Pollux.MSG0315R1>(numeroMensagem, retorno));
        }
Example #4
0
        public void TestCalculoSLAPorOcorrencia()
        {
            var service = new Domain.Servicos.OcorrenciaService(this.OrganizationName, this.IsOffline);
            // new Guid("8C69D160-7F68-E711-80CB-0050568DED44")
            var ocorrenciaTest = (new Domain.Servicos.RepositoryService()).Ocorrencia.ObterPor("OCOR-11603-R8F2L6");

            service.Ocorrencia = ocorrenciaTest;

            service.Atualizar();
        }
Example #5
0
        private Ocorrencia ConverterOcorrencia(XmlDocument xml, Domain.Model.Conta assistenciaTecnica, string LoginDoPostoAutorizado, out string mensagem)
        {
            mensagem = String.Empty;
            string cpfCnpj = string.Empty;

            if (string.IsNullOrEmpty(xml.GetElementsByTagName("CPFouCNPJ")[0].InnerText))
            {
                mensagem += " \nO número do CNPJ/CPF do cliente deve ser informado";
            }
            else if (!string.IsNullOrEmpty(xml.GetElementsByTagName("CPFouCNPJ")[0].InnerText))
            {
                cpfCnpj = xml.GetElementsByTagName("CPFouCNPJ")[0].InnerText;
                cpfCnpj = cpfCnpj.Replace("-", "").Replace("/", "").Replace(".", "");

                if (cpfCnpj.Length == 11)
                {
                    cpfCnpj = String.Format(@"{0:000\.000\.000\-00}", Convert.ToInt64(cpfCnpj));
                }
                else
                {
                    cpfCnpj = String.Format(@"{0:00\.000\.000\/0000\-00}", Convert.ToInt64(cpfCnpj));
                }
            }

            if (string.IsNullOrEmpty(xml.GetElementsByTagName("Codigo")[0].InnerText) || string.IsNullOrEmpty(xml.GetElementsByTagName("NumeroDeSerie")[0].InnerText))
            {
                mensagem += " \nO número de série e o código do produto devem ser informados";
            }

            if (string.IsNullOrEmpty(xml.GetElementsByTagName("NumeroNF")[0].InnerText))
            {
                mensagem += " \nO número da nota fiscal deve ser informado";
            }

            Ocorrencia ocorrencia = new Ocorrencia(nomeOrganizacao, false)
            {
                Nome                   = "Assistência Técnica",
                Rascunho               = true,
                Origem                 = 200006 /*OS Integrada*/,
                TipoDeOcorrencia       = (int)TipoDeOcorrencia.Ordem_de_Serviço,
                RazaoStatus            = (int)StatusDaOcorrencia.Aguardando_Analise,
                SolicitantePortal      = LoginDoPostoAutorizado,
                PrioridadeValue        = (int)TipoDePrioridade.Alta,
                DataDeAberturaDigitada = DateTime.Now,
                ProdutosDoCliente      = xml.GetElementsByTagName("NumeroDeSerie")[0].InnerText,
                AparenciaDoProduto     = xml.GetElementsByTagName("AparenciaDoProduto")[0].InnerText,
                AcessoriosOpcionais    = xml.GetElementsByTagName("AcessoriosOpcionais")[0].InnerText,
                RetiradoPorNome        = xml.GetElementsByTagName("RetiradoPorNome")[0].InnerText,
                RetiradoPorCPF         = xml.GetElementsByTagName("RetiradoPorCPF")[0].InnerText,
                AcaoId                 = new Lookup(new Guid(SDKore.Configuration.ConfigurationManager.GetSettingValue("guid_acao_portal_astec")), "new_acao"),
                AssuntoId              = new Lookup(new Guid(SDKore.Configuration.ConfigurationManager.GetSettingValue("guid_assunto_portal_astec")), "subject"),
                ClienteOS              = new Domain.Model.Contato(nomeOrganizacao, false)
                {
                    Nome                 = xml.GetElementsByTagName("NomeCliente")[0].InnerText,
                    NomeCompleto         = xml.GetElementsByTagName("NomeCliente")[0].InnerText,
                    PrimeiroNome         = (xml.GetElementsByTagName("NomeCliente")[0].InnerText.Contains(" ") ? xml.GetElementsByTagName("NomeCliente")[0].InnerText.Substring(0, xml.GetElementsByTagName("NomeCliente")[0].InnerText.IndexOf(" ")) : xml.GetElementsByTagName("NomeCliente")[0].InnerText),
                    Sobrenome            = (xml.GetElementsByTagName("NomeCliente")[0].InnerText.Contains(" ") ? xml.GetElementsByTagName("NomeCliente")[0].InnerText.Substring(xml.GetElementsByTagName("NomeCliente")[0].InnerText.IndexOf(" ") + 1, xml.GetElementsByTagName("NomeCliente")[0].InnerText.Length - xml.GetElementsByTagName("NomeCliente")[0].InnerText.IndexOf(" ") - 1) : xml.GetElementsByTagName("NomeCliente")[0].InnerText),
                    CpfCnpj              = cpfCnpj,
                    Email1               = xml.GetElementsByTagName("EmailCliente")[0].InnerText,
                    Endereco1Rua         = xml.GetElementsByTagName("Logradouro")[0].InnerText,
                    Endereco1Numero      = xml.GetElementsByTagName("Numero")[0].InnerText,
                    Endereco1Complemento = xml.GetElementsByTagName("Complemento")[0].InnerText,
                    Endereco1Bairro      = xml.GetElementsByTagName("Bairro")[0].InnerText,
                    Endereco1Municipio   = xml.GetElementsByTagName("Cidade")[0].InnerText,
                    Endereco1CEP         = xml.GetElementsByTagName("Cep")[0].InnerText,
                    Endereco1Estado      = xml.GetElementsByTagName("Uf")[0].InnerText,
                    TelefoneComercial    = xml.GetElementsByTagName("TelefonePrincipalCliente")[0].InnerText
                }
            };
            Municipio cidade = new Domain.Servicos.RepositoryService().Municipio.ObterPor(xml.GetElementsByTagName("Uf")[0].InnerText, xml.GetElementsByTagName("Cidade")[0].InnerText);

            if (cidade != null)
            {
                ocorrencia.ClienteOS.Endereco1Municipioid = new Lookup(cidade.Id, "itbc_municipios");
                if (cidade.Estadoid != null)
                {
                    ocorrencia.ClienteOS.Endereco1Estadoid = cidade.Estadoid;
                }
            }

            #region Autorizada

            ocorrencia.Autorizada               = assistenciaTecnica;
            ocorrencia.Autorizada.Nome          = LoginDoPostoAutorizado;
            ocorrencia.Autorizada.NomeAbreviado = LoginDoPostoAutorizado;
            ocorrencia.AutorizadaId             = new Lookup(assistenciaTecnica.Id, "account");

            #endregion

            if (xml.GetElementsByTagName("Observacoes")[0].InnerText.Length < 4000)
            {
                ocorrencia.DescricaoDaMensagemDeIntegracao = xml.GetElementsByTagName("Observacoes")[0].InnerText;
            }
            else
            {
                mensagem += " \nNão foi possível converter Observacoes, o campo deve conter menos de 4000 caracteres";
            }

            if (xml.GetElementsByTagName("DefeitoAlegado")[0].InnerText.Length < 4000)
            {
                ocorrencia.DefeitoAlegado = xml.GetElementsByTagName("DefeitoAlegado")[0].InnerText;
            }
            else
            {
                mensagem += " \nNão foi possível converter DefeitoAlegado, o campo deve conter menos de 4000 caracteres";
            }

            if (xml.GetElementsByTagName("OSEmLote")[0].InnerText == "OK")
            {
                ocorrencia.Tipo = "Lote";
            }

            if (!string.IsNullOrEmpty(xml.GetElementsByTagName("DataDeAberturaInformada")[0].InnerText))
            {
                try { ocorrencia.DataOrigem = Convert.ToDateTime(xml.GetElementsByTagName("DataDeAberturaInformada")[0].InnerText); }
                catch { mensagem += " \nErro ao tentar converter DataDeAberturaInformada para data"; }
            }
            else
            {
                ocorrencia.DataOrigem = DateTime.Now;
            }

            if (!string.IsNullOrEmpty(xml.GetElementsByTagName("DataDeConsertoInformada")[0].InnerText))
            {
                try { ocorrencia.DataDeConsertoDigitada = Convert.ToDateTime(xml.GetElementsByTagName("DataDeConsertoInformada")[0].InnerText); }
                catch { mensagem += " \nErro ao tentar converter DataDeConsertoInformada para data"; }
                ocorrencia.DataDeConsertoInformada = DateTime.Now;
            }

            if (!string.IsNullOrEmpty(xml.GetElementsByTagName("DataDeEntregaClienteInformada")[0].InnerText))
            {
                try { ocorrencia.DataDeEntregaClienteInformada = Convert.ToDateTime(xml.GetElementsByTagName("DataDeEntregaClienteInformada")[0].InnerText); }
                catch { mensagem += " \nErro ao tentar converter DataDeEntregaClienteInformada para data"; }
                ocorrencia.DataDeEntregaClienteDigitada = DateTime.Now;
            }

            #region Nota Fiscal
            ocorrencia.NotaFiscalFatura = new Domain.Model.Fatura(nomeOrganizacao, false)
            {
                IDFatura = xml.GetElementsByTagName("NumeroNF")[0].InnerText,
                Cliente  = new Domain.Model.Conta(nomeOrganizacao, false)
                {
                    Nome          = xml.GetElementsByTagName("RazaoSocial")[0].InnerText,
                    CpfCnpj       = xml.GetElementsByTagName("Cnpj")[0].InnerText,
                    Telefone      = xml.GetElementsByTagName("TelefonePrincipal")[0].InnerText,
                    NomeAbreviado = (xml.GetElementsByTagName("NomeClienteNF")[0].InnerText != "") ? xml.GetElementsByTagName("NomeClienteNF")[0].InnerText : xml.GetElementsByTagName("NomeCliente")[0].InnerText
                                    //CpfCnpj = (!String.IsNullOrEmpty(xml.GetElementsByTagName("CPFCNPJClienteNF")[0].InnerText)) ? xml.GetElementsByTagName("CPFCNPJClienteNF")[0].InnerText : xml.GetElementsByTagName("CPFouCNPJ")[0].InnerText
                }
            };
            ocorrencia.NumeroNfConsumido                   = xml.GetElementsByTagName("NumeroNF")[0].InnerText;
            ocorrencia.NomeDaLojaDoAtendimento             = xml.GetElementsByTagName("RazaoSocial")[0].InnerText;
            ocorrencia.NomeConstadoNaNotaFiscalDeCompra    = (xml.GetElementsByTagName("NomeClienteNF")[0].InnerText != "") ? xml.GetElementsByTagName("NomeClienteNF")[0].InnerText : xml.GetElementsByTagName("NomeCliente")[0].InnerText;
            ocorrencia.CpfCnpjConstadoNaNotaFiscalDeCompra = (!String.IsNullOrEmpty(xml.GetElementsByTagName("CPFCNPJClienteNF")[0].InnerText)) ? xml.GetElementsByTagName("CPFCNPJClienteNF")[0].InnerText : xml.GetElementsByTagName("CPFouCNPJ")[0].InnerText;
            ocorrencia.CnpjDaLojaDoAtendimento             = xml.GetElementsByTagName("Cnpj")[0].InnerText;
            ocorrencia.TelefoneDaLojaDoAtendimento         = xml.GetElementsByTagName("TelefonePrincipal")[0].InnerText;

            if (!String.IsNullOrEmpty(xml.GetElementsByTagName("DataDeCompra")[0].InnerText))
            {
                try
                {
                    ocorrencia.NotaFiscalFatura.DataEmissao   = Convert.ToDateTime(xml.GetElementsByTagName("DataDeCompra")[0].InnerText);
                    ocorrencia.DataConstadoNotaFiscalDeCompra = Convert.ToDateTime(xml.GetElementsByTagName("DataDeCompra")[0].InnerText);
                }
                catch { mensagem += " \nErro ao tentar converter DataDeCompra para data"; }
            }
            #endregion

            #region Produto Principal

            string         numeroSerie   = xml.GetElementsByTagName("NumeroDeSerie")[0].InnerText;
            string         codigoProduto = xml.GetElementsByTagName("Codigo")[0].InnerText;
            List <Product> produtos      = (new Domain.Servicos.RepositoryService()).Produto.BuscarEstruturaDoProdutoPor(numeroSerie, codigoProduto);

            if (produtos.Count > 0)
            {
                ocorrencia.Produto = produtos[0];

                Product produtoCRM = (new Domain.Servicos.RepositoryService()).Produto.ObterPorNumero(ocorrencia.Produto.Codigo);
                if (produtoCRM == null)
                {
                    throw new ArgumentException("Produto não foi encontrado para Número de Série ou Código informado. (CRM)");
                }

                ocorrencia.Produto.Id = produtoCRM.Id;
                ocorrencia.ProdutoId  = new Lookup(produtoCRM.Id, "product");

                OcorrenciaService ocorrenciaService = new Domain.Servicos.OcorrenciaService(nomeOrganizacao, false);
                ocorrenciaService.Ocorrencia = ocorrencia;
                ocorrenciaService.ValidaAberturaOcorrenciaASTEC();

                bool UrlImagemNota = string.IsNullOrEmpty(xml.GetElementsByTagName("URLImagemNota")[0].InnerText);

                LinhaComercial linhaComercial = (new Domain.Servicos.RepositoryService()).LinhaComercial.ObterPor(ocorrencia.Produto);

                if (linhaComercial != null)
                {
                    if (UrlImagemNota && linhaComercial.ObrigatorioEnviarNotaFiscal.HasValue && linhaComercial.ObrigatorioEnviarNotaFiscal.Value && !ocorrencia.Tipo.Equals("Lote"))
                    {
                        mensagem += " \nObrigatório o envio do anexo da Nota Fiscal";
                    }
                }

                ocorrencia.DataFabricacaoProduto = ocorrencia.Produto.DataFabricacaoProduto;
            }
            else
            {
                mensagem += " \nProduto não foi encontrado para Numero de Serie ou Codigo informado";
            }

            #endregion

            return(ocorrencia);
        }
Example #6
0
        public void Execute(IServiceProvider serviceProvider)
        {
            var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

            IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(null);
            var             repositoryService          = new Domain.Servicos.RepositoryService(context.OrganizationName, context.IsExecutingOffline);
            ITracingService trace = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

            try
            {
                Entity entidade = new Entity();
                Domain.Model.Anotacao anotacao = new Domain.Model.Anotacao(context.OrganizationName, context.IsExecutingOffline);

                if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
                {
                    switch (Util.Utilitario.ConverterEnum <Domain.Enum.Plugin.MessageName>(context.MessageName))
                    {
                    case Domain.Enum.Plugin.MessageName.Create:
                        entidade = (Entity)context.InputParameters["Target"];
                        anotacao = entidade.Parse <Domain.Model.Anotacao>(context.OrganizationName, context.IsExecutingOffline);

                        try
                        {
                            Guid guidLead   = new Guid(anotacao.EntidadeRelacionada.Id.ToString());
                            var  ocorrencia = repositoryService.Ocorrencia.Retrieve(guidLead);
                            if (ocorrencia != null)
                            {
                                if (ocorrencia.IntegraAstec == (int)IntegrarASTEC.Sim)
                                {
                                    string lstResposta = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline, service).IntegracaoBarramento(ocorrencia);
                                }
                            }

                            var cliente = repositoryService.ClientePotencial.Retrieve(guidLead);
                            if (cliente != null)
                            {
                                repositoryService.ClientePotencial.Update(cliente);
                            }
                            else
                            {
                                var oportunidade = repositoryService.Oportunidade.Retrieve(guidLead);
                                if (oportunidade != null)
                                {
                                    repositoryService.Oportunidade.Update(oportunidade);
                                }
                            }
                        }
                        catch (System.Exception e)
                        {
                        }

                        break;

                    case Domain.Enum.Plugin.MessageName.Update:

                        if (context.PostEntityImages.Contains("imagem") && context.PostEntityImages["imagem"] is Entity)
                        {
                            entidade = (Entity)context.PostEntityImages["imagem"];
                            anotacao = entidade.Parse <Domain.Model.Anotacao>(context.OrganizationName, context.IsExecutingOffline);

                            try
                            {
                                Guid guidLead   = new Guid(anotacao.EntidadeRelacionada.Id.ToString());
                                var  ocorrencia = repositoryService.Ocorrencia.Retrieve(guidLead);
                                if (ocorrencia != null)
                                {
                                    if (ocorrencia.IntegraAstec == (int)IntegrarASTEC.Sim)
                                    {
                                        string lstResposta = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline, service).IntegracaoBarramento(ocorrencia);
                                    }
                                }

                                var cliente = repositoryService.ClientePotencial.Retrieve(guidLead);
                                if (cliente != null)
                                {
                                    repositoryService.ClientePotencial.Update(cliente);
                                }
                                else
                                {
                                    var oportunidade = repositoryService.Oportunidade.Retrieve(guidLead);
                                    if (oportunidade != null)
                                    {
                                        repositoryService.Oportunidade.Update(oportunidade);
                                    }
                                }
                            }
                            catch (System.Exception e)
                            {
                            }
                        }
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                trace.Trace(String.Format("EXCEPTION PLUGIN {0} {1} [{2}]", context.MessageName.ToLower(), @"Postagem", DateTime.Now));
                trace.Trace(SDKore.Helper.Error.GetMessageError(ex));
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }
Example #7
0
        protected override void Execute(IPluginExecutionContext context, IOrganizationServiceFactory serviceFactory, IOrganizationService adminService, IOrganizationService userService)
        {
            IOrganizationService service = serviceFactory.CreateOrganizationService(null);

            try
            {
                switch (context.GetMessageName())
                {
                case PluginBase.MessageName.Create:

                    if (context.PostEntityImages.Contains("imagem") && context.PostEntityImages["imagem"] is Entity)
                    {
                        var        entidade   = context.PostEntityImages["imagem"];
                        Ocorrencia ocorrencia = entidade.Parse <Ocorrencia>(context.OrganizationName, context.IsExecutingOffline, adminService);

                        //Verifica se tem intervenção técnica
                        var        e = context.GetContextEntity();
                        Ocorrencia ocorrenciacreate = (new Domain.Servicos.RepositoryService(context.OrganizationName, false, service)).Ocorrencia.Retrieve(e.Id);
                        VerificaIntervencao(ocorrenciacreate, context, service);
                        VerificaDataDeIntalacao(ocorrenciacreate, context, service);

                        if (ocorrencia.IntegraAstec == (int)IntegrarASTEC.Sim)
                        {
                            string lstResposta = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline, service).IntegracaoBarramento(ocorrencia);
                        }

                        if (ocorrencia.RazaoStatus.Value != (int)StatusDaOcorrencia.Fechada)
                        {
                            return;
                        }
                        var ocorrenciaService = new OcorrenciaService(context.OrganizationName, context.IsExecutingOffline);
                        ocorrenciaService.Ocorrencia = ocorrencia;
                        Areas area = ocorrenciaService.IdentificarAreaDeAtendimento();
                        if (area == Areas.ISOL)
                        {
                            ocorrenciaService.AtualizarVigenciaContrato();
                        }
                    }



                    break;

                case PluginBase.MessageName.Update:
                    if (context.PostEntityImages.Contains("imagem") && context.PostEntityImages["imagem"] is Entity)
                    {
                        var        entidade   = context.PostEntityImages["imagem"];
                        Ocorrencia ocorrencia = entidade.Parse <Ocorrencia>(context.OrganizationName, context.IsExecutingOffline, adminService);

                        //Verifica se tem intervenção técnica
                        var        eupdate          = context.GetContextEntity();
                        Ocorrencia ocorrenciaupdate = (new Domain.Servicos.RepositoryService(context.OrganizationName, false, service)).Ocorrencia.Retrieve(eupdate.Id);
                        VerificaIntervencao(ocorrenciaupdate, context, service);
                        VerificaDataDeIntalacao(ocorrenciaupdate, context, service);

                        if (ocorrencia.IntegraAstec == (int)IntegrarASTEC.Sim)
                        {
                            string lstResposta = new Domain.Servicos.OcorrenciaService(context.OrganizationName, context.IsExecutingOffline, service).IntegracaoBarramento(ocorrencia);
                        }


                        Ocorrencia entidadePre = ((Entity)context.PreEntityImages["imagem"]).Parse <Ocorrencia>(context.OrganizationName, context.IsExecutingOffline, adminService);
                        if (ocorrencia.EmpresaExecutanteId == null && entidadePre.EmpresaExecutanteId != null)
                        {
                            ocorrencia.AtualizarOperacoesSuporte = true;
                            ocorrencia.Atualizar();
                        }

                        if (ocorrencia.RazaoStatus.Value != (int)StatusDaOcorrencia.Fechada)
                        {
                            return;
                        }
                        var ocorrenciaService = new OcorrenciaService(context.OrganizationName, context.IsExecutingOffline);
                        ocorrenciaService.Ocorrencia = ocorrencia;
                        Areas area = ocorrenciaService.IdentificarAreaDeAtendimento();
                        if (area == Areas.ISOL)
                        {
                            ocorrenciaService.AtualizarVigenciaContrato();
                        }
                    }

                    break;
                }
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }