コード例 #1
0
        private System.Collections.Generic.List<MatchDTO> updateToDicNew()
        {
            //this.dicMatches.Clear();
            System.Collections.Generic.List<MatchDTO> result = new List<MatchDTO>();

            foreach (ArrayList current in this._eventResultDictionary.Values)
            {
                ArrayList arrayList = this._eventDictionary[current[1].ToString()];
                MatchDTO sboMatch = new MatchDTO();
                sboMatch.ID = arrayList[0].ToString();
                LeagueDTO league = new LeagueDTO();
                league.ID = arrayList[2].ToString();
                league.Name = this._tournamentDictionary[league.ID][1].ToString();
                sboMatch.League = league;
                sboMatch.HomeTeamName = arrayList[3].ToString();
                sboMatch.AwayTeamName = arrayList[4].ToString();
                result.Add(sboMatch);                
            }
            foreach (ArrayList current2 in this._oddsDictionary.Values)
            {
                string id = current2[0].ToString();
                if (current2[1].GetType().Equals(typeof(ArrayList)))
                {
                    ArrayList arrayList2 = (ArrayList)current2[1];
                    if (current2[2].GetType().Equals(typeof(ArrayList)))
                    {
                        ArrayList arrayList3 = (ArrayList)current2[2];
                        if (this._eventResultDictionary.ContainsKey(arrayList2[0].ToString()))
                        {
                            string text = this._eventResultDictionary[arrayList2[0].ToString()][1].ToString();
                            OddDTO sboOdd = new OddDTO();
                            sboOdd.ID = arrayList2[0].ToString();

                            eOddType type = this.reCal2(arrayList2[1].ToString());

                            sboOdd.Type = type;
                            
                            string text2 = this.reCal(arrayList2[1].ToString());
                                                                                    
                            if ("8731".Contains(text2))                            
                            {
                                sboOdd.Odd = arrayList2[4].ToString();
                                //sboOdd.hdp = decimal.Parse(arrayList2[4].ToString());
                                if ("71".Contains(text2))
                                {
                                    //sboOdd.hdp = -sboOdd.hdp;
                                    sboOdd.HomeFavor = true;
                                    sboOdd.IsHomeGive = true;
                                }
                                sboOdd.Home = float.Parse(arrayList3[0].ToString());
                                sboOdd.Away = float.Parse(arrayList3[1].ToString());
                                foreach (MatchDTO m in result)
                                {
                                    if (m.ID == id)
                                    {
                                        m.Odds.Add(sboOdd);
                                    }
                                }                                
                            }
                        }
                    }
                }
            }
            return result;
        }
コード例 #2
0
        private void CompareSameMatch()
        {
            this._comparing = true;
            lock (this._listSameMatch)
            {
                System.Collections.Generic.List<MatchDTO> listIBETMatch = this._listIBETMatch;
                System.Collections.Generic.List<MatchDTO> listSbobetMatch = this._listSbobetMatch;

                if (this._listSameMatch != null)
                {
                    this._listSameMatch.Clear();
                }
                else
                {
                    this._listSameMatch = new System.Collections.Generic.List<MatchDTO>();
                }

                if (scantype == ScanningType.both)
                {
                    #region BuonComIBETSBO
                    Dictionary<string, IbetMatch> iMatchs = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                    Dictionary<string, SboMatch> sMatchs = this._sbobetEngine.sboAgent.parserLive.LdicMatches[0];
                    //var i = iMatchs.Values.
                    foreach (KeyValuePair<string, IbetMatch> iM in iMatchs)
                    {
                        foreach (KeyValuePair<string, SboMatch> sM in sMatchs)
                        {
                            if ((iM.Value.Home == sM.Value.home) || (iM.Value.Away == sM.Value.away))
                            {
                                MatchDTO matchDTO = new MatchDTO();
                                matchDTO.ID = iM.Value.MatchId;
                                matchDTO.AwayTeamName = iM.Value.Away + " / " + sM.Value.away;
                                matchDTO.HomeTeamName = iM.Value.Home + " / " + sM.Value.home;
                                matchDTO.Minute = iM.Value.Minute;
                                matchDTO.HomeScore = iM.Value.ScoreH.ToString();
                                matchDTO.AwayScore = iM.Value.ScoreA.ToString();
                                if (iM.Value.Period == 0)
                                    matchDTO.IsHalfTime = true;
                                else if (iM.Value.Period == 1)
                                    matchDTO.Half = 1;
                                else if (iM.Value.Period == 2)
                                    matchDTO.Half = 2;

                                LeagueDTO leagueDTO = new LeagueDTO();
                                leagueDTO.Name = iM.Value.LeagueName + " / " + sM.Value.leagueName;
                                leagueDTO.ID = iM.Value.LeagueId;
                                matchDTO.League = leagueDTO;

                                foreach (KeyValuePair<string, SboOdd> sO in sM.Value.dicOdds)
                                {
                                    foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                    {
                                        if (sO.Value.oddType == iO.Value.oddType)
                                        {
                                            if (sO.Value.home + iO.Value.away == -0.01m || sO.Value.home + iO.Value.away == 0)
                                            {
                                                //iBet.Utilities.WriteLog.Write("Odd Found:iH sA: " + iM.Value.Home + "/" + sM.Value.home + "-" + iM.Value.Away + "/" + sM.Value.away +
                                                //    " >> ibet Odd: " + iO.Value.home + "/" + iO.Value.away + " >> sbo Odd:" + sO.Value.home + "/" + sO.Value.away +
                                                //    " >> " + iO.Value.oddType + ":" + sO.Value.oddType);
                                                //BetObject betObject = new BetObject();
                                                //betObject.ibet = new Bet();

                                                //this._ibetEngine.ibetAgent.CheckOdds

                                                TransactionDTO transactionDTO = new TransactionDTO();
                                            }
                                            if (sO.Value.away + iO.Value.home == -0.01m || sO.Value.away + iO.Value.home == 0)
                                            {
                                                //iBet.Utilities.WriteLog.Write("Odd Found:iA sH: " + iM.Value.Home + "/" + sM.Value.home + "-" + iM.Value.Away + "/" + sM.Value.away +
                                                //    " >> ibet Odd: " + iO.Value.home + "/" + iO.Value.away + " >> sbo Odd:" + sO.Value.home + "/" + sO.Value.away +
                                                //    " >> " + iO.Value.oddType + ":" + sO.Value.oddType);
                                            }
                                        }
                                    }
                                }
                                this._listSameMatch.Add(matchDTO);
                            }
                        }
                    }
                    System.DateTime now = System.DateTime.Now;
                    System.TimeSpan timeSpan;

                    System.DateTime now2 = System.DateTime.Now;
                    timeSpan = now2 - now;
                    double totalMilliseconds = timeSpan.TotalMilliseconds;
                    BarItem arg_648_0 = this.lblSbobetTotalMatch;
                    int count = sMatchs.Count;
                    arg_648_0.Caption = count.ToString();
                    BarItem arg_663_0 = this.lblIbetTotalMatch;
                    count = iMatchs.Count;
                    arg_663_0.Caption = count.ToString();
                    this.lblSameMatch.Caption = "Total Same Match: " + this._listSameMatch.Count;
                    this.lblLastUpdate.Caption = System.DateTime.Now.ToString();
                    #endregion
                }
                else if (scantype == ScanningType.ibet || scantype == ScanningType.ibetVSibet)
                {                    
                    Dictionary<string, IbetMatch> iMatchs1 = new Dictionary<string, IbetMatch>();
                    Dictionary<string, IbetMatch> iMatchs0 = new Dictionary<string, IbetMatch>();
                    if (checkEdit5.Checked)//live
                        iMatchs0 = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                    if (checkEdit6.Checked)//non live
                        iMatchs1 = this._ibetEngine.ibetAgent.parser.LdicMatches[1];

                    this._ibetMatchs = iMatchs1.Concat(iMatchs0).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value);
                    lock (this._ibetMatchs)
                    {
                        foreach (KeyValuePair<string, IbetMatch> iM in _ibetMatchs)
                        {
                            #region SAMEWORD_PREPARE_MATCHLIST
                            MatchDTO matchDTO = new MatchDTO();
                            matchDTO.ID = iM.Value.MatchId;
                            matchDTO.AwayTeamName = iM.Value.Away;
                            matchDTO.HomeTeamName = iM.Value.Home;
                            //matchDTO.KickOffTime = iM.Value.KickOffTime;
                            string formatString = "yyyyMMddHHmm";
                            //string sample = "201006112219";
                            DateTime dt = DateTime.ParseExact(iM.Value.KickOffTime, formatString, null);
                            matchDTO.KickOffTime = dt.ToString("dd/MM HH:mm");
                            DateTime ct = DateTime.Parse(this._ibetEngine.ibetAgent.CT);
                            TimeSpan ts = dt.Subtract(ct);//kick off time - current time
                            double tic = ts.TotalSeconds;
                            if (tic <= 300 && tic > 0)
                            {
                                matchDTO.KickOffTime += " - " + ts.Minutes.ToString() + " mins to start";
                            }
                            else if (tic < 0)
                            {
                                matchDTO.KickOffTime += " !Live";
                            }

                            matchDTO.Minute = iM.Value.Minute;
                            matchDTO.HomeScore = iM.Value.ScoreH.ToString();
                            matchDTO.AwayScore = iM.Value.ScoreA.ToString();

                            if (iM.Value.Period == 0)
                                matchDTO.IsHalfTime = true;
                            else if (iM.Value.Period == 1)
                                matchDTO.Half = 1;
                            else if (iM.Value.Period == 2)
                                matchDTO.Half = 2;

                            LeagueDTO leagueDTO = new LeagueDTO();
                            leagueDTO.Name = iM.Value.LeagueName;
                            leagueDTO.ID = iM.Value.LeagueId;
                            matchDTO.League = leagueDTO;

                            this._listSameMatch.Add(matchDTO);
                            int num = 0;
                            if (this.chbRandomStake.Checked)
                            {
                                while (num == 0)
                                {
                                    string strNum = this.txtStake.Lines[new System.Random().Next(this.txtStake.Lines.Length)];
                                    int.TryParse(strNum, out num);
                                }
                            }

                            #endregion

                            if (scantype == ScanningType.ibetVSibet)
                            {
                                #region IBET_vs_IBET
                                if (leagueDTO.Name.Contains("SPECIFIC 15 MINS OVER/UNDER"))
                                {
                                    if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                    {
                                        if (matchDTO.HomeTeamName.Contains("30:01-45:00") || matchDTO.HomeTeamName.Contains("75:01-90:00"))
                                        {
                                            if (!matchDTO.KickOffTime.Contains("Live"))
                                            {
                                                foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                                {
                                                    if (iO.Value.oddType == 3)//keo OU
                                                    {
                                                        TransactionDTO transactionDTO;
                                                        string strOU = "a";
                                                        if (checkEdit2.Checked)
                                                        {
                                                            strOU = "h";
                                                        }
                                                        if (matchDTO.HomeTeamName.Contains("30:01-45:00"))
                                                        {
                                                            if (checkEdit17.Checked)//allow Half 1
                                                            {
                                                               
                                                                transactionDTO = PlaceSingleIBET("Over15_Fang", iO.Value.home.ToString(),
                                                                    matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, strOU,
                                                                    num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                this.AddTransaction(transactionDTO);
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (checkEdit18.Checked) //allow half 2
                                                            {
                                                                transactionDTO = PlaceSingleIBET("Over15_Fang", iO.Value.home.ToString(),
                                                                matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, strOU,
                                                                num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                this.AddTransaction(transactionDTO);
                                                            }
                                                        }
                                                        
                                                    }
                                                }
                                            }
 
                                        }
                                    } 
                                }
                                #endregion
                            }
                            else if (scantype == ScanningType.ibet)
                            {
                                #region IBET_Strategies
                                foreach (KeyValuePair<string, IbetOdd> iO in iM.Value.dicOdds)
                                {
                                    if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                    {
                                        if (checkEdit12.Checked) // under strategy
                                        {
                                            if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                            {
                                                if (checkEdit9.Checked)
                                                {
                                                    if (!matchDTO.KickOffTime.Contains("Live"))
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("Under", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "a",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                    }
                                                }
                                                else
                                                {
                                                    TransactionDTO transactionDTO = PlaceSingleIBET("Under", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "a",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                    this.AddTransaction(transactionDTO);
                                                }
                                            }
                                        }
                                        if (checkEdit8.Checked) //over strategy
                                        {
                                            if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                            {
                                                TransactionDTO transactionDTO = PlaceSingleIBET("Over", iO.Value.home.ToString(),
                                                    matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                    num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                this.AddTransaction(transactionDTO);
                                            }
                                        }
                                        if (checkEdit7.Checked) // Over 92/90
                                        {
                                            if (matchDTO.KickOffTime.Contains("Live"))
                                            {
                                                if (iO.Value.oddType == 3 || iO.Value.oddType == 8)
                                                {
                                                    if (iO.Value.hdp - ((decimal)iM.Value.ScoreH + (decimal)iM.Value.ScoreA) == (decimal)0.5)
                                                    {
                                                        if (iM.Value.Home.Contains("No. of Corners") && iO.Value.home == (decimal)0.90 && iO.Value.away == (decimal)0.92)
                                                        {
                                                            TransactionDTO transactionDTO = PlaceSingleIBET("Over9290", iO.Value.home.ToString(),
                                                            matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                            this.AddTransaction(transactionDTO);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if (checkEdit9.Checked) // Odd down: Sap keo
                                        {
                                            if (matchDTO.KickOffTime.Contains("mins to start"))
                                            {
                                                if (iO.Value.oddType == 3)
                                                {
                                                    List<Bet> bl = this._ibetEngine.ibetAgent.betList;
                                                    lock (bl)
                                                    {
                                                        foreach (Bet bet in bl)
                                                        {
                                                            if (bet.Home == matchDTO.HomeTeamName && bet.Away == matchDTO.AwayTeamName)
                                                            {
                                                                iBet.Utilities.WriteLog.Write("Sap Keo:: Tim thay keo trong bet list trong tran : " + bet.Home + " - " + bet.Away);
                                                                if (bet.Handicap == iO.Value.hdp)
                                                                {
                                                                    if (iO.Value.away < 0 || iO.Value.away - bet.OddsValue >= (decimal)0.05)
                                                                    {
                                                                        iBet.Utilities.WriteLog.Write("Sap Keo:: Keo bi sap " + (iO.Value.away - bet.OddsValue).ToString() + " gia. Go to bet over");
                                                                        //keo under sap xuo^'ng an cao hon
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET("SapKeo", iO.Value.home.ToString(),
                                                                            matchDTO, iO.Value.oddsId, iO.Value.hdp.ToString(), eOddType.FulltimeOverUnder, "h",
                                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        if (chbHighRevenueBoost.Checked) // Best analysed strategy
                                        {
                                            if (!leagueDTO.Name.Contains("Cup") && !leagueDTO.Name.Contains("CUP"))
                                            {
                                                if (iO.Value.oddType == 3 && iO.Value.home == iO.Value.away)
                                                {
                                                    OddDTO oddDTO = new OddDTO();
                                                    oddDTO.Odd = iO.Value.hdp.ToString();
                                                    string s = CheckBestStrategyValidation(matchDTO, oddDTO);
                                                    if (s == "nguoc")
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("nguoc", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                        //Console.Write("nguoc");
                                                    }
                                                    else if (s == "xuoi")
                                                    {
                                                        TransactionDTO transactionDTO = PlaceSingleIBET("xuoi", iO.Value.home.ToString(),
                                                        matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                        num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                        this.AddTransaction(transactionDTO);
                                                        //Console.Write("xuoi");
                                                    }
                                                }
                                            }
                                        }
                                        if (checkEdit11.Checked)//fair odd
                                        {
                                            if (!leagueDTO.Name.Contains("Cup") && !leagueDTO.Name.Contains("CUP"))
                                            {
                                                if (iM.Value.Minute >= 35 && iM.Value.Period == 1 && iM.Value.ScoreA == iM.Value.ScoreH)
                                                {
                                                    iBet.Utilities.WriteLog.Write("01:Found fair odd: " + iM.Value.Home + "-" + iM.Value.Away + ":" + iM.Value.Minute + "m");
                                                    if ((iO.Value.home > (decimal)0.9)
                                                        && iO.Value.oddType == 3
                                                        && (iO.Value.hdp - (decimal)(iM.Value.ScoreH + iM.Value.ScoreA) == (decimal)1.75))
                                                    {
                                                        iBet.Utilities.WriteLog.Write("02:Found fair odd correct");
                                                        foreach (KeyValuePair<string, IbetMatch> snapshotMacht in _ibetMatchsSnapShot)
                                                        {
                                                            if (snapshotMacht.Value.Home == iM.Value.Home && snapshotMacht.Value.Away == iM.Value.Away)
                                                            {
                                                                iBet.Utilities.WriteLog.Write("03:Found match in Snapshot");
                                                                foreach (KeyValuePair<string, IbetOdd> snapshotOdd in snapshotMacht.Value.dicOdds)
                                                                {
                                                                    if (snapshotOdd.Value.oddType == 3
                                                                        && snapshotOdd.Value.hdp >= (decimal)2.5
                                                                        && (snapshotOdd.Value.home >= (decimal)0.92 || snapshotOdd.Value.home < (decimal)0))
                                                                    {
                                                                        iBet.Utilities.WriteLog.Write("04:Found odd over 2.5 correct in Snapshot");
                                                                        if (snapshotOdd.Value.oddType == 1 && snapshotOdd.Value.hdp <= (decimal)0.75)
                                                                        {
                                                                            iBet.Utilities.WriteLog.Write("05:Found handicap correct in Snapshot, go to Bet");
                                                                            TransactionDTO transactionDTO = PlaceSingleIBET("Over1.75", iO.Value.home.ToString(),
                                                                            matchDTO, iO.Value.oddsId, iO.Value.home.ToString(), eOddType.FulltimeOverUnder, "h",
                                                                            num.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent.Config.Account);
                                                                            this.AddTransaction(transactionDTO);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                #endregion
                            }                            
                        }
                    }
                    if (scantype == ScanningType.ibetVSibet)
                    {
                        #region IBET_vs_IBET_continue
                        
                        Dictionary<string, IbetMatch> iMatchs2 = new Dictionary<string, IbetMatch>();         
                        iMatchs2 = this._ibetEngine.ibetAgent.parser.LdicMatches[0];
                        //this._ibetEngine.ibetAgent.RefreshBetList();
                        lock (iMatchs2)
                        {
                            foreach (KeyValuePair<string, IbetMatch> iM2 in _ibetMatchs)
                            {                                
                                if ((iM2.Value.Period == 1 && iM2.Value.Minute >= (int)spinEdit1.Value) || (iM2.Value.Period == 2 && iM2.Value.Minute >= (int)spinEdit2.Value)) // chi chon nhung tran p31 cua hiep 1
                                {
                                    foreach (KeyValuePair<string, IbetOdd> iO2 in iM2.Value.dicOdds)
                                    {
                                        if (((System.DateTime.Now - this._lastTransactionTime).Seconds > 8) && !this._betting)
                                        {
                                            if (iO2.Value.oddType == 8 || iO2.Value.oddType == 3)
                                            {
                                                if (iO2.Value.hdp - ((decimal)iM2.Value.ScoreH + (decimal)iM2.Value.ScoreA) == (decimal)0.5)
                                                {
                                                    bl = this._ibetEngine.ibetAgent.betList;
                                                    foreach (Bet bet in bl)
                                                    {
                                                        if (bet.Home.Contains("30:01-45:00") || bet.Home.Contains("75:01-90:00"))
                                                        {
                                                            string HomeTeam = "";
                                                            if (iO2.Value.oddType == 8)
                                                            {
                                                                HomeTeam = bet.Home.Replace(" 30:01-45:00", "");

                                                            }
                                                            else
                                                            {
                                                                HomeTeam = bet.Home.Replace(" 75:01-90:00", "");
                                                            }
                                                            

                                                            if (HomeTeam == iM2.Value.Home.Replace("(N)", "").TrimEnd())
                                                            {                                                                    
                                                                MatchDTO matchDTO = new MatchDTO();
                                                                matchDTO.HomeTeamName = iM2.Value.Home.Replace("(N)", "").TrimEnd();
                                                                matchDTO.AwayTeamName = iM2.Value.Away.Replace("(N)","").TrimEnd();
                                                                matchDTO.Minute = iM2.Value.Minute;
                                                                matchDTO.HomeScore = iM2.Value.ScoreH.ToString();
                                                                matchDTO.AwayScore = iM2.Value.ScoreA.ToString();
                                                                matchDTO.Half = iM2.Value.Period;

                                                                int num = (int)bet.Stake;
                                                                int ExRate1 = (int)config.Ibet.ExchangeRate;
                                                                int ExRate2 = (int)config.Ibet2.ExchangeRate;
                                                                float stake2 = num * ExRate1 / ExRate2;

                                                                decimal giatri1;
                                                                string OU = "h";

                                                                if (bet.Choice == Choice.H)
                                                                {
                                                                    giatri1 = iO2.Value.away;
                                                                    OU = "a";
                                                                }
                                                                else
                                                                {
                                                                    giatri1 = iO2.Value.home;
                                                                }

                                                                //iBet.Utilities.WriteLog.Write("Tim thay tran :" + bet.Home + " -vs- " + bet.Away +
                                                                //    ", o phut thu:" + matchDTO.Minute.ToString() + ", hiep " + matchDTO.Half.ToString() +
                                                                //    "chuan bi xa..");                                                                
                                                                eOddType oddtype;

                                                                if ((giatri1 > 0 && bet.OddsValue + giatri1 >= spinEdit4.Value) || giatri1 < 0)
                                                                {
                                                                    if (checkEdit1.Checked)
                                                                    {
                                                                        
                                                                        string textx = "";
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa loi gia > Min:" + matchDTO.Minute + "half " + matchDTO.Half.ToString() + " > " + bet.OddsValue.ToString() + "/" + giatri1.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa loi gia > Min:" + matchDTO.Minute + "half " + matchDTO.Half.ToString() + " > " + bet.OddsValue.ToString() + "/" + giatri1.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, giatri1.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                        iBet.Utilities.WriteLog.Write(textx);
                                                                    }
                                                                }
                                                                else 
                                                                {
                                                                    string textx = "";
                                                                    if (bet.Choice == Choice.H && matchDTO.Minute >= 30)
                                                                    {
                                                                        
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, iO2.Value.away.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO);
                                                                        //iBet.Utilities.WriteLog.Write(textx);
                                                                    }
                                                                    else if (bet.Choice == Choice.A && matchDTO.Minute >= 34)
                                                                    {
                                                                        if (bet.Home.Contains("30:01-45:00"))
                                                                        {
                                                                            textx = "Over15_XA > 30-45 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FirstHalfOverUnder;
                                                                        }
                                                                        else
                                                                        {
                                                                            textx = "Over15_XA > 75-90 > Xa thuong > Min:" + matchDTO.Minute + " > " + bet.OddsValue.ToString() + "/" + iO2.Value.away.ToString() + " > Ref ID:" + bet.Id;
                                                                            oddtype = eOddType.FulltimeOverUnder;
                                                                        }
                                                                        
                                                                        TransactionDTO transactionDTO = PlaceSingleIBET(textx, iO2.Value.away.ToString(),
                                                                            matchDTO, iO2.Value.oddsId, iO2.Value.hdp.ToString(), oddtype, OU,
                                                                            stake2.ToString(), matchDTO.HomeScore, matchDTO.AwayScore, this._ibetEngine, true, "", this._ibetEngine.ibetAgent2.Config.Account);
                                                                        this.AddTransaction(transactionDTO); 
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }                                                    
                                                }
                                            }
                                        }
                                    }                                     
                                }
                            }
                        }
                        #endregion
                    }
                    BarItem arg_663_0 = this.lblIbetTotalMatch;
                    int count = _ibetMatchs.Count;
                    arg_663_0.Caption = count.ToString() + " (" + iMatchs0.Count.ToString() + " live)";
                    this.lblLastUpdate.Caption = System.DateTime.Now.ToString();
                    this.rpgIbet.Text = "IBET - " + this._ibetEngine.ibetAgent.Config.Account + " " + this._ibetEngine.ibetAgent.CT;
                    
                }
                else if (scantype == ScanningType.sbo)
                {
                    #region SBO_Strategies
                    Dictionary<string, SboMatch> sMatchs0 = this._sbobetEngine.sboAgent.parserLive.dicMatches;
                    Dictionary<string, SboMatch> sMatchs1 = this._sbobetEngine.sboAgent.parserNonlive.dicMatches;
                    Dictionary<string, SboMatch> sMatchs = sMatchs1.Concat(sMatchs0).GroupBy(d => d.Key).ToDictionary(d => d.Key, d => d.First().Value);
                    foreach (KeyValuePair<string, SboMatch> sM in sMatchs)
                    {
                        MatchDTO matchDTO = new MatchDTO();
                        matchDTO.ID = sM.Value.matchId;
                        matchDTO.AwayTeamName = sM.Value.away;
                        matchDTO.HomeTeamName = sM.Value.home;

                        matchDTO.AwayScore = sM.Value.awayscore.ToString();
                        matchDTO.HomeScore = sM.Value.homescore.ToString();
                        matchDTO.Minute = sM.Value.minute;
                        matchDTO.Half = sM.Value.half;
                        if (matchDTO.Half == 0)
                            matchDTO.IsHalfTime = true;

                        LeagueDTO leagueDTO = new LeagueDTO();
                        leagueDTO.Name = sM.Value.leagueName;
                        leagueDTO.ID = sM.Value.leagueId;
                        matchDTO.League = leagueDTO;

                        this._listSameMatch.Add(matchDTO);
                    }
                    BarItem arg_648_0 = this.lblSbobetTotalMatch;
                    int count = sMatchs.Count;
                    arg_648_0.Caption = count.ToString() + " (" + sMatchs0.Count.ToString() + " live)";
                    #endregion
                }
                else if (scantype == ScanningType.ibetVSibet)
                {
                    
                }
                lock (this.grdSameMatch)
                {
                    this.grdSameMatch.RefreshDataSource();
                }
                lock (girdBetList1)
                {
                    this.girdBetList1.RefreshDataSource();
                }
            }
            
            this._comparing = false;
            if (this._compareAgain && !this._comparing)
            {
                this._compareAgain = false;
                this.CompareSameMatch();
            }
        }