private void callback()
        {
            TraceService("Timer Started");

            CrawlAllMarkets crawl     = new CrawlAllMarkets();
            CrawlFirstPage  crawlpage = new CrawlFirstPage();
            ////CrawlEachMarket crawlmarket = new CrawlEachMarket();
            //string msg = crawlpage.DeleteFirstPageRecords();
            string msg1 = "", msg2 = "", msg3 = "";

            try
            {
                msg1 = DateTime.Now + ":" + crawlpage.CrawlEachSport();
            }
            catch (Exception ex)
            {
            }
            finally { TraceService("Reply from CrawlEachSport at " + msg1 + "\n"); }

            try
            {
                msg2 = DateTime.Now + ":" + crawl.CrawlBettingLinks();
            }
            catch (Exception ex) { }
            finally { TraceService("Reply from CrawlEachSport at " + msg2 + "\n"); }
            try
            {
                msg3 = DateTime.Now + ":" + crawlpage.CrawlAllGolf();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                TraceService(" Reply from CrawlEachMatchResult at " + msg3 + "\n");
            }
            try
            {
                msg3 = DateTime.Now + ":" + crawlpage.CrawlEachMatchResult();
            }
            catch (Exception ex)
            {
            }
            finally
            {
                TraceService(" Reply from CrawlEachMatchResult at " + msg3 + "\n");
            }
        }
Example #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;
            //   }
        }