private void ClearOldNews() { GetConfig gc = new GetConfig(); NewsOperator newsOpera = new NewsOperator(); int Period = Convert.ToInt32(gc.GetSysConfig()["Period"]); DateTime DeadLine = Convert.ToDateTime(DateTime.Now.AddDays(Period * -1).ToString("yyyy-MM-dd")); newsOpera.DeleteNews(DeadLine); }
private void GetCrawlerPartConfig(Guid CrawlerConfigId, string Address) { GetConfig gc = new GetConfig(); sc = new StrongCrawler(Semaphore); sc.OnError += (s, e) => { WriteLog.InsertLogs(e.Uri.ToString(), e.Exception.Message); }; sc.OnCompleted += (s, e) => { NewsOperator newsOpera = new NewsOperator(); newsOpera.InsertNews(e.News); }; List <CrawlerPartConfig> List_cpc = gc.GetCrawlerPartConfig(CrawlerConfigId); List <Target> Targets = new List <Target>(); foreach (CrawlerPartConfig cpc in List_cpc) { StartSync(cpc, Address, ref Targets); } FetchDataAsync(Targets); }