Beispiel #1
0
        private static void SegmentarLicitacao(Licitacao licitacao)
        {
            List <Segmento> segmentos = SegmentoController.CreateListaSegmentos(licitacao);

            foreach (Segmento segmento in segmentos)
            {
                int matchCount    = 0;
                var palavrasChave = segmento.PalavrasChave.Split(';');

                foreach (var palavrachave in palavrasChave)
                {
                    if (licitacao.Objeto.ToUpper().Contains(palavrachave))
                    {
                        matchCount++;
                    }
                }

                if (matchCount >= 4)
                {
                    LicitacaoSegmento licSeg = new LicitacaoSegmento()
                    {
                        IdLicitacao = licitacao.Id,
                        IdSegmento  = segmento.IdSegmento
                    };

                    LicitacaoSegmentoRepository repoLS = new LicitacaoSegmentoRepository();
                    repoLS.Insert(licSeg);
                }
            }
        }
Beispiel #2
0
        internal static List <Segmento> CreateListaSegmentos(Licitacao licitacao)
        {
            List <Segmento> segmentos = new List <Segmento>();

            if (licitacao.Modalidade.Modalidades == "Leilão")
            {
                segmentos = SegmentoController.GetSegmentosLeilao();
            }
            else if (licitacao.Objeto.ToUpper().Contains("VETERINÁR") || licitacao.Objeto.ToUpper().Contains("VETERINAR"))
            {
                segmentos = SegmentoController.GetSegmentosVeterinaria();
            }
            else if (licitacao.Objeto.ToUpper().Contains("CONCESSÃO") ||
                     licitacao.Objeto.ToUpper().Contains("CONCESSAO") ||
                     licitacao.Objeto.ToUpper().Contains("OUTORGA") ||
                     licitacao.Objeto.ToUpper().Contains("PERMISSÃO DE USO") ||
                     licitacao.Objeto.ToUpper().Contains("PERMISSAO DE USO") ||
                     licitacao.Objeto.ToUpper().Contains("EXPLORAÇÃO") ||
                     licitacao.Objeto.ToUpper().Contains("EXPLORACAO"))
            {
                segmentos = SegmentoController.GetSegmentosConcessao();
            }
            else
            {
                segmentos = SegmentoController.GetSegmentosHumanos();
            }

            return(segmentos);
        }
        private static void SegmentarCotacao(Licitacao l)
        {
            List <Segmento> segmentos = SegmentoController.CreateListaSegmentos(l);

            foreach (Segmento segmento in segmentos)
            {
                int  objMatch = 0, segmentoCount = 0;
                bool itemMatch     = false;
                var  palavrasChave = segmento.PalavrasChave.Split(';');

                if (palavrasChave.Length > 0)
                {
                    foreach (var palavrachave in palavrasChave)
                    {
                        if (l.Objeto.ToUpper().Contains(palavrachave))
                        {
                            objMatch++;
                        }

                        foreach (var item in l.ItensLicitacao)
                        {
                            if (item.Descricao.ToUpper().Contains(palavrachave) || item.DescricaoDetalhada.ToUpper().Contains(palavrachave))
                            {
                                itemMatch = true;
                            }
                        }
                    }

                    if (objMatch >= 2 && itemMatch == true)
                    {
                        LicitacaoSegmento licSeg = new LicitacaoSegmento()
                        {
                            IdLicitacao = l.Id,
                            IdSegmento  = segmento.IdSegmento
                        };

                        segmentoCount++;
                        LicitacaoSegmentoRepository repoLS = new LicitacaoSegmentoRepository();
                        repoLS.Insert(licSeg);
                    }
                }

                if (segmentoCount > 0)
                {
                    RService.Log("(SegmentarLicitacao) " + Name + ": Licitação " + l.IdLicitacaoFonte + " foi segmentada em " + segmentoCount + " segmentos at {0}", Path.GetTempPath() + Name + ".txt");
                }
                else
                {
                    RService.Log("(SegmentarLicitacao) " + Name + ": Licitação " + l.IdLicitacaoFonte + " não foi segmentada at {0}", Path.GetTempPath() + Name + ".txt");
                }
            }
        }