Ejemplo n.º 1
0
        private void OnElapsedTime(object source, ElapsedEventArgs e)
        {
            string          html      = Helper.GetWebSiteContent("http://www.oddschecker.com/gaelic-games/gaelic-football/"); //(ConfigurationSettings.AppSettings["URL"]);
            CrawlAllMarkets crawl     = new CrawlAllMarkets();
            CrawlFirstPage  crawlpage = new CrawlFirstPage();
            ////CrawlEachMarket crawlmarket = new CrawlEachMarket();
            string msg  = crawlpage.DeleteFirstPageRecords();
            string msg1 = crawlpage.CrawlMyPage(html);
            string msg2 = crawl.CrawlBettingLinks();
            //TraceService("Reply from DeleteFirstPageRecords at " + DateTime.Now + ":" + msg + "\n Reply from CrawlMyPage at " + DateTime.Now + ":" + msg1 + "\n Reply from CrawlBettingLinks at " + DateTime.Now + ":" + msg2 + "\n");
            //string html = Helper.GetWebSiteContent(ConfigurationSettings.AppSettings["URL"]);
            //CrawlAllMarkets crawl = new CrawlAllMarkets();
            //CrawlFirstPage crawlpage = new CrawlFirstPage();
            //CrawlEachMarket crawlmarket = new CrawlEachMarket();

            //crawlpage.CrawlMyPage(html);
            //crawl.CrawlBettingLinks();
            //crawlmarket.CrawlMarketLinks();
        }
Ejemplo n.º 2
0
        private void crawlerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Start Crawling.
            //  time = new System.Threading.Timer(startcrawling());
            //BackCrawler.GetCrawler d = new GetCrawler();
            //d.startCrawling();

            //      foreach (ToolStripMenuItem item in startCrawlingToolStripMenuItem.DropDown.Items)
            //   {
            // item.Text = (sender as ToolStripMenuItem).Text;
            if (IsCrawlProcessRunning == true)
            {
                SetProgress(false);
                IsCrawlProcessRunning = false;
            }
            SetProgress(true);
            IsCrawlProcessRunning = true;
            CrawlFirstPage crawldata = new CrawlFirstPage();

            if ((sender as ToolStripMenuItem).Text == "League")
            {
                DataTable dt      = crawldata.GetSports("2");
                string    link    = dt.Rows[0]["link"].ToString();
                int       sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                if (sportid == 2)
                {
                    crawldata.CrawlLeagues(link);
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "WorldMarket")
            {
                DataTable dt      = crawldata.GetSports("2");
                string    link    = dt.Rows[0]["link"].ToString();
                int       sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                if (sportid == 2)
                {
                    crawldata.CrawlWorldMarkets();
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "Soccer")
            {
                DataTable dt      = crawldata.GetSports((sender as ToolStripMenuItem).Name.ToString());
                string    link    = dt.Rows[0]["link"].ToString();
                int       sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                // soocer
                //   crawldata.CrawlLeagues(link);
                //   crawldata.CrawlWorldMarkets();
                DataSet ds = crawldata.GetLeague();
                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    string           matchlink = Convert.ToString(ds.Tables[0].Rows[j]["link"]);
                    int              sport_id  = Convert.ToInt32(ds.Tables[0].Rows[j]["sportid"]);
                    long             leagueid  = Convert.ToInt32(ds.Tables[0].Rows[j]["leagueid"]);
                    ThreadParameters t         = new ThreadParameters();
                    t.URL      = matchlink;
                    t.SportID  = sport_id;
                    t.LeagueID = leagueid;
                    crawldata.CrawlMyPage(t);
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "GaaFootball")
            {
                DataTable dt      = crawldata.GetSports((sender as ToolStripMenuItem).Name.ToString());
                string    link    = dt.Rows[0]["link"].ToString();
                int       sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                // GAA Football
                ThreadParameters tp = new ThreadParameters();
                tp.URL     = link;
                tp.SportID = sportid;
                if (sportid == 12)
                {
                    crawldata.CrawlMyPage(tp);
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "GaaHurling")
            {
                DataTable        dt      = crawldata.GetSports((sender as ToolStripMenuItem).Name.ToString());
                string           link    = dt.Rows[0]["link"].ToString();
                int              sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                ThreadParameters tp      = new ThreadParameters();
                tp.URL     = link;
                tp.SportID = sportid;
                // GAA Hurling.
                if (sportid == 28)
                {
                    crawldata.CrawlMyPage(tp);
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "Golf")
            {
                DataTable dt      = crawldata.GetSports((sender as ToolStripMenuItem).Name.ToString());
                string    link    = dt.Rows[0]["link"].ToString();
                int       sportid = Convert.ToInt32(dt.Rows[0]["sportid"].ToString());
                // Golf
                if (sportid == 29)
                {
                    crawldata.CrawlGolfTurnament(link, sportid.ToString());
                }
            }
            else if ((sender as ToolStripMenuItem).Text == "GolfMarketName")
            {
                crawldata.CrawlGolfBettingMarketName();
            }
            else if ((sender as ToolStripMenuItem).Text == "GolfMarkets")
            {
                crawldata.CrawlGolfBettingMarket();
            }
            else if ((sender as ToolStripMenuItem).Text == "BettingMarket")
            {
                CrawlAllMarkets crawl = new CrawlAllMarkets();
                crawl.CrawlBettingLinks();
            }
            else if ((sender as ToolStripMenuItem).Text == "MarketResult")
            {
                crawldata.CrawlEachMatchResult();
            }
            //  Thread d = new Thread();
            SetProgress(false);
            IsCrawlProcessRunning = false;
            //   }
        }