private void GetAuto() { //设置状态 btnAuto.Enabled = false; lblAuto.Text = "ئاپتۇماتىك ئۇچۇر يىغىۋاتىدۇ، سىستىمىنى تاقىماڭ ياكى مەجبۇرى چىكىندۈرمەڭ"; INewsBase newsAuto = null; int autoPage = 1; IGetBase dal = new ZuklanDAL(); //获取所有涞源 List <NewsSourceModel> sources = GetNewsSource(); //根据涞源获取所有所有类别 foreach (var source in sources) { //根据类别获取获取新闻集合 switch (source.Source) { case NewsSource.Nur: newsAuto = new NurNews(); break; case NewsSource.TS: newsAuto = new TSNews(); break; default: continue; } foreach (var typ in newsAuto.NewsTypes) { NextPage: List <NewsModel> newsList = newsAuto.GetNewsList(Convert.ToInt32(typ.CatID), autoPage); if (newsList == null || newsList.Count <= 0) { continue; } bool b = true; NewsModel mod; foreach (var newsItem in newsList) { //新闻集合中搜索没有记录的 if (newsItem.IsGetted) { b = false; autoPage = 1; break; } mod = newsAuto.GetNews(newsItem); if (mod == null) { continue; } //写入到数据库 if (dal.Insert(mod) > 0) { newsAuto.WriteGettedLog(mod); } } if (!b) { continue; } autoPage++; goto NextPage; } } btnAuto.Enabled = true; DateTime tim = DateTime.Now; TimeSpan tp = new TimeSpan(36000000000); tim = tim + tp; lblAuto.Text = "ئاپتۇماتىك ئۇچۇر يىغىشقا تەڭشىدىڭىز، كىيىنكى قېتىم ئاپتۇماتىك ئۇچۇر يىغىدىغان ۋاقىت\r\n" + tim.ToString("0000-00-00 00:00:00"); }
private void GetAuto() { //设置状态 btnAuto.Enabled = false; lblAuto.Text = "ئاپتۇماتىك ئۇچۇر يىغىۋاتىدۇ، سىستىمىنى تاقىماڭ ياكى مەجبۇرى چىكىندۈرمەڭ"; INewsBase newsAuto = null; int autoPage = 1; IGetBase dal = new ZuklanDAL(); //获取所有涞源 List<NewsSourceModel> sources = GetNewsSource(); //根据涞源获取所有所有类别 foreach (var source in sources) { //根据类别获取获取新闻集合 switch (source.Source) { case NewsSource.Nur: newsAuto = new NurNews(); break; case NewsSource.TS: newsAuto = new TSNews(); break; default: continue; } foreach (var typ in newsAuto.NewsTypes) { NextPage: List<NewsModel> newsList = newsAuto.GetNewsList(Convert.ToInt32(typ.CatID), autoPage); if (newsList == null || newsList.Count <= 0) continue; bool b = true; NewsModel mod; foreach (var newsItem in newsList) { //新闻集合中搜索没有记录的 if (newsItem.IsGetted) { b = false; autoPage = 1; break; } mod = newsAuto.GetNews(newsItem); if (mod == null) continue; //写入到数据库 if (dal.Insert(mod) > 0) { newsAuto.WriteGettedLog(mod); } } if (!b) continue; autoPage++; goto NextPage; } } btnAuto.Enabled = true; DateTime tim = DateTime.Now; TimeSpan tp = new TimeSpan(36000000000); tim = tim + tp; lblAuto.Text = "ئاپتۇماتىك ئۇچۇر يىغىشقا تەڭشىدىڭىز، كىيىنكى قېتىم ئاپتۇماتىك ئۇچۇر يىغىدىغان ۋاقىت\r\n" + tim.ToString("0000-00-00 00:00:00"); }