private static void HandleCreate(HtmlDocument htmlDoc, HtmlNode row)
        {
            try
            {
                if (row.InnerHtml.Contains("href"))
                {
                    string       situacao;
                    string       quoteLink = row.ChildNodes[3].ChildNodes["a"].Attributes["href"].Value.ToString();
                    HtmlDocument htmlQuote = WebHandle.GetHtmlDocOfPage(string.Format(Constants.CN_COTACAO_LINK, quoteLink), Encoding.GetEncoding("ISO-8859-1"));
                    Licitacao    l         = CreateQuote(htmlQuote, quoteLink, out situacao);
                    //RandomSleep();
                    if (l != null && !repo.Exists(l.IdLicitacaoFonte.ToString()))
                    {
                        repo.Insert(l);
                        numCotacoes++;
                        RService.Log("Cotação " + l.IdLicitacaoFonte + " inserida com sucesso" + " at {0}", Path.GetTempPath() + Name + ".txt");

                        //SegmentarCotacao(l);
                    }
                    else if (l != null && repo.Exists(l.IdLicitacaoFonte.ToString()) && LicitacaoController.SituacaoAlterada(l.IdLicitacaoFonte.ToString(), situacao))
                    {
                        l          = repo.GetByIdLicitacaoFonte(l.IdLicitacaoFonte.ToString());
                        l.Situacao = situacao;

                        repo.Update(l);
                    }
                }
            }
            catch (Exception e)
            {
                RService.Log("Exception (HandleCreate) " + Name + ": " + e.Message + " / " + e.StackTrace + " / " + e.InnerException + " at {0}", Path.GetTempPath() + Name + ".txt");
            }
        }
Пример #2
0
        internal static Licitacao GetByIdLicitacaoFonte(string idLicitacaoFonte)
        {
            LicitacaoRepository repo = new LicitacaoRepository();

            return(repo.GetByIdLicitacaoFonte(idLicitacaoFonte));
        }