Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        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");
                }
            }
        }