public static objCompare convertStringToCompare(string input)
        {
            string[]   t = input.Split(',');
            objCompare o = new objCompare();

            o.home    = t[0];
            o.away    = t[1];
            o.bettype = t[2];
            o.hdp     = double.Parse(t[3]);
            o.odd     = t[4];
            o.keo     = t[5];
            o.betid   = t[6];
            o.profit  = double.Parse(t[7]);
            o.league  = double.Parse(t[8]);
            o.score   = t[9];
            o.time    = t[10];
            return(o);
        }
Beispiel #2
0
        private void btnCompareOddOldVersion_Click(object sender, EventArgs e)
        {
            btnCompareOddOldVersion.Enabled = false;
            if (radNonLive.Checked)
            {
                DataTable dtMinus = db.getMinus();
                foreach (DataRow dr in dtMinus.Rows)
                {
                    objCompare o           = UtilSoccer.convertStringToCompare(dr["data1"].ToString());
                    string     str_BetIbet = o.home + "," + o.away + "," + o.bettype + "," + o.hdp + "," + o.odd.Split('/')[1] + "," + o.keo.Split('/')[1] + "," + o.betid.Split('/')[1] + "," + o.score;
                    ticket     oIbet       = UtilSoccer.convertStringToTicket(str_BetIbet);
                    if (!hsIbetMinus.Contains(dr["keo"].ToString()))
                    {
                        hsIbetMinus.Add(dr["keo"].ToString(), oIbet);
                    }
                }

                Thread tNonLive = new Thread(delegate()
                {
                    string strCompareNonLiveTemp = "X";
                    int index               = 0;
                    int maxuser             = 10;
                    int minuser             = 0;
                    int count               = 0;
                    List <objMatch> lstIbet = new List <objMatch>();
                    List <objMatch> lstSbo  = new List <objMatch>();
                    int indexlogout         = -1;
                    int countLoop           = 0;
                    #region GetOdd
                    while (true)
                    {
                        countLoop++;
                        lblCountNonLive.Text = countLoop.ToString();
                        //Get Odd Ibet
                        try
                        {
                            lstIbet = BetManager.getBet("ibet" + index).getMatchOddNonLive(TimeLimit);
                        }
                        catch
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET NONLIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        if (lstIbet.Count == 0)
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET NONLIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        else if (lstIbet[0].Score == "Error")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Error" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }
                        else if (lstIbet[0].Score == "Logout")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Logout" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            indexlogout    = index;
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }
                        rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " ScanOdd" + "\n");

                        //Get Odd Sbo
                        lstSbo                       = BetManager.getBet("sbo0").getMatchOddNonLive(TimeLimit);
                        str_CompareNonLive           = UtilSoccer.CompareByHash(lstIbet, lstSbo, profitmin);
                        List <objCompare> lstCompare = UtilSoccer.convertCompareToList(str_CompareNonLive);
                        #region Minus
                        //if (lstIbet.Count > 0)
                        //{
                        //    if (lstCompare.Count > 0)
                        //    {
                        //        foreach (objCompare oCompare in lstCompare)
                        //        {
                        //            try
                        //            {
                        //                string str_BetSbo = oCompare.home + "," + oCompare.away + "," + oCompare.bettype + "," + oCompare.hdp + "," + oCompare.odd.Split('/')[0] + "," + oCompare.keo.Split('/')[0] + "," + oCompare.betid.Split('/')[0] + "," + oCompare.score;
                        //                string str_BetIbet = oCompare.home + "," + oCompare.away + "," + oCompare.bettype + "," + oCompare.hdp + "," + oCompare.odd.Split('/')[1] + "," + oCompare.keo.Split('/')[1] + "," + oCompare.betid.Split('/')[1] + "," + oCompare.score;

                        //                ticket oIbet = UtilSoccer.convertStringToTicket(str_BetIbet);
                        //                ticket oSbo = UtilSoccer.convertStringToTicket(str_BetSbo);

                        //                if (oIbet.odd < 0)
                        //                {
                        //                    string key = string.Format("{0},{1},{2},{3}", oCompare.home, oCompare.away, oCompare.hdp, oCompare.bettype);
                        //                    if (!hsIbetMinus.Contains(key))
                        //                    {
                        //                        hsIbetMinus.Add(key, oIbet);
                        //                        db.doInsertMinus(key, oCompare.ToString());
                        //                    }
                        //                }
                        //            }
                        //            catch
                        //            {

                        //            }
                        //        }
                        //    }

                        //    foreach (objMatch match in lstIbet)
                        //    {
                        //        try
                        //        {
                        //            string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                        //            if (hsIbetMinus.Contains(key))
                        //            {
                        //                if ((((ticket)hsIbetMinus[key]).choose == "h" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd2) >= -0.03) || (((ticket)hsIbetMinus[key]).choose == "a" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd1) >= -0.03))
                        //                {
                        //                    string Odd1 = match.Odd1;
                        //                    string Odd2 = match.Odd2;
                        //                    double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                        //                    string IdKeoIbet = match.IdKeo;
                        //                    string HomeName = match.HomeName;
                        //                    string AwayName = match.AwayName;
                        //                    string Keo = match.hdp;
                        //                    string BetType = match.BetType;
                        //                    string Score = match.Score;
                        //                    string Time = match.TimeLive;
                        //                    string home_away = "h/a";
                        //                    string result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + ",i\n";
                        //                    db.doUpdateMinus(key, result);
                        //                }
                        //                else
                        //                {
                        //                    db.doUpdateMinus(key, "");
                        //                }
                        //            }
                        //        }
                        //        catch
                        //        {

                        //        }
                        //    }

                        //    foreach (objMatch match in lstSbo)
                        //    {
                        //        try
                        //        {
                        //            string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                        //            if (hsIbetMinus.Contains(key))
                        //            {
                        //                if ((((ticket)hsIbetMinus[key]).choose == "h" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd2) >= -0.03) || (((ticket)hsIbetMinus[key]).choose == "a" && UtilSoccer.profit_odd(((ticket)hsIbetMinus[key]).odd.ToString(), match.Odd1) >= -0.03))
                        //                {
                        //                    string Odd1 = match.Odd1;
                        //                    string Odd2 = match.Odd2;
                        //                    double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                        //                    string IdKeoSbo = match.IdKeo;
                        //                    string HomeName = match.HomeName;
                        //                    string AwayName = match.AwayName;
                        //                    string Keo = match.hdp;
                        //                    string BetType = match.BetType;
                        //                    string Score = match.Score;
                        //                    string Time = match.TimeLive;
                        //                    string home_away = "h/a";
                        //                    string result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoSbo + "/" + IdKeoSbo + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + ",s\n";
                        //                    db.doUpdateMinus(key, result);
                        //                }
                        //            }
                        //        }
                        //        catch
                        //        {

                        //        }
                        //    }
                        //}
                        #endregion
                        if (str_CompareNonLive != strCompareNonLiveTemp)
                        {
                            db.UpdateInfoCompare("a,a", str_CompareNonLive, false);
                            string timecomparenonlive = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareNonLive.Text   = Title + "NONLIVE" + Title + "\n" + str_CompareNonLive + "\n" + timecomparenonlive;
                            strCompareNonLiveTemp     = str_CompareNonLive;
                        }
                        //Get Match Compare
                        rtb_CompareMatch.Clear();
                        rtb_CompareMatch.Text += BetManager.getBet("ibet" + index).getTotalMatch() + "\n";
                        rtb_CompareMatch.Text += BetManager.getBet("sbo0").getTotalMatch() + "\n";

                        string strSboCompareNonLive  = BetManager.getBet("sbo0").getMatchs();
                        string strIbetCompareNonLive = BetManager.getBet("ibet" + index).getMatchs();
                        string SboIbetCompareNonLive = Util.GetSplitStringIntoString(strSboCompareNonLive, strIbetCompareNonLive);
                        int MatchCompareNonIve       = SboIbetCompareNonLive.Split(',').Length - 1;
                        rtb_CompareMatch.Text       += "COMPARE MATCH: " + MatchCompareNonIve.ToString() + "\n";

                        int KeoCompareNonLive  = str_CompareNonLive.Split('\n').Length - 1;
                        rtb_CompareMatch.Text += "COMPARE NONLIVE: " + KeoCompareNonLive.ToString() + "\n";
                        //Change
                        count++;
                        if (count == 5)
                        {
                            index++;
                            count = 0;
                        }
                        if (index == maxuser)
                        {
                            index = minuser;
                            count = 0;
                        }
                        Thread.Sleep(100);
                    }
                    #endregion
                });
                tNonLive.Start();
            }
            else if (radLive.Checked)
            {
                Thread tLive = new Thread(delegate()
                {
                    string strCompareLiveTemp  = "X";
                    string strCompareUnderTemp = "X";
                    int index   = 10;
                    int maxuser = 30;
                    int minuser = 10;
                    int count   = 0;
                    List <objMatch> listIbetLive = new List <objMatch>();
                    List <objMatch> listSboLive  = new List <objMatch>();
                    int indexlogout = -1;
                    int countLoop   = 0;
                    #region GetOdd
                    while (true)
                    {
                        countLoop++;
                        lblCountLive.Text = countLoop.ToString();

                        //Get Odd Ibet
                        try
                        {
                            listIbetLive = BetManager.getBet("ibet" + index).getMatchOddLive();
                        }
                        catch
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET LIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        if (listIbetLive.Count == 0)
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "ibet" + index + ": IBET LIVE NOT FOUND \n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            continue;
                        }
                        else if (listIbetLive[0].Score == "Error")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Error" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }//Error

                        else if (listIbetLive[0].Score == "Logout")
                        {
                            rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " Logout" + "\n");
                            rtb_Login.Text = rtb_Login.Text.Insert(0, string.Format("{0} \n", "IBET" + index + ": " + BetManager.getBet("ibet" + index).getMessage()));
                            indexlogout    = index;
                            index++;
                            if (index == maxuser)
                            {
                                index = minuser;
                            }
                            count = 0;
                            continue;
                        }

                        rtb_Login.Text = rtb_Login.Text.Insert(0, DateTime.Now.ToLongTimeString() + " " + "IBET" + index + " ScanOdd" + "\n");

                        //Get Odd Sbo
                        listSboLive      = BetManager.getBet("sbo1").getMatchOddLive();
                        str_CompareLive  = UtilSoccer.CompareByHashLive(listIbetLive, listSboLive, profitmin);
                        str_CompareUnder = UtilSoccer.under_compare;
                        if (str_CompareLive != strCompareLiveTemp)
                        {
                            db.UpdateInfoCompare("a,a", str_CompareLive, true);
                            string timecomparelive = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareLive.Text   = Title + "LIVE" + Title + "\n" + str_CompareLive + "\n" + timecomparelive;
                            strCompareLiveTemp     = str_CompareLive;
                        }
                        if (str_CompareUnder != strCompareUnderTemp)
                        {
                            db.UpdateInfoCompare("under", str_CompareUnder, true);
                            string timecomparelive  = Title + DateTime.Now.ToLongTimeString() + Title;
                            rtb_CompareNonLive.Text = Title + "UNDER" + Title + "\n" + str_CompareUnder + "\n" + timecomparelive;
                            strCompareUnderTemp     = str_CompareUnder;
                        }


                        count++;
                        if (count == 5)
                        {
                            index++;
                            count = 0;
                        }
                        if (index == maxuser)
                        {
                            index = minuser;
                            count = 0;
                        }
                        Thread.Sleep(100);
                    }
                    #endregion
                });
                tLive.Start();
            }
        }