Ejemplo n.º 1
0
        private void UpdateMarketThread()
        {
            try
            {
                UpdatePrice priced_market = ActiveMdiChild as UpdatePrice;

                string bookies = SelectedBookies();

                foreach (string market in updatemarkets)
                {
                    string[] info1 = market.Split(',');
                    if (info1.Length > 1)
                    {
                        Task.Factory.StartNew(() =>
                        {
                            priced_market.FillData(info1[2], Convert.ToInt64(info1[0]), Convert.ToInt64(info1[1]), updatemarkets.Count, info1[3]);
                        }, TaskCreationOptions.LongRunning);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        private void toolStripMenuItem2_Click(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(SelectedBookies()))
                {
                    if (ActiveMdiChild is OddsCrawler)
                    {
                        if (IsProcessRunning)
                        {
                            MessageBox.Show("A process is already running");
                            return;
                        }

                        OddsCrawler crawl = ActiveMdiChild as OddsCrawler;

                        markets = crawl.SelectedMarkets();

                        if (markets.Count > 0)
                        {
                            crawl.ClearFlowLayoutPanel();
                            SetProgress(true);
                            IsProcessRunning  = true;
                            crawl.countthread = 0;
                            string[] sportid = markets[0].Split(',');
                            if (sportid.Length > 1)
                            {
                                crawl.SetLabelSportIdText(sportid[3]);
                            }
                            //string bookies = SelectedBookies();
                            //foreach (string market in markets)
                            //{
                            //string[] info = market.Split(',');

                            //Task taskB = Task.Factory.StartNew(() =>
                            //{
                            //     crawl.FillData(info[2], Convert.ToInt64(info[0]), Convert.ToInt64(info[1]), bookies, markets.Count);
                            Thread thread = new Thread(MyThread);
                            thread.Start();
                            //});
                        }

                        //}
                    }

                    else
                    if (ActiveMdiChild is AddMarket)
                    {
                        if (IsProcessRunning)
                        {
                            MessageBox.Show("A process is already running");
                            return;
                        }

                        AddMarket crawl1 = ActiveMdiChild as AddMarket;
                        addmarkets = crawl1.SelectedMarkets();
                        if (addmarkets.Count > 0)
                        {
                            //List<string> markets = crawl.SelectedMarkets();
                            crawl1.ClearFlowLayoutPanel();
                            SetProgress(true);
                            IsCouponProcessRunning = true;
                            crawl1.countthread     = 0;

                            Thread thread = new Thread(AddMarketThread);
                            thread.Start();
                        }
                    }

                    else
                    if (ActiveMdiChild is Coupons)
                    {
                        if (IsCouponProcessRunning)
                        {
                            MessageBox.Show("A process is already running");
                            return;
                        }
                        Coupons coupon = ActiveMdiChild as Coupons;
                        if (coupon.SelectedMarkets().Count > 0)
                        {
                            List <string> markets = coupon.SelectedMarkets();
                            coupon.ClearFlowLayoutPanel();
                            SetProgress(true);
                            IsCouponProcessRunning = true;
                            coupon.countthread     = 0;
                            Task taskB = Task.Factory.StartNew(() =>
                            {
                                foreach (string market in markets)
                                {
                                    string[] info = market.Split(',');
                                    coupon.FillData(info[2], Convert.ToInt64(info[0]), Convert.ToInt64(info[1]), info[3], markets.Count);
                                }
                            });
                        }
                        else
                        {
                            MessageBox.Show("Please select a coupon");
                        }
                    }

                    else
                    if (ActiveMdiChild is UpdatePrice)
                    {
                        if (IsCouponProcessRunning)
                        {
                            MessageBox.Show("A process is already running");
                            return;
                        }

                        UpdatePrice update = ActiveMdiChild as UpdatePrice;
                        updatemarkets = update.SelectedMarkets();
                        if (updatemarkets.Count > 0)
                        {
                            //List<string> markets = crawl.SelectedMarkets();
                            update.ClearFlowLayoutPanel();
                            SetProgress(true);
                            IsCouponProcessRunning = true;
                            update.countthread     = 0;

                            Thread thread = new Thread(UpdateMarketThread);
                            thread.Start();
                            //foreach (string market in markets)
                            //{
                            //    string[] info = market.Split(',');

                            //    Task taskB = Task.Factory.StartNew(() =>
                            //    {
                            //        crawl.FillData(info[2], Convert.ToInt64(info[0]), Convert.ToInt64(info[1]), SelectedBookies(), markets.Count);
                            //    });


                            //}
                        }
                    }

                    else
                    {
                        MessageBox.Show("Please select atleast one market");
                    }
                }
                else
                {
                    MessageBox.Show("Please select atleast one bookie from Select Bookies menu");
                }
            }
            catch (Exception ex)
            {
                IsProcessRunning = false;
                SetProgress(false);
                IsCouponProcessRunning = false;
            }
        }
Ejemplo n.º 3
0
        private void btnupdate_Click(object sender, EventArgs e)
        {
            if (flowLayoutPanel1.Controls.Count > 0)
            {
                //List<string> markets = new List<string>();
                //foreach (Control ctrl in flowLayoutPanel1.Controls)
                //{
                    
                //    if (ctrl.GetType().Equals(typeof(DataGridView)))
                //    {
                //        markets.Add(ctrl.Name);
                //    }
                //}

                Form childForm = new UpdatePrice(lblmatchnotset.Name,Convert.ToInt64(txtmatchdate.Name));
                childForm.MdiParent = this.MdiParent;
                //childForm.Text = "Window " + childFormNumber++;
                childForm.Show();
            }
            else
            {
                MessageBox.Show("Match not found!");
            }


        }