コード例 #1
0
        public static MatchDTO SearchMatch(MatchDTO matchToSearch, System.Collections.Generic.List <MatchDTO> dataSource)
        {
            string   text  = matchToSearch.HomeTeamName.ToLower();
            string   text2 = matchToSearch.AwayTeamName.ToLower();
            string   text3 = matchToSearch.League.Name.ToLower();
            MatchDTO result;

            if (text3.Contains("special") || text3.Contains("specific") || text3.Contains("fantasy") || text3.Contains("which") || text3.Contains("team") || text3.Contains("advance") || text3.Contains("next") || text3.Contains("winner"))
            {
                result = null;
            }
            else
            {
                if (text.Contains("+") || text.Contains("corner") || text.Contains("(et)") || text.Contains("(pen)") || text.Contains("(winner)") || text.Contains("winner"))
                {
                    result = null;
                }
                else
                {
                    if (text2.Contains("+") || text2.Contains("corner") || text2.Contains("(et)") || text2.Contains("(pen)") || text2.Contains("(winner)") || text2.Contains("winner"))
                    {
                        result = null;
                    }
                    else
                    {
                        foreach (MatchDTO current in dataSource)
                        {
                            string text4 = current.HomeTeamName.ToLower();
                            string text5 = current.AwayTeamName.ToLower();
                            string text6 = current.League.Name.ToLower();
                            if (!text6.Contains("special") && !text6.Contains("specific") && !text6.Contains("fantasy") && !text3.Contains("which") && !text3.Contains("team") && !text3.Contains("advance") && !text3.Contains("next") && !text3.Contains("winner"))
                            {
                                if (!text5.Contains("+") && !text5.Contains("corner") && !text5.Contains("(et)") && !text5.Contains("(pen)") && !text5.Contains("(winner)") && !text5.Contains("winner"))
                                {
                                    if (!text4.Contains("+") && !text4.Contains("corner") && !text4.Contains("(et)") && !text4.Contains("(pen)") && !text4.Contains("(winner)") && !text4.Contains("winner"))
                                    {
                                        if ((text.Contains(text4) && text2.Contains(text5)) || text5 == text2 || text == text4)
                                        {
                                            result = current;
                                            return(result);
                                        }
                                        if (text4.Contains(text) && text5.Contains(text2))
                                        {
                                            result = current;
                                            return(result);
                                        }
                                    }
                                }
                            }
                        }
                        result = null;
                    }
                }
            }
            return(result);
        }
コード例 #2
0
        public static OddDTO SearchOdd(string matchID, string oddID, string oddValue, System.Collections.Generic.List <MatchDTO> dataSource)
        {
            MatchDTO matchDTO = MatchDTO.SearchMatch(matchID, dataSource);
            OddDTO   result;

            if (matchDTO != null)
            {
                System.Collections.Generic.List <OddDTO> list = (
                    from odd in matchDTO.Odds
                    where odd.ID.Equals(oddID) && odd.Odd.Equals(oddValue)
                    select odd).ToList <OddDTO>();
                if (list.Count == 1)
                {
                    result = list[0];
                    return(result);
                }
            }
            result = null;
            return(result);
        }
コード例 #3
0
        public static MatchDTO SearchMatchFull(MatchDTO matchToSearch, System.Collections.Generic.List <MatchDTO> dataSource)
        {
            string   text  = matchToSearch.HomeTeamName.ToLower();
            string   text2 = matchToSearch.AwayTeamName.ToLower();
            string   text3 = matchToSearch.League.Name.ToLower();
            MatchDTO result;

            foreach (MatchDTO current in dataSource)
            {
                string text4 = current.HomeTeamName.ToLower();
                string text5 = current.AwayTeamName.ToLower();
                string text6 = current.League.Name.ToLower();
                if (text5 == text2 || text == text4)
                {
                    result = current;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
コード例 #4
0
		public static bool IsValidMatch(MatchDTO match)
		{
			return !match.LeagueName.ToLower().Contains("special") && !match.LeagueName.ToLower().Contains("specific") && !match.LeagueName.ToLower().Contains("fantasy") && !match.LeagueName.ToLower().Contains("winner") && (!match.HomeTeamName.ToLower().Contains("+") && !match.HomeTeamName.ToLower().Contains("corner") && !match.HomeTeamName.ToLower().Contains("(et)") && !match.HomeTeamName.ToLower().Contains("(pen)") && !match.HomeTeamName.ToLower().Contains("(winner)")) && !match.HomeTeamName.ToLower().Contains("winner") && (!match.AwayTeamName.ToLower().Contains("+") && !match.AwayTeamName.ToLower().Contains("corner") && !match.AwayTeamName.ToLower().Contains("(et)") && !match.AwayTeamName.ToLower().Contains("(pen)") && !match.AwayTeamName.ToLower().Contains("(winner)")) && !match.AwayTeamName.ToLower().Contains("winner");
		}
コード例 #5
0
        private string CheckBestStrategyValidation(MatchDTO match, OddDTO odd)
        {
            string result = "";

            var listOddGoodToBet = from p in listBA
                        where p.isGoodOddToBet == true
                        select p;
            foreach (BetAnalyse ba in listOddGoodToBet)
            {
                string intHomeScore = "0";
                string intAwayScore = "0";
                string[] array4 = ba.OddType.Split(new string[] { " " }, System.StringSplitOptions.None);
                string OddValue = array4[1];

                if (ba.OddType.Contains("["))
                {
                    string[] array1 = ba.OddType.Split(new string[] { " [" }, System.StringSplitOptions.None);
                    string[] array2 = array1[1].Split(new string[] { "]" }, System.StringSplitOptions.None);
                    string[] array3 = array2[0].Split(new string[] { "-" }, System.StringSplitOptions.None);
                    intHomeScore = array3[0];
                    intAwayScore = array3[1];
                    if (!match.IsHalfTime && match.HomeScore == intHomeScore && match.AwayScore == intAwayScore)
                    {
                        if (odd.Odd == OddValue)
                        {
                            if (ba.Diff < 0)
                            {
                                iBet.Utilities.WriteLog.Write("Live:: Checking valid strategy: nguoc :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                                return "nguoc";
                            }
                            else
                            {
                                iBet.Utilities.WriteLog.Write(" Checking valid strategy: xuoi :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                                return "xuoi";
                            }
                        }
                    }
                }
                else
                {
                    if (match.IsHalfTime && match.HomeScore == "0" && match.AwayScore == "0" && odd.Odd == OddValue)
                    {
                        if (ba.Diff < 0)
                        {
                            iBet.Utilities.WriteLog.Write("NonLive:: Checking valid strategy: nguoc :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                            return "nguoc";
                        }
                        else
                        {
                            iBet.Utilities.WriteLog.Write("NonLive:: Checking valid strategy: xuoi :: " + match.HomeTeamName + ":" + match.HomeScore
                                    + "-" + match.AwayScore + ":" + match.AwayTeamName + " ::: Odd of match: " + odd.Odd + " ::: Odd of strategy: " + ba.OddType);
                            return "xuoi";
                        }
                    }
                }
            }

            return result;
        }
コード例 #6
0
 internal void AddOddToClound(string fromIbetAccount, MatchDTO ibetmatch, MatchDTO sbobetmatch, eOddType oddtype, string ibetodd, string sbobetodd, string ibetoddType, string sbobetoddType, string ibetoddValue, string sbobetoddValue, bool homeFavor)
 {
     if (chkSCloud.Checked)
     {
         OddNews odd = new OddNews();
         odd.HomeTeamName = ibetmatch.HomeTeamName;
         odd.AwayTeamName = ibetmatch.AwayTeamName;
         odd.LeagueName = ibetmatch.LeagueName;
         odd.OddType = oddtype.ToString();
         odd.IbetOddType = ibetoddType;
         odd.SbobetOddType = sbobetoddType;
         odd.IbetOddValue = ibetoddValue;
         odd.SbobetOddValue = sbobetoddValue;
         odd.HomeFavor = homeFavor.ToString();
         odd.IbetOdd = ibetodd;
         odd.SbobetOdd = sbobetodd;
         try
         {
             betBrokerSvc.GetOdd(odd, this._currentUserID);
         }
         catch (TimeoutException exception)
         {
             //Console.WriteLine("Got {0}", exception.GetType());
             //.Abort();
         }
         catch (CommunicationException exception)
         {
             //InitializeWCFService();
         }
     }
 }
コード例 #7
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string rawData)
        {
            System.Collections.Generic.List<MatchDTO> result;
            if (rawData.ToLower() == "od_OnEmpty(0);".ToLower())
            {
                result = new System.Collections.Generic.List<MatchDTO>();
            }
            else
            {
                System.Collections.Generic.List<MatchDTO> list = null;
                try
                {
                    if (rawData == string.Empty)
                    {
                        result = list;
                        return result;
                    }
                    //rawData = rawData.Replace("<script>", "");
                    if (rawData.Contains("$M('odds-display').onUpdate"))
                    {
                        int _num = rawData.IndexOf("$M('odds-display').onUpdate") + 30;
                        int _num2 = rawData.IndexOf(";");
                        rawData = rawData.Substring(_num, _num2 - _num);
                    }
                    //rawData = "";


                    list = new System.Collections.Generic.List<MatchDTO>();

                    JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(rawData);
                    using (System.Collections.Generic.List<object>.Enumerator enumerator = javaScriptArray.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            JavaScriptArray javaScriptArray2 = (JavaScriptArray)enumerator.Current;
                            JavaScriptArray javaScriptArray3 = (JavaScriptArray)javaScriptArray2[1];
                            if (javaScriptArray3 != null)
                            {
                                JavaScriptArray javaScriptArray4 = (JavaScriptArray)javaScriptArray3[0];
                                if (javaScriptArray4 != null)
                                {
                                    MatchDTO matchDTO = new MatchDTO();
                                    matchDTO.ID = javaScriptArray4[0].ToString();
                                    matchDTO.HomeTeamName = javaScriptArray4[1].ToString();
                                    matchDTO.AwayTeamName = javaScriptArray4[2].ToString();
                                    matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();
                                    JavaScriptArray javaScriptArray5 = (JavaScriptArray)javaScriptArray2[0];
                                    if (javaScriptArray5 != null)
                                    {
                                        matchDTO.League = new LeagueDTO();
                                        matchDTO.League.ID = javaScriptArray5[0].ToString();
                                        matchDTO.League.Name = javaScriptArray5[1].ToString();
                                    }
                                    else
                                    {
                                        MatchDTO matchDTO2 = list[list.Count - 1];
                                        matchDTO.League = matchDTO2.League;
                                    }
                                    if (javaScriptArray3.Count >= 2)
                                    {
                                        JavaScriptArray javaScriptArray6 = (JavaScriptArray)javaScriptArray3[2];
                                        if (javaScriptArray6 == null || javaScriptArray6.Count <= 0)
                                        {
                                            matchDTO.IsHalfTime = true;
                                        }
                                        else
                                        {
                                            if (javaScriptArray6.Count >= 5)
                                            {
                                                if (int.Parse(javaScriptArray6[4].ToString()) == 15)
                                                {
                                                    matchDTO.IsHalfTime = true;
                                                }
                                                else
                                                {
                                                    matchDTO.IsHalfTime = false;
                                                    matchDTO.Half = int.Parse(javaScriptArray6[2].ToString());
                                                    matchDTO.Minute = int.Parse(javaScriptArray6[3].ToString());
                                                }
                                            }
                                        }
                                    }
                                    else
                                    {
                                        matchDTO.IsHalfTime = true;
                                    }
                                    JavaScriptArray javaScriptArray7 = (JavaScriptArray)javaScriptArray2[2];
                                    if (javaScriptArray7 != null)
                                    {
                                        javaScriptArray7 = (JavaScriptArray)javaScriptArray7[1];
                                        if (javaScriptArray7 != null)
                                        {
                                            using (System.Collections.Generic.List<object>.Enumerator enumerator2 = javaScriptArray7.GetEnumerator())
                                            {
                                                while (enumerator2.MoveNext())
                                                {
                                                    JavaScriptArray javaScriptArray8 = (JavaScriptArray)enumerator2.Current;
                                                    OddDTO oddDTO = new OddDTO();
                                                    if (javaScriptArray8.Count > 3)
                                                    {
                                                        int num = int.Parse(javaScriptArray8[0].ToString());
                                                        switch (num)
                                                        {
                                                            case 1:
                                                                {
                                                                    oddDTO.Type = eOddType.FulltimeHandicap;
                                                                    oddDTO.ID = javaScriptArray8[1].ToString();
                                                                    float num2;
                                                                    if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Home = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Home = 0f;
                                                                    }
                                                                    if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Away = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Away = 0f;
                                                                    }
                                                                    oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                    if (javaScriptArray8[5] != null)
                                                                    {
                                                                        if (javaScriptArray8[5].ToString() == "1")
                                                                        {
                                                                            oddDTO.HomeFavor = true;
                                                                            oddDTO.AwayFavor = false;
                                                                        }
                                                                        else
                                                                        {
                                                                            if (javaScriptArray8[5].ToString() == "2")
                                                                            {
                                                                                oddDTO.HomeFavor = false;
                                                                                oddDTO.AwayFavor = true;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.HomeFavor = false;
                                                                                oddDTO.AwayFavor = false;
                                                                            }
                                                                        }
                                                                    }
                                                                    break;
                                                                }
                                                            case 2:
                                                                {
                                                                    break;
                                                                }
                                                            case 3:
                                                                {
                                                                    oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                    oddDTO.ID = javaScriptArray8[1].ToString();
                                                                    float num2;
                                                                    if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Home = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Home = 0f;
                                                                    }
                                                                    if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                    {
                                                                        oddDTO.Away = num2;
                                                                    }
                                                                    else
                                                                    {
                                                                        oddDTO.Away = 0f;
                                                                    }
                                                                    oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                    break;
                                                                }
                                                            default:
                                                                {
                                                                    switch (num)
                                                                    {
                                                                        case 7:
                                                                            {
                                                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                                float num2;
                                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Home = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Home = 0f;
                                                                                }
                                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Away = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Away = 0f;
                                                                                }
                                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                                if (javaScriptArray8[5] != null)
                                                                                {
                                                                                    if (javaScriptArray8[5].ToString() == "1")
                                                                                    {
                                                                                        oddDTO.HomeFavor = true;
                                                                                        oddDTO.AwayFavor = false;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        if (javaScriptArray8[5].ToString() == "2")
                                                                                        {
                                                                                            oddDTO.HomeFavor = false;
                                                                                            oddDTO.AwayFavor = true;
                                                                                        }
                                                                                        else
                                                                                        {
                                                                                            oddDTO.HomeFavor = false;
                                                                                            oddDTO.AwayFavor = false;
                                                                                        }
                                                                                    }
                                                                                }
                                                                                break;
                                                                            }
                                                                        case 9:
                                                                            {
                                                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                                float num2;
                                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Home = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Home = 0f;
                                                                                }
                                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                                {
                                                                                    oddDTO.Away = num2;
                                                                                }
                                                                                else
                                                                                {
                                                                                    oddDTO.Away = 0f;
                                                                                }
                                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                                break;
                                                                            }
                                                                    }
                                                                    break;
                                                                }
                                                        }
                                                        if (oddDTO.Home != 0f)
                                                            matchDTO.Odds.Add(oddDTO);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    list.Add(matchDTO);
                                }
                            }
                            else
                            {
                                MatchDTO matchDTO = list[list.Count - 1];
                                JavaScriptArray javaScriptArray7 = (JavaScriptArray)javaScriptArray2[2];
                                if (javaScriptArray7 != null)
                                {
                                    javaScriptArray7 = (JavaScriptArray)javaScriptArray7[1];
                                    if (javaScriptArray7 != null)
                                    {
                                        using (System.Collections.Generic.List<object>.Enumerator enumerator2 = javaScriptArray7.GetEnumerator())
                                        {
                                            while (enumerator2.MoveNext())
                                            {
                                                JavaScriptArray javaScriptArray8 = (JavaScriptArray)enumerator2.Current;
                                                OddDTO oddDTO = new OddDTO();
                                                if (javaScriptArray8.Count > 3)
                                                {
                                                    int num = int.Parse(javaScriptArray8[0].ToString());
                                                    switch (num)
                                                    {
                                                        case 1:
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeHandicap;
                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                float num2;
                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                {
                                                                    oddDTO.Home = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Home = 0f;
                                                                }
                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                {
                                                                    oddDTO.Away = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                if (javaScriptArray8[5] != null)
                                                                {
                                                                    if (javaScriptArray8[5].ToString() == "1")
                                                                    {
                                                                        oddDTO.HomeFavor = true;
                                                                        oddDTO.AwayFavor = false;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (javaScriptArray8[5].ToString() == "2")
                                                                        {
                                                                            oddDTO.HomeFavor = false;
                                                                            oddDTO.AwayFavor = true;
                                                                        }
                                                                        else
                                                                        {
                                                                            oddDTO.HomeFavor = false;
                                                                            oddDTO.AwayFavor = false;
                                                                        }
                                                                    }
                                                                }
                                                                break;
                                                            }
                                                        case 2:
                                                            {
                                                                break;
                                                            }
                                                        case 3:
                                                            {
                                                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                                                oddDTO.ID = javaScriptArray8[1].ToString();
                                                                float num2;
                                                                if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                {
                                                                    oddDTO.Home = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Home = 0f;
                                                                }
                                                                if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                {
                                                                    oddDTO.Away = num2;
                                                                }
                                                                else
                                                                {
                                                                    oddDTO.Away = 0f;
                                                                }
                                                                oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                break;
                                                            }
                                                        default:
                                                            {
                                                                switch (num)
                                                                {
                                                                    case 7:
                                                                        {
                                                                            oddDTO.Type = eOddType.FirstHalfHandicap;
                                                                            oddDTO.ID = javaScriptArray8[1].ToString();
                                                                            float num2;
                                                                            if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Home = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Home = 0f;
                                                                            }
                                                                            if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Away = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Away = 0f;
                                                                            }
                                                                            oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                            if (javaScriptArray8[5] != null)
                                                                            {
                                                                                if (javaScriptArray8[5].ToString() == "1")
                                                                                {
                                                                                    oddDTO.HomeFavor = true;
                                                                                    oddDTO.AwayFavor = false;
                                                                                }
                                                                                else
                                                                                {
                                                                                    if (javaScriptArray8[5].ToString() == "2")
                                                                                    {
                                                                                        oddDTO.HomeFavor = false;
                                                                                        oddDTO.AwayFavor = true;
                                                                                    }
                                                                                    else
                                                                                    {
                                                                                        oddDTO.HomeFavor = false;
                                                                                        oddDTO.AwayFavor = false;
                                                                                    }
                                                                                }
                                                                            }
                                                                            break;
                                                                        }
                                                                    case 9:
                                                                        {
                                                                            oddDTO.Type = eOddType.FirstHalfOverUnder;
                                                                            oddDTO.ID = javaScriptArray8[1].ToString();
                                                                            float num2;
                                                                            if (float.TryParse(javaScriptArray8[2].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Home = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Home = 0f;
                                                                            }
                                                                            if (float.TryParse(javaScriptArray8[3].ToString(), out num2))
                                                                            {
                                                                                oddDTO.Away = num2;
                                                                            }
                                                                            else
                                                                            {
                                                                                oddDTO.Away = 0f;
                                                                            }
                                                                            oddDTO.Odd = javaScriptArray8[4].ToString();
                                                                            break;
                                                                        }
                                                                }
                                                                break;
                                                            }
                                                    }
                                                    if (oddDTO.Home != 0f)
                                                        matchDTO.Odds.Add(oddDTO);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (System.Exception ex)
                {
                    throw ex;
                }
                result = list;
            }
            return result;
        }
コード例 #8
0
        private void CompareSameMatch()
        {
            //iBet.Utilities.WriteLog.Write("003: Start to comapre now");
            this._comparing = true;

            System.Collections.Generic.List<MatchDTO> listIBETMatch = this._listIBETMatch;
            System.Collections.Generic.List<MatchDTO> listIBETMatchNonLive = this._listIBETMatchNonLive;
            System.Collections.Generic.List<BetDTO> listSubIbetMatch = this._listBetInSubMatch;

            if (this._BetWaitingList == null)
            {
                this._BetWaitingList = new Dictionary<string, DateTime>();
            }
            if (listSubIbetMatch != null)
            {
                foreach (BetDTO bet in listSubIbetMatch)
                {
                    if (!this._OldBetListHistory.ContainsKey(bet.RefID))
                    {
                        if (!_listDoneBetInSub.Any(beted => beted.RefID == bet.RefID))
                        {
                            bet.ID = (_listDoneBetInSub.Count + 1).ToString();
                            this._listDoneBetInSub.Add(bet);
                        }

                        if (bet.Stake >= (int)txtAllowTradeMinValue.Value)
                        {
                            TransactionDTO trans = new TransactionDTO();

                            MatchDTO match = new MatchDTO();
                            match.HomeTeamName = bet.HomeTeamName;
                            match.AwayTeamName = bet.AwayTeamName;
                            match.League = new LeagueDTO();
                            match.League.Name = bet.League;

                            MatchDTO matchDTO = new MatchDTO();
                            if (bet.Live)
                            {
                                matchDTO = MatchDTO.SearchMatchFull(match, listIBETMatch);
                            }
                            else
                            {
                                matchDTO = MatchDTO.SearchMatchFull(match, listIBETMatchNonLive);
                                if (matchDTO == null)
                                    matchDTO = MatchDTO.SearchMatchFull(match, listIBETMatch);//tim trong list live, vi co the tran day chuyen trang thai
                            }

                            if (matchDTO != null)
                            {
                                matchDTO.HomeScore = bet.HomeScore;
                                matchDTO.AwayScore = bet.AwayScore;
                                //_mainForm.ad

                                #region Fang

                                string stake = string.Empty;
                                if (chkFollowPercent.Checked)
                                {
                                    int stk = (int)((bet.Stake * (float)txtFollowPercent.Value) / 100);
                                    if (stk < 5)
                                        stk = 5;
                                    stake = stk.ToString();
                                }
                                else
                                {
                                    stake = txtIBETFixedStake.Value.ToString();
                                }

                                string ibetOddType = string.Empty;
                                bool follow = chkFollowType.Checked;
                                if (bet.Type == eOddType.HT || bet.Type == eOddType.FT)
                                {
                                    if (bet.Choice.Contains(".1"))
                                        ibetOddType = "1";
                                    else if (bet.Choice.Contains(".2"))
                                        ibetOddType = "2";
                                    else if (bet.Choice.Contains(".x"))
                                        ibetOddType = "X";
                                    if (follow)
                                    {
                                        trans = PlaceSingleIBET(matchDTO, bet.Odd, bet.OddValue, bet.Type, ibetOddType, stake, bet.HomeScore, bet.AwayScore, this._ibetEngine, follow, bet.RefID, bet.Account);
                                        //this._mainForm.AddLocalSingleIBET(match, bet.Odd, bet.OddValue, bet.Type, ibetOddType, bet.Stake.ToString(), bet.HomeScore, bet.AwayScore, follow, bet.RefID, bet.Account, bet.Live);
                                    }
                                }
                                else
                                {
                                    if (bet.Choice.Contains("Over"))
                                    {
                                        if (follow)
                                            ibetOddType = "h";
                                        else
                                            ibetOddType = "a";
                                    }
                                    else if (bet.Choice.Contains("Under"))
                                    {
                                        if (follow)
                                            ibetOddType = "a";
                                        else
                                            ibetOddType = "h";
                                    }
                                    else if (bet.HomeTeamName.Contains(bet.Choice))
                                    {
                                        if (follow)
                                            ibetOddType = "h";
                                        else
                                            ibetOddType = "a";
                                    }
                                    else
                                    {
                                        if (chkFollowType.Checked)
                                            ibetOddType = "a";
                                        else
                                            ibetOddType = "h";
                                    }
                                    trans = PlaceSingleIBET(matchDTO, bet.Odd, bet.OddValue, bet.Type, ibetOddType, stake, bet.HomeScore, bet.AwayScore, this._ibetEngine, follow, bet.RefID, bet.Account);
                                    //this._mainForm.AddLocalSingleIBET(match, bet.Odd, bet.OddValue, bet.Type, ibetOddType, bet.Stake.ToString(), bet.HomeScore, bet.AwayScore, follow, bet.RefID, bet.Account, bet.Live);
                                }
                                #endregion
                                if (trans.IBETTrade)
                                {
                                    trans.SBOBETTrade = true;
                                    this._OldBetListHistory.Add(bet.RefID, DateTime.Now);
                                }
                                else if (trans.Note == "Score changed.")
                                {
                                    trans.IBETTrade = true;
                                    trans.Note += " Cancel this bet.";
                                    this._OldBetListHistory.Add(bet.RefID, DateTime.Now);
                                }
                                else
                                {
                                    trans.Note += " Add this bet to pending list.";
                                }
                                this.AddTransaction(trans);
                                if (listSubIbetMatch.Count > 1)
                                    Thread.Sleep(800);
                            }
                        }
                        else
                        {
                            this._OldBetListHistory.Add(bet.RefID, DateTime.Now);
                        }
                    }
                }
                lock (grdBetList)
                {
                    this.grdBetList.RefreshDataSource();
                }
            }
            else
            {
                //iBet.Utilities.WriteLog.Write("list bet just parsed is null"); 
            }

            BarItem arg_648_0 = this.lblSbobetTotalMatch;
            int count;
            if (_listBetInSubMatch != null)
            {
                count = _listBetInSubMatch.Count;
                arg_648_0.Caption = count.ToString();
                this.lblSameMatch.Caption = "Total Waiting Bet: " + this._BetWaitingList.Count;
            }
            else
                arg_648_0.Caption = "No Bet";
            //BarItem arg_663_0 = this.lblIbetTotalMatch;
            //count = listIBETMatch.Count;
            //arg_663_0.Caption = count.ToString();

            this.lblLastUpdate.Caption = System.DateTime.Now.ToString();

            this._comparing = false;
            if (this._compareAgain && !this._comparing)
            {
                this._compareAgain = false;
                this.CompareSameMatch();
            }
        }
コード例 #9
0
        private void TestStrategy()
        {
            System.Collections.Generic.List<Strategy> listStrategy = new List<Strategy>();
            try
            {
                using (var webClient = new System.Net.WebClient())
                {
                    var json = webClient.DownloadString("https://spreadsheets.google.com/feeds/list/0ArjfL6TJnxG3dHZNNlNZbGU0a0JMT21oWno2WXR4bEE/od9/public/values?alt=json-in-script");
                    string s = json.ToString().Replace("gdata.io.handleScriptLoaded(", "").Replace(");", "");
                    Newtonsoft.Json.JavaScriptObject jSObj = (Newtonsoft.Json.JavaScriptObject)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(s);
                    if (jSObj != null)
                    {
                        Newtonsoft.Json.JavaScriptObject jSObjFeed = (Newtonsoft.Json.JavaScriptObject)jSObj["feed"];
                        if (jSObjFeed != null)
                        {
                            Newtonsoft.Json.JavaScriptArray jSArrEntry = (Newtonsoft.Json.JavaScriptArray)jSObjFeed["entry"];
                            if (jSArrEntry != null)
                            {
                                using (System.Collections.Generic.List<object>.Enumerator enumerator = jSArrEntry.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        Newtonsoft.Json.JavaScriptObject objCurrent = (Newtonsoft.Json.JavaScriptObject)enumerator.Current;
                                        Strategy strategy = new Strategy();

                                        Newtonsoft.Json.JavaScriptObject jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$name"];
                                        strategy.Name = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$stepid"];
                                        strategy.StepID = int.Parse(jsObj2["$t"].ToString());

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$field"];
                                        strategy.Field = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$operator"];
                                        strategy.Operator = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$valuetocompare"];
                                        strategy.ValueToCompare = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$object"];
                                        strategy.Obj = jsObj2["$t"].ToString();

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$expected"];
                                        strategy.Expected = bool.Parse(jsObj2["$t"].ToString());

                                        jsObj2 = (Newtonsoft.Json.JavaScriptObject)objCurrent["gsx$adminallowed"];
                                        strategy.AdminAllowed = bool.Parse(jsObj2["$t"].ToString());

                                        listStrategy.Add(strategy);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }

            MatchDTO match = new MatchDTO();
            match.HomeTeamName = "Man U";
            match.AwayTeamName = "Chelsea";
            match.AwayScore = "2";
            match.HomeScore = "1";
            match.Minute = 34;

            OddDTO odd = new OddDTO();            
            odd.Home = 0.95f;
            odd.Away = 0.95f;
            odd.Type = eOddType.FulltimeOverUnder;

            match.Odds = new List<OddDTO>();
            match.Odds.Add(odd);            
            
            foreach (Strategy st in listStrategy)
            {
                if (st.AdminAllowed == true && st.StepID != 100)
                {
                    if (st.Obj == "Odd")
                    {
                        foreach (OddDTO o in match.Odds)
                        {
                            if (st.ValueToCompare == "Odd.Away")
                                st.Result = Operator.Apply(o, st.Operator, st.Field, o.Away);
                            else
                                st.Result = Operator.Apply(o, st.Operator, st.Field, st.ValueToCompare);
                            if (st.Result == st.Expected)
                                break;
                        }
                    }
                    else if (st.Obj == "Match")
                    {
                        st.Result = Operator.Apply(match, st.Operator, st.Field, st.ValueToCompare);
                    }
                }
                if (st.Result == true)
                {
                    iBet.Utilities.WriteLog.Write(st.Name + " step " + st.StepID.ToString() + ": checking " + st.Obj + "." + st.Field
                        + " " + st.Operator + " " + st.ValueToCompare + " >>> RESULT: " +
                        st.Result.ToString());
                }
                else
                {
                    iBet.Utilities.WriteLog.Write(st.Name + " step " + st.StepID.ToString() + ": checking " + st.Obj + "." + st.Field
                        + " " + st.Operator + " " + st.ValueToCompare + " >>> RESULT: " +
                        st.Result.ToString());
                }
            }
        }
コード例 #10
0
		private TransactionDTO PlaceBet(
            MatchDTO ibetMatch,
            MatchDTO threein1betMatch,
            eOddType oddType,
            string ibetOddID,
            string ibetOddType,
            string ibetOddValue,
            OddDTO threein1Odd,
            string threein1OddType,
            int ibetStake,
            int threein1betStake,
            IBetEngine ibetEngine,
            ThreeIn1BetEngine threein1betEngine)
		{
			TransactionDTO transactionDTO = new TransactionDTO();
            string text = string.Empty;
            string text2 = string.Empty;
            string text3 = string.Empty;
			bool flag = false;
			bool flag2 = false;
			int num = 0;
			int num2 = 0;
            string text4 = string.Empty;
            string text5 = string.Empty;
            string text6 = string.Empty;
			bool flag3 = false;
			bool flag4 = false;
			bool sBOBETReTrade = false;
			int num3 = 0;
            
            string text7 = string.Empty;
            string betCount = string.Empty;
            
            string text8 = string.Empty;
			

            bool threein1betAllowance = false;
            int threein1betminStake = 0;
            int threein1betmaxStake = 0;
            string threein1betKindValue = string.Empty;
            string threein1betHomeTeamName = string.Empty;
            string threein1betAwayTeamName = string.Empty;
            string postBODY = string.Empty;  

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), threein1betMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), threein1betMatch.AwayTeamName.ToLower()))
			{
				try
				{
					ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), out flag, out num, out num2, out text4, out text2, out text3);
                    threein1betEngine.PrepareBet(threein1Odd.ID, threein1Odd.Away.ToString(), threein1Odd.Type.ToString().Replace("FulltimeHandicap", "Hdp").Replace("", ""), "Away", threein1Odd.IsHomeGive.ToString().Replace("True", "1").Replace("False", "0"), threein1Odd.Odd, threein1betMatch.HomeScore, threein1betMatch.AwayScore, threein1betMatch.ID, threein1betMatch.IsHalfTime.ToString().Replace("True", "1").Replace("False", "0"), threein1betStake.ToString(),
                        out threein1betAllowance, out threein1betminStake, out threein1betmaxStake, out threein1betKindValue, out threein1betHomeTeamName, out threein1betAwayTeamName, out postBODY);
                    
                    if (MatchDTO.IsSameMatch(text2, text5, text3, text6))
					{
						if (flag && flag3)
						{
							float num4 = float.Parse(text4);
							float num5 = float.Parse(text7);
							if (num4 + num5 == 0f || num4 == num5)
							{
								if (ibetStake <= num2 && threein1betStake <= num3)
								{
									try
									{
										float currentCredit = ibetEngine.GetCurrentCredit();
                                        float currentCredit2 = threein1betEngine.GetCurrentCredit();
										if ((float)ibetStake <= currentCredit && (float)threein1betStake <= currentCredit2)
										{
											try
											{
												ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), num.ToString(), num2.ToString(), out flag2);
												if (flag2)
												{
                                                    //threeIn1BetEngine.ConfirmBet(oddType,
                                                    //    threein1betOddValue,
                                                    //    threein1betStake.ToString(), 
                                                    //    betCount, 
                                                    //    text8, 
                                                    //    out flag4);
													if (!flag4)
													{
														try
														{
                                                            //
														}
														catch (System.Exception ex)
														{
															text = "Error while Retrade. Details: " + ex.Message;
														}
													}
													this._lastTransactionTime = System.DateTime.Now;
													object obj = text;
													text = string.Concat(new object[]
													{
														obj, 
														" - Success Transaction. Half: ", 
														ibetMatch.Half, 
														" - Minute: ", 
														ibetMatch.Minute, 
														" - Halftime: ", 
														ibetMatch.IsHalfTime
													});
												}
											}
											catch (System.Exception ex)
											{
												text = "Error while Trading. Details: " + ex.Message;
											}
										}
										else
										{
											text = string.Concat(new object[]
											{
												"Out of Cash. IBET Credit: ", 
												currentCredit, 
												" -  3in1BET Credit: ", 
												currentCredit2
											});
										}
									}
									catch (System.Exception ex)
									{
										text = "Error while getting Credit. Details: " + ex.Message;
									}
								}
								else
								{
									text = string.Concat(new object[]
									{
										"Max Bet. IBET: ", 
										num2, 
										" - 3in1BET: ", 
										num3
									});
								}
							}
							else
							{
								text = "Invalid Odd while Preparing Ticket. IBET Odd: " + text4 + " - 3in1BET Odd:" + text7;
							}
						}
					}
					else
					{
						text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							text2, 
							" / ", 
							text3, 
							" - 3in1BET: ", 
							text5, 
							" / ", 
							text6
						});
					}
				}
				catch (System.Exception ex)
				{
					text = "Error while Preparing Trade. Details: " + ex.Message;
				}
			}
			else
			{
				text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - 3in1BET: ", 
					threein1betMatch.HomeTeamName, 
					" / ", 
					threein1betMatch.AwayTeamName
				});
			}
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + " / " + threein1betMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + " / " + threein1betMatch.AwayTeamName;
			transactionDTO.Odd = text4 + " / " + text7;
			transactionDTO.OddKindValue = text4 + " / " + text7;
			transactionDTO.OddValue = ibetOddValue + " / " + threein1Odd.Away;
			transactionDTO.Stake = ibetStake + " / " + threein1betStake;
			transactionDTO.IBETAllow = flag;
			transactionDTO.IBETTrade = flag2;
			transactionDTO.IBETReTrade = false;
			transactionDTO.THREEIN1Allow = flag3;
			transactionDTO.THREEIN1Trade = flag4;
			transactionDTO.THREEIN1ReTrade = sBOBETReTrade;
			transactionDTO.OddType = oddType.ToString();
			transactionDTO.Note = text;
			transactionDTO.DateTime = System.DateTime.Now;
			return transactionDTO;
		}
コード例 #11
0
        private TransactionDTO PlaceBet(bool sendOrNOT, MatchDTO ibetMatch, MatchDTO sbobetMatch, eOddType oddType, string ibetOddID, string sbobetOddID, string ibetOddType, string sbobetOddType, string ibetOddValue, string sbobetOddValue, int ibetStake, int sbobetStake, IBetEngine ibetEngine, SbobetEngine sbobetEngine, string sbobetOdd, bool ibetHomeGive)
        {
            this._betting = true;
            TransactionDTO transactionDTO = new TransactionDTO();
            //transactionDTO.OddType = oddType.ToString() + " - " + ibetOddType.Replace("h", "Home").Replace("a", "Away") + " / " + sbobetOddType.Replace("h", "Home").Replace("a", "Away");
            string text = "";
            string text2 = "";
            string text3 = "";
            bool flag = false;
            bool flag2 = false;
            int num = 0;
            int num2 = 0;
            string text4 = "";
            string text5 = "";
            string text6 = "";
            bool flag3 = false;
            bool flag4 = false;
            bool sBOBETReTrade = false;
            int num3 = 0;
            string text7 = "";
            string betCount = "";
            string text8 = "";
            bool flag5 = false;

            float ibetOddValue_ = float.Parse(ibetOddValue);
            float sboOddValue_ = float.Parse(sbobetOddValue);

            if (ibetOddValue_ > 0.84 || (ibetOddValue_ > 0f && txtAddValue.Value.ToString() == "0.01"))
            {
                float valueAdd = ibetStake * (float)txtAddValue.Value;
                ibetStake = ibetStake + (int)valueAdd;
            }
            if (sboOddValue_ > 0.84 || (sboOddValue_ > 0f && txtAddValue.Value.ToString() == "0.01"))
            {
                float valueAdd = sbobetStake * (float)txtAddValue.Value;
                sbobetStake = sbobetStake + (int)valueAdd;
            }

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), sbobetMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), sbobetMatch.AwayTeamName.ToLower()))
            {
                try
                {
                    ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), out flag, out num, out num2, out text4, out text2, out text3);
                    sbobetEngine.PrepareBet(sbobetOddID, sbobetOddValue, sbobetOddType, out betCount, out num3, out flag3, out text7, out text5, out text6);
                    if (MatchDTO.IsSameMatch(text2, text5, text3, text6))
                    {
                        if (flag && flag3)
                        {
                            if ((checkEdit13.Checked || checkEdit15.Checked) && sendOrNOT)//gui lenh
                            {
                                var taskA = new Task(() => this.AddOddToLocalCommunity(ibetMatch, sbobetMatch, oddType, sbobetOdd, sbobetOdd, ibetOddType, sbobetOddType, ibetOddValue, sbobetOddValue, ibetHomeGive));
                                taskA.Start();
                            }
                            float num4 = float.Parse(text4);
                            float num5 = float.Parse(text7);
                            if (num4 + num5 == 0f || num4 == num5)
                            {
                                if (ibetStake <= num2 && sbobetStake <= num3)
                                {
                                    try
                                    {                                        
                                        float currentCredit = 0;
                                        float currentCredit2 = 0;
                                        if (checkEdit8.Checked)
                                        {
                                            currentCredit = ibetEngine.GetCurrentCredit();
                                            currentCredit2 = sbobetEngine.GetCurrentCredit();
                                        }
                                        else
                                        {
                                            currentCredit = ibetEngine._currentCredit;
                                            currentCredit2 = sbobetEngine._currentCredit;
                                        }

                                        if ((float)ibetStake <= currentCredit && (float)sbobetStake <= currentCredit2)
                                        {
                                            try
                                            {
                                                
                                                ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), num.ToString(), num2.ToString(), out flag2);
                                                if (flag2)
                                                {
                                                    sbobetEngine.ConfirmBet(sbobetOddID, sbobetOddValue, sbobetOddType, sbobetStake.ToString(), betCount, out text8, out flag4);
                                                    if (!flag4)
                                                    {
                                                        try
                                                        {
                                                            sbobetEngine.PrepareBet(sbobetOddID, text8, sbobetOddType, out betCount, out num3, out flag5, out text7, out text5, out text6);
                                                            if (MatchDTO.IsSameMatch(text2, text5, text3, text6))
                                                            {
                                                                num5 = float.Parse(text7);
                                                                if (num4 + num5 == 0f || num4 == num5)
                                                                {
                                                                    text = "Retrade. IBET: " + ibetOddValue + " -  SBOBET: " + text8;
                                                                    sbobetEngine.ConfirmBet(sbobetOddID, text8, sbobetOddType, sbobetStake.ToString(), betCount, out text8, out sBOBETReTrade);
                                                                    this._lastTransactionTime = System.DateTime.Now;
                                                                }
                                                                else
                                                                {
                                                                    text = "Invalid Odd while Retrade. IBET Odd: " + text4 + " - SBOBET Odd:" + text7;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                text = string.Concat(new string[]
																{
																	"Not Same Match - Retrade. IBET: ", 
																	text2, 
																	" / ", 
																	text3, 
																	" - SBOBET: ", 
																	text5, 
																	" / ", 
																	text6
																});
                                                            }
                                                        }
                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                        }
                                                    }
                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
													{
														obj, 
														" - Success Transaction. Half: ", 
														ibetMatch.Half, 
														" - Minute: ", 
														ibetMatch.Minute, 
														" - Halftime: ", 
														ibetMatch.IsHalfTime
													});
                                                }
                                                
                                            }
                                            catch (System.Exception ex)
                                            {
                                                text = "Error while Trading. Details: " + ex.Message;
                                            }
                                        }
                                        else
                                        {
                                            text = string.Concat(new object[]
											{
												"Out of Cash. IBET Credit: ", 
												currentCredit, 
												" -  SBOBET Credit: ", 
												currentCredit2
											});
                                        }
                                    }
                                    catch (System.Exception ex)
                                    {
                                        text = "Error while getting Credit. Details: " + ex.Message;
                                    }
                                }
                                else
                                {
                                    text = string.Concat(new object[]
									{
										"Max Bet. IBET: ", 
										num2, 
										" - SBOBET: ", 
										num3
									});
                                }
                            }
                            else
                            {
                                text = "Invalid Odd while Preparing Ticket. IBET Odd: " + text4 + " - SBOBET Odd:" + text7;
                            }
                        }
                    }
                    else
                    {
                        text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							text2, 
							" / ", 
							text3, 
							" - SBOBET: ", 
							text5, 
							" / ", 
							text6
						});
                    }
                }
                catch (System.Exception ex)
                {
                    text = "Error while Preparing Trade. Details: " + ex.Message;
                }
            }
            else
            {
                text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - SBOBET: ", 
					sbobetMatch.HomeTeamName, 
					" / ", 
					sbobetMatch.AwayTeamName
				});
            }
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + " / " + sbobetMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + " / " + sbobetMatch.AwayTeamName;
            transactionDTO.Odd = text4 + " / " + text7;
            transactionDTO.OddKindValue = text4 + " / " + text7;
            transactionDTO.OddValue = ibetOddValue + " / " + sbobetOddValue;
            transactionDTO.Stake = ibetStake + " / " + sbobetStake;
            transactionDTO.IBETAllow = flag;
            transactionDTO.IBETTrade = flag2;
            transactionDTO.IBETReTrade = false;
            transactionDTO.SBOBETAllow = flag3;
            transactionDTO.SBOBETTrade = flag4;
            transactionDTO.SBOBETReTrade = sBOBETReTrade;
            transactionDTO.OddType = oddType.ToString();
            transactionDTO.Note = text;
            transactionDTO.DateTime = System.DateTime.Now;
            transactionDTO.OddType = oddType.ToString() + " - " + ibetOddType.Replace("h", "Home").Replace("a", "Away") + " / " + sbobetOddType.Replace("h", "Home").Replace("a", "Away");
            this._betting = false;
            return transactionDTO;
            
        }
コード例 #12
0
 private static object GetPropValue(MatchDTO match, string prop)
 {
     PropertyInfo propInfo = m_properties[prop];
     return propInfo.GetGetMethod(false).Invoke(match, null);
 }
コード例 #13
0
		private TransactionDTO PlaceBetAllowMaxBet(
            MatchDTO ibetMatch, 
            MatchDTO threein1betMatch, 
            eOddType oddType, 
            string ibetOddID,
            string ibetOddType,             
            string ibetOddValue, 
            OddDTO threein1Odd,
            string threein1OddType,
            int ibetStake, 
            int threein1betStake, 
            IBetEngine ibetEngine, 
            ThreeIn1BetEngine threein1betEngine)
		{
            
			TransactionDTO transactionDTO = new TransactionDTO(); //khoi tao transaction
            string text = string.Empty;			
            bool flagIBETOK = false;
            bool flag3IN1OK = false;
			
			bool threein1ReTrade = false;            
            string betCount = string.Empty;
            
            bool flagibetAllowance = false;
            int ibetminStake = 0;
            int ibetmaxStake = 0;
            string ibetBetKindValue = string.Empty;
            string ibetHomeTeamName = string.Empty;
            string ibetAwayTeamNam = string.Empty;

            bool ibetGoFirst = true;// who is Away or Under
            string threein1OddValue = string.Empty;
            if (threein1OddType == "Away") //neu 3in1 o vi tri away
            {
                threein1OddValue = threein1Odd.Away.ToString();
                if (threein1Odd.Type == eOddType.FirstHalfOverUnder || threein1Odd.Type == eOddType.FulltimeOverUnder) //neu 3in1 la Under
                {
                    ibetGoFirst = false; // cho 3in1 Confirm truoc
                }
                else // bong handicap
                {
                    if (threein1Odd.IsHomeGive) // neu away la doi cua duoi
                    {
                        ibetGoFirst = false;
                    }
                }
            }
            else if (threein1OddType == "Home") // neu 3in1 o vi tri home - ibet away
            {
                threein1OddValue = threein1Odd.Home.ToString();
                if (threein1Odd.Type == eOddType.FirstHalfOverUnder || threein1Odd.Type == eOddType.FulltimeOverUnder) //neu 3in1 la Over
                {
                    ibetGoFirst = true; // cho ibet Confirm truoc (under)
                }
                else // bong handicap
                {
                    if (!threein1Odd.IsHomeGive) // neu 3in1 la doi cua duoi
                    {
                        ibetGoFirst = false;
                    }
                }
            }

            bool flagthreein1betAllowance = false;
            int threein1betminStake = 0;
            int threein1betmaxStake = 0;
            string threein1betKindValue = string.Empty;
            string threein1betHomeTeamName = string.Empty;
            string threein1betAwayTeamName = string.Empty;
            
            string postBODY = string.Empty;            

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), threein1betMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), threein1betMatch.AwayTeamName.ToLower()))
			{
				try
				{
                    ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), 
                        out flagibetAllowance, out ibetminStake, out ibetmaxStake, out ibetBetKindValue, out ibetHomeTeamName, out ibetAwayTeamNam);
                    
                    threein1betEngine.PrepareBet(
                        threein1Odd.ID,
                        threein1OddValue,//odd price
                        threein1Odd.Type.ToString(), 
                        threein1OddType, // "Away"
                        threein1Odd.IsHomeGive.ToString().Replace("True", "1").Replace("False", "0"),
                        threein1Odd.Odd, 
                        threein1betMatch.HomeScore, 
                        threein1betMatch.AwayScore, 
                        threein1betMatch.ID, 
                        threein1betMatch.IsHalfTime.ToString().Replace("True", "1").Replace("False", "0"), 
                        threein1betStake.ToString(),
                        out flagthreein1betAllowance, 
                        out threein1betminStake, 
                        out threein1betmaxStake, 
                        out threein1betKindValue, 
                        out threein1betHomeTeamName, 
                        out threein1betAwayTeamName,
                        out postBODY);
#if DEBUG
                    Utilities.WriteLog.Write("Calling threein1betEngine.PrepareBet");
#endif

                    if (MatchDTO.IsSameMatch(ibetHomeTeamName, threein1betHomeTeamName, ibetAwayTeamNam, threein1betAwayTeamName))
                    {
                        if (flagibetAllowance && flagthreein1betAllowance)
                        {
                            float numIbet = float.Parse(ibetBetKindValue);
                            float num3in1bet = float.Parse(threein1betKindValue);

                            if (numIbet + num3in1bet == 0f || numIbet == num3in1bet)
                            {
#if DEBUG
                                Utilities.WriteLog.Write("+ Valid bet, system is now going to confirm:" + ibetHomeTeamName + " - " + threein1betAwayTeamName);
#endif
                                int numMax = 0; // get minimum of Maximum bet allowed of two system
                                if (ibetmaxStake >= threein1betmaxStake)
                                {
                                    numMax = threein1betmaxStake;                                    
                                }
                                else
                                {
                                    numMax = ibetmaxStake;
                                }

                                if (ibetStake >= numMax) //compare stake with numMax
                                {
                                    ibetStake = numMax;
                                }
                                if (threein1betStake >= numMax)
                                {
                                    threein1betStake = numMax;
                                }

                                try
                                {
                                    float currentCredit = 0;
                                    float currentCredit2 = 0;
                                    if (checkEdit8.Checked)
                                    {
                                        currentCredit = ibetEngine.GetCurrentCredit();
                                        currentCredit2 = threein1betEngine.GetCurrentCredit();
                                    }
                                    else
                                    {
                                        currentCredit = ibetEngine._currentCredit;
                                        currentCredit2 = threein1betEngine._currentCredit;
                                    }
                                    
                                    
                                    if ((float)ibetStake <= currentCredit && (float)threein1betStake <= currentCredit2)
                                    {
                                        if (ibetGoFirst)
                                        {
                                            #region Confirm_IBET_first_then_3in1
#if DEBUG
                                            Utilities.WriteLog.Write("IBET GO FIRST!");
#endif
                                            try
                                            {
                                                ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), ibetminStake.ToString(), ibetmaxStake.ToString(), out flagIBETOK);
                                                if (flagIBETOK)// iBet Confirm thanh cong
                                                {
                                                    string odd3in1NEW = string.Empty;
                                                    threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                    if (!flag3IN1OK)
                                                    {
                                                        try
                                                        {
                                                            if (odd3in1NEW != "changed")
                                                            {
                                                                //threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                                this._lastTransactionTime = System.DateTime.Now;
                                                                playSound(false);
                                                                text = "Odd 3in1 changed";
                                                                this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                                
                                                            }
                                                            else
                                                            {
                                                                text = "Invalid Odd while Retrade.";// IBET Odd: " +text4 + " - SBOBET Odd:" + text7;
                                                                this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                                playSound(false);
                                                            }
                                                        }
                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                            playSound(false);

#if DEBUG
                                                            Utilities.WriteLog.Write(text);
#endif
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.lbl3in1betCurrentCredit.Caption = this._3in1Engine.GetCurrentCredit().ToString();
                                                        this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                        playSound(true);
                                                    }
                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
												    {
													    obj, 
													    " - Success Transaction. Half: ", 
													    ibetMatch.Half, 
													    " - Minute: ", 
													    ibetMatch.Minute, 
													    " - Halftime: ", 
													    ibetMatch.IsHalfTime
												    });                                                    
                                                }
                                            }
                                            catch (System.Exception ex)
                                            {
                                                text = "Error while Trading. Details: " + ex.Message;
#if DEBUG
                                                Utilities.WriteLog.Write(text);
#endif
                                            }
                                            #endregion
                                        }
                                        else
                                        {
                                            #region Confirm_3in1_first_then_IBET
#if DEBUG
                                            Utilities.WriteLog.Write("3IN1BET GO FIRST!");
#endif
                                            try
                                            {
                                                string odd3in1NEW = string.Empty;
                                                threein1betEngine.ConfirmBet(postBODY, threein1betStake.ToString(), out flag3IN1OK, out odd3in1NEW);
                                                if (flag3IN1OK)
                                                {
                                                    ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), ibetminStake.ToString(), ibetmaxStake.ToString(), out flagIBETOK);
                                                    if (!flagIBETOK)// iBet Confirm thanh cong
                                                    {
                                                        try
                                                        {
                                                            playSound(false);
#if DEBUG
                                                            Utilities.WriteLog.Write("iBet confirm failed.");
#endif
                                                        }

                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                            playSound(false);
#if DEBUG
                                                            Utilities.WriteLog.Write(text);
#endif
                                                        }
                                                    }
                                                    else
                                                    {
                                                        this.lbl3in1betCurrentCredit.Caption = this._3in1Engine.GetCurrentCredit().ToString();
                                                        this.lblIbetCurrentCredit.Caption = this._ibetEngine.GetCurrentCredit().ToString();
                                                        playSound(true);
                                                    }
                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
												    {
													    obj, 
													    " - Success Transaction. Half: ", 
													    ibetMatch.Half, 
													    " - Minute: ", 
													    ibetMatch.Minute, 
													    " - Halftime: ", 
													    ibetMatch.IsHalfTime
												    });
                                                }
                                            }
                                            catch (System.Exception ex)
                                            {
                                                text = "Error while Trading. Details: " + ex.Message;
#if DEBUG
                                                Utilities.WriteLog.Write(text);
#endif
                                            }
                                            #endregion
                                        }
                                    }
                                    else
                                    {
                                        text = string.Concat(new object[]
										{
											"Out of Cash. IBET Credit: ", 
											currentCredit, 
											" -  SBOBET Credit: ", 
											currentCredit2
										});
#if DEBUG
                                        Utilities.WriteLog.Write(text);
#endif
                                    }
                                }
                                catch (System.Exception ex)
                                {
                                    text = "Error while getting Credit. Details: " + ex.Message;
#if DEBUG
                                    Utilities.WriteLog.Write(text);
#endif
                                }



                            }
                            else
                            {
                                text = "Invalid Odd while Preparing Ticket. IBET Odd: " + ibetBetKindValue + " - SBOBET Odd:" + threein1betKindValue;
#if DEBUG
                                Utilities.WriteLog.Write(text);
#endif
                            }
                        }
                        else
                        { 
#if DEBUG
                            if (!flagibetAllowance)
                                Utilities.WriteLog.Write("IBET DIDN'T ALLOW");
                            if (!flagthreein1betAllowance)
                                Utilities.WriteLog.Write("3IN1 DIDN'T ALLOW");
#endif

                        }
                    }

                    else
                    {
                        text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							ibetHomeTeamName, 
							" / ", 
							ibetAwayTeamNam, 
							" - 3in1BET: ", 
							threein1betHomeTeamName, 
							" / ", 
							threein1betAwayTeamName
						});
#if DEBUG
                        Utilities.WriteLog.Write(text);
#endif
                    }

                        
				}
				catch (System.Exception ex)
				{
					text = "Error while Preparing Trade. Details: " + ex.Message;
#if DEBUG
                    WriteLog.Write(" *** " + text);
#endif 
				}
			}
			else
			{
				text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - 3in1BET: ", 
					threein1betMatch.HomeTeamName, 
					" / ", 
					threein1betMatch.AwayTeamName
				});
			}
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + " / " + threein1betMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + " / " + threein1betMatch.AwayTeamName;
            transactionDTO.Odd = ibetBetKindValue + " / " + threein1betKindValue;
			transactionDTO.OddKindValue = ibetBetKindValue + " / " + threein1betKindValue;
            transactionDTO.OddValue = ibetOddValue + " / " + threein1OddValue;
			transactionDTO.Stake = ibetStake + " / " + threein1betStake;
			transactionDTO.IBETAllow = flagibetAllowance;
            transactionDTO.IBETTrade = flagIBETOK;
			transactionDTO.IBETReTrade = false;
            transactionDTO.THREEIN1Allow = flagthreein1betAllowance;
            transactionDTO.THREEIN1Trade = flag3IN1OK;
			transactionDTO.THREEIN1ReTrade = threein1ReTrade;
			transactionDTO.OddType = oddType.ToString();
			transactionDTO.Note = text;
			transactionDTO.DateTime = System.DateTime.Now;
			return transactionDTO;
		}
コード例 #14
0
 public static bool Apply(MatchDTO match, string op, string prop, object target)
 {
     return s_operators[op](GetPropValue(match, prop), target);
 }
コード例 #15
0
        private TransactionDTO PlaceSingleIBET(MatchDTO ibetMatch, string odd, string oddValue, eOddType oddType, string ibetOddType, string stake, string homeScore, string awayScore, IBetEngine ibetEngine, bool followtype, string followref, string accountName)
        {
            this._betting = true;
            TransactionDTO transactionDTO = new TransactionDTO();
            string following = string.Empty;
            if (followtype)
                following = "following";
            else
                following = "unfollowing";

            string betKindValue = string.Empty;
            string homeTeamName = string.Empty;
            string awayTeamName = string.Empty;
            string newOddValue = string.Empty;
            string newHomeScore = string.Empty;
            string newAwayScore = string.Empty;

            bool flag = false;
            bool flag2 = false;
            string text = string.Empty;

            System.Collections.Generic.List<MatchDTO> listIbetMatch = this._listIBETMatch;
            //MatchDTO matchDTO = MatchDTO.SearchMatchFull(ibetMatch, listIbetMatch);
            if (ibetMatch != null && ibetMatch.HomeTeamName != string.Empty)
            {
                OddDTO oddDTO = OddDTO.SearchOdd(oddType, odd, true, ibetMatch.Odds);
                if (oddDTO != null)
                {
                    string ibetOddNow = string.Empty;
                    if (ibetOddType == "a")
                        ibetOddNow = oddDTO.Away.ToString();
                    else
                        ibetOddNow = oddDTO.Home.ToString();
                    if (followtype || (!followtype && ((float.Parse(ibetOddNow) >= (float)txtLowestOddValue.Value && float.Parse(ibetOddNow) > 0)) || float.Parse(ibetOddNow) < 0))
                    {
                        int maxBet = 0;
                        int minBet = 0;
                        string ibetOddID = oddDTO.ID;
                        try
                        {
                            ibetEngine.PrepareBet2(ibetOddID, ibetOddType, ibetOddNow.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                            if (homeTeamName == ibetMatch.HomeTeamName)
                            {
                                if (newHomeScore == homeScore && newAwayScore == awayScore)
                                {
                                    float num1 = float.Parse(odd);
                                    float num2 = float.Parse(betKindValue);
                                    if (num1 + num2 == 0f || num1 == num2)
                                    {
                                        if (int.Parse(stake) > maxBet)
                                            stake = maxBet.ToString();

                                        float newIbetOddValue = float.Parse(newOddValue);
                                        float oldIbetOddValue = float.Parse(oddValue);

                                        //if (OddDTO.IsValidOddPair(newIbetOddValue, oldIbetOddValue, (float)txtAllowTradeMinValue.Value, true))
                                        //{
                                        ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                        if (!flag2)
                                        {
                                            //this._lastTransactionTime = System.DateTime.Now;
                                            //SendReportToMainForm("- Follow Bet: " + this._ibetAccount + " >> " + matchDTO.HomeTeamName + " - " + matchDTO.AwayTeamName + ": Bet confirmed failed. ");
                                            text = "Confirm bet failed";
                                        }
                                        else
                                        {
                                            this._lastTransactionTime = DateTime.Now;
                                            text = " - Success " + following + " " + this._ibetSubAccount + ". Follow: " + ibetOddType + " > " + accountName;
                                        }
                                        //}
                                        //else
                                        //{
                                        //    SendReportToMainForm("Follow Bet: " + this._ibetAccount + " >> " + matchDTO.HomeTeamName + " - " + matchDTO.AwayTeamName + ": New odd value: " + newOddValue + " is lower than allowed number ");
                                        //}
                                    }
                                    else
                                        text = "Invalid Odd while Preparing Ticket. IBET Odd: " + betKindValue;
                                }
                                else
                                {
                                    text = "Score changed.";
                                }
                            }
                            else
                            {
                                text = "Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                            }
                        }
                        catch (Exception ex)
                        {
                            text = ex.Message;
                        }
                    }
                    else
                    {
                        text = "Odd value is smaller than lowest accepted:" + ibetOddNow;
                    }
                }
                else
                {
                    string text2 = string.Empty;
                    //foreach (OddDTO o in ibetMatch.Odds)
                    //{
                    //    text2 += o.Odd + ","; 
                    //}
                    text = "Odd not found.";
                }
            }
            else
                text = "Match not found ";


            transactionDTO.HomeTeamName = homeTeamName;
            transactionDTO.AwayTeamName = awayTeamName;
            transactionDTO.HomeScore = homeScore;
            transactionDTO.AwayScore = awayScore;
            transactionDTO.Score = homeScore + "-" + awayScore;
            transactionDTO.AccountPair = this._ibetAccount + " - " + this._ibetSubAccount;
            transactionDTO.OddType = oddType.ToString();
            transactionDTO.Odd = betKindValue;
            transactionDTO.OddKindValue = betKindValue;
            transactionDTO.OddValue = newOddValue;
            transactionDTO.Stake = stake;
            transactionDTO.Note = text;
            transactionDTO.IBETTrade = flag2;
            transactionDTO.IBETAllow = flag;
            transactionDTO.IsFollowTypeTrans = true;
            transactionDTO.DateTime = DateTime.Now;
            transactionDTO.FollowRef = followref;

            this._betting = false;
            return transactionDTO;
        }
コード例 #16
0
        internal bool ReleaseWaitingBet(TransactionDTO tran)
        {
            bool status = false;
            if (this._running)
            {
                eOddType oddtype;
                string ibetOddType = string.Empty;
                if (tran.OddType.StartsWith("FulltimeOverUnder"))
                    oddtype = eOddType.FulltimeOverUnder;
                else if (tran.OddType.StartsWith("FirstHalfOverUnder"))
                    oddtype = eOddType.FirstHalfOverUnder;
                else if (tran.OddType.StartsWith("FulltimeHandicap"))
                    oddtype = eOddType.FulltimeHandicap;
                else if (tran.OddType.StartsWith("FirstHalfHandicap"))
                    oddtype = eOddType.FirstHalfHandicap;
                else if (tran.OddType.StartsWith("FT"))
                    oddtype = eOddType.FT;
                else if (tran.OddType.StartsWith("HT"))
                    oddtype = eOddType.HT;
                else
                    oddtype = eOddType.Unknown;

                MatchDTO matchDTO = new MatchDTO();
                matchDTO.HomeTeamName = tran.HomeTeamName;
                matchDTO.AwayTeamName = tran.AwayTeamName;
                matchDTO.League = new LeagueDTO();
                matchDTO.League.Name = tran.League;

                if (oddtype != eOddType.HT && oddtype != eOddType.FT)
                {
                    if (chkFollowType.Checked)
                    {
                        if (tran.HomePick)
                            ibetOddType = "h";
                        else
                            ibetOddType = "a";
                    }
                    else
                    {
                        if (tran.HomePick)
                            ibetOddType = "a";
                        else
                            ibetOddType = "h";
                    }
                    //return PlaceSingleIBET(matchDTO, tran.Odd, tran.OddValue, oddtype, ibetOddType, tran.Stake, tran.HomeScore, tran.AwayScore, this._ibetEngine);
                }
                else
                {
                    if (chkFollowType.Checked)
                    {
                        ibetOddType = tran.FT1X2Pick;
                        //return PlaceSingleIBET(matchDTO, tran.Odd, tran.OddValue, oddtype, ibetOddType, tran.Stake, tran.HomeScore, tran.AwayScore, this._ibetEngine);
                    }
                }
            }

            return status;
        }
コード例 #17
0
 private void TransactionProcess(MatchDTO ibetMatch, MatchDTO sbobetMatch, eOddType oddType, string ibetOddID, string sbobetOddID, string ibetOddType, string sbobetOddType, string ibetOddValue, string sbobetOddValue, int ibetStake, int sbobetStake, IBetEngine ibetEngine, SbobetEngine sbobetEngine, string sbobetOdd, bool homeFavor)
 {
     if (!this._betting)
     {
         TransactionDTO transactionDTO = new TransactionDTO();
         transactionDTO = this.PlaceBet(true, ibetMatch, sbobetMatch, oddType, ibetOddID, sbobetOddID, ibetOddType, sbobetOddType, ibetOddValue, sbobetOddValue.ToString(), ibetStake, sbobetStake, this._ibetEngine, this._sbobetEngine, sbobetOdd, homeFavor);
         this.AddTransaction(transactionDTO);
         if (transactionDTO != null && transactionDTO.IBETTrade)
         {
             this.UpdateOddBetHistory(ibetOddID,"");
         }
     }
 }
コード例 #18
0
 private void AddOddToLocalCommunity(MatchDTO ibetmatch, MatchDTO sbobetmatch, eOddType oddtype, string ibetodd, string sbobetodd, string ibetoddType, string sbobetoddType, string ibetoddValue, string sbobetoddValue, bool homeFavor)
 {
     this._mainForm.AddLocalValidOdd(this._ibetAccount, ibetmatch, sbobetmatch, oddtype, ibetodd, sbobetodd, ibetoddType, sbobetoddType, ibetoddValue, sbobetoddValue, homeFavor);
     if (this._mainForm.chkSCloud.Checked)
         this._mainForm.AddOddToClound(this._ibetAccount, ibetmatch, sbobetmatch, oddtype, ibetodd, sbobetodd, ibetoddType, sbobetoddType, ibetoddValue, sbobetoddValue, homeFavor);
 }
コード例 #19
0
        private TransactionDTO PlaceSingleIBET(string BetStrategy, string oddPrice, MatchDTO ibetMatch, string oddID, string oddValue, eOddType oddType, string ibetOddType, string stake, string homeScore, string awayScore, IBetEngine ibetEngine, bool followtype, string followref, string accountName)
        {
            this._betting = true;
            TransactionDTO transactionDTO = new TransactionDTO();
            string acctoScan = "";
            List<Bet> bl;
            string RefID = "";
            if (BetStrategy.Contains("Over15_XA"))
            {
                bl = this._ibetEngine.ibetAgent2.betList;
                acctoScan = this._ibetEngine.ibetAgent2.Config.Account;
                string[] array = BetStrategy.Split(new string[] { "Ref ID:" }, System.StringSplitOptions.None);
                RefID = array[1];
                if (!AllowOddBet(RefID + ibetOddType, ibetOddType))
                {
                    transactionDTO.HomeTeamName = ibetMatch.HomeTeamName;
                    transactionDTO.AwayTeamName = ibetMatch.AwayTeamName;
                    transactionDTO.Note = "Under account: " + acctoScan + " just bet on this odd";
                    transactionDTO.DateTime = DateTime.Now;
                    this._betting = false;
                    return transactionDTO;
                }
            }            
            else
            {
                bl = this._ibetEngine.ibetAgent.betList;
                acctoScan = this._ibetEngine.ibetAgent.Config.Account;
            }
            if (BetStrategy.Contains("Warning"))
            {
                transactionDTO.HomeTeamName = ibetMatch.HomeTeamName;
                transactionDTO.AwayTeamName = ibetMatch.AwayTeamName;
                transactionDTO.Note = BetStrategy;
                transactionDTO.DateTime = DateTime.Now;
                this._betting = false;
                return transactionDTO;
            }
            foreach (Bet bet in bl)
            {
                if (bet.Home == ibetMatch.HomeTeamName)
                {                    
                    if (bet.Handicap == decimal.Parse(oddValue))
                    {
                        if (bet.Choice.ToString().ToLower() == ibetOddType)
                        {
                            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName;
                            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName;
                            transactionDTO.Note = acctoScan + " : Bet list contains this odd already";
                            transactionDTO.DateTime = DateTime.Now;
                            this._betting = false;
                            return transactionDTO;
                        }
                    }                    
                }
            }
            if (!AllowOddBet(oddID + ibetOddType,ibetOddType))
            {
                transactionDTO.HomeTeamName = ibetMatch.HomeTeamName;
                transactionDTO.AwayTeamName = ibetMatch.AwayTeamName;
                transactionDTO.Note = acctoScan + " just bet on this odd";
                transactionDTO.DateTime = DateTime.Now;
                this._betting = false;
                return transactionDTO;
            }
            if (this._ibetEngine.ibetAgent.Config.Balance < int.Parse(stake))
            {
                transactionDTO.HomeTeamName = ibetMatch.HomeTeamName;
                transactionDTO.AwayTeamName = ibetMatch.AwayTeamName;
                transactionDTO.Note = "Not enough money";
                transactionDTO.DateTime = DateTime.Now;
                this._betting = false;
                return transactionDTO;
            }

            
            string following = string.Empty;
            if (followtype)
                following = "following";
            else
                following = "unfollowing";

            string betKindValue = string.Empty;
            string homeTeamName = string.Empty;
            string awayTeamName = string.Empty;
            string newOddValue = string.Empty;
            string newHomeScore = string.Empty;
            string newAwayScore = string.Empty;

            bool flag = false;
            bool flag2 = false;
            string text = string.Empty;

            //System.Collections.Generic.List<MatchDTO> listIbetMatch = this._listIBETMatch;
            Dictionary<string, IbetMatch> listIbetMatch = this._ibetMatchs;
            //MatchDTO matchDTO = MatchDTO.SearchMatchFull(ibetMatch, listIbetMatch);
            if (ibetMatch != null && ibetMatch.HomeTeamName != string.Empty)
            {
                //OddDTO oddDTO = OddDTO.SearchOdd(oddType, odd, true, ibetMatch.Odds);
                //if (oddDTO != null)
                //{
                    string ibetOddNow = string.Empty;
                    //if (ibetOddType == "a")
                    //    ibetOddNow = oddDTO.Away.ToString();
                    //else
                    //    ibetOddNow = oddDTO.Home.ToString();
                    if (followtype || (!followtype && ((float.Parse(ibetOddNow) >= (float)txtLowestOddValue.Value && float.Parse(ibetOddNow) > 0)) || float.Parse(ibetOddNow) < 0))
                    {
                        int maxBet = 0;
                        int minBet = 0;
                        string ibetOddID = oddID;
                        try
                        {
                            string valueAway = "";
                            if (BetStrategy == "Under" || BetStrategy == "Over")
                            {
                                #region UNDER_OVER
                                if (BetStrategy == "Under")
                                {
                                    ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                    valueAway = newOddValue;
                                    Thread.Sleep(2000);
                                    ibetEngine.PrepareBet2(ibetOddID, "a", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                }
                                else if (BetStrategy == "Over")
                                {
                                    ibetEngine.PrepareBet2(ibetOddID, "a", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                    valueAway = newOddValue;
                                    Thread.Sleep(2000);
                                    ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                }
                                if (homeTeamName == ibetMatch.HomeTeamName)
                                {
                                    if (valueAway == newOddValue)
                                    {
                                        ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                        if (!flag2)
                                        {
                                            if (BetStrategy == "Under")
                                                text = "Under:: Confirm bet failed";
                                            else
                                                text = "Over:: Confirm bet failed";
                                        }
                                        else
                                        {
                                            this._lastTransactionTime = DateTime.Now;
                                            if (BetStrategy == "Under")
                                            {
                                                text = "Under:: - Success ";
                                                UpdateOddBetHistory(oddID + "a", "a");
                                            }
                                            else
                                            {
                                                text = "Over:: - Success ";
                                                UpdateOddBetHistory(oddID + "h", "h");
                                            }
                                            this._ibetEngine.ibetAgent.RefreshBetList();
                                        }
                                    }
                                    else
                                    {
                                        if (BetStrategy == "Under")
                                            text = "Under:: Odd requested: " + oddPrice.ToString();
                                        else
                                            text = "Over:: Odd requested: " + oddPrice.ToString();
                                    }
                                }
                                else
                                {
                                    if (BetStrategy == "Under")
                                        text = "Under:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                    else
                                        text = "Over:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                }
                                #endregion
                            }
                            else if (BetStrategy == "Over9290")
                            {
                                #region Over9290
                                ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                if (flag && homeTeamName == ibetMatch.HomeTeamName)
                                {
                                    ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                    if (!flag2)
                                    {
                                        text = "Over 92/90:: Confirm bet failed";
                                    }
                                    else
                                    {
                                        this._lastTransactionTime = DateTime.Now;
                                        text = "Over 92/90:: - Success ";
                                        //this._ibetEngine.ibetAgent.RefreshBetList();
                                        UpdateOddBetHistory(oddID + "h", "h");
                                    }
                                }
                                else
                                {
                                    text = "Over1.75:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                }
                                #endregion 
                            }
                            else if (BetStrategy == "SapKeo")
                            {
                                #region SAP_KEO
                                stake = ((int)(int.Parse(stake) * 1.5)).ToString();
                                ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                if (newOddValue == oddPrice.ToString())
                                {
                                    if (homeTeamName == ibetMatch.HomeTeamName)
                                    {
                                        ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                        if (!flag2)
                                        {
                                            text = "Sap Keo:: Confirm bet failed";
                                        }
                                        else
                                        {
                                            this._lastTransactionTime = DateTime.Now;
                                            text = "Odd Down:: - Success ";
                                            //this._ibetEngine.ibetAgent.RefreshBetList();
                                            UpdateOddBetHistory(oddID + "h", "h");
                                        }
                                    }
                                    else
                                    {
                                        text = "Sap Keo:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                    }
                                }
                                else
                                {
                                    text = "Sap Keo:: Odd change. Requested: " + oddPrice.ToString();
                                }
                                #endregion
                            }
                            else if (BetStrategy == "Over1.75")
                            {
                                #region Over1.75
                                ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                if (homeTeamName == ibetMatch.HomeTeamName)
                                {
                                    ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                    if (!flag2)
                                    {
                                        text = "Over1.75:: Confirm bet failed";
                                    }
                                    else
                                    {
                                        this._lastTransactionTime = DateTime.Now;
                                        text = "Over1.75:: - Success ";
                                        //this._ibetEngine.ibetAgent.RefreshBetList();
                                        UpdateOddBetHistory(oddID + "h", "h");
                                    }
                                }
                                else
                                {
                                    text = "Over1.75:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                }
                                #endregion
                            }
                            else if (BetStrategy == "nguoc" || BetStrategy == "xuoi")
                            {
                                #region BEST_STRATEGIES
                                if (BetStrategy == "nguoc")
                                {
                                    ibetEngine.PrepareBet2(ibetOddID, "a", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                    valueAway = newOddValue;
                                    Thread.Sleep(2000);
                                    ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                }
                                else if (BetStrategy == "xuoi")
                                {
                                    ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                    valueAway = newOddValue;
                                    Thread.Sleep(2000);
                                    ibetEngine.PrepareBet2(ibetOddID, "a", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                }

                                if (homeTeamName == ibetMatch.HomeTeamName)
                                {
                                    if (valueAway == newOddValue)
                                    {
                                        ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                        if (!flag2)
                                        {
                                            text = "Best Strategy:: Confirm bet failed";
                                        }
                                        else
                                        {
                                            this._lastTransactionTime = DateTime.Now;
                                            text = "Best Strategy:" + this.txtAddValue.Value.ToString() + " : - Success. " + BetStrategy.Replace("nguoc", "Over").Replace("xuoi", "Under");
                                            this._ibetEngine.ibetAgent.RefreshBetList();
                                            if (BetStrategy == "nguoc")
                                            {
                                                UpdateOddBetHistory(oddID + "h", "h");
                                            }
                                            else if (BetStrategy == "xuoi")
                                            {
                                                UpdateOddBetHistory(oddID + "a", "a");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        text = "Best Strategy:: Odd requested: " + oddPrice.ToString();
                                    }
                                }
                                else
                                {
                                    text = "Best Strategy:: Not same match. Comparing: " + ibetMatch.HomeTeamName + " - " + ibetMatch.AwayTeamName;
                                }
                                #endregion
                            }
                            #region IBET_vs_IBET_Over
                            else if (BetStrategy.Contains("Over15_Fang"))
                            {

                                ibetEngine.PrepareBet2(ibetOddID, "h", oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                if (homeTeamName == ibetMatch.HomeTeamName
                                    && (homeTeamName.Contains("30:01-45:00") || homeTeamName.Contains("75:01-90:00"))
                                    )
                                {
                                    ibetEngine.ConfirmBet(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                    if (!flag2)
                                    {
                                        text = "Over_15:: Confirm bet failed";
                                    }
                                    else
                                    {
                                        this._lastTransactionTime = DateTime.Now;
                                        text = "Over_15:: - Success ";
                                        UpdateOddBetHistory(oddID + "h", "h");

                                        //this._ibetEngine.ibetAgent.RefreshBetList();
                                    }
                                }
                            }

                            #endregion
                            else if (BetStrategy.Contains("Over15_XA"))
                            {
                                #region IBET_vs_IBET_Over30-45_XA

                                ibetEngine.PrepareBetFor2ndIBET(ibetOddID, ibetOddType, oddPrice.ToString(), stake, out flag, out minBet, out maxBet, out betKindValue, out homeTeamName, out awayTeamName, out newOddValue, out newHomeScore, out newAwayScore);
                                if (homeTeamName.TrimEnd() == ibetMatch.HomeTeamName && awayTeamName.TrimEnd() == ibetMatch.AwayTeamName)
                                {
                                    
                                    if (float.Parse(newOddValue) >= 0.35f || float.Parse(newOddValue) < 0f)//tranh suu ban
                                    {
                                        if (!betKindValue.EndsWith("75"))
                                        {
                                            ibetEngine.ConfirmBetFor2ndIBET(oddType, newOddValue, stake, minBet.ToString(), maxBet.ToString(), out flag2);
                                            if (!flag2)
                                            {
                                                text = BetStrategy + ":: Confirm bet failed";
                                            }
                                            else
                                            {
                                                this._lastTransactionTime = DateTime.Now;
                                                text = BetStrategy + ":: - Success ";
                                                UpdateOddBetHistory(oddID + ibetOddType, ibetOddType);
                                                UpdateOddBetHistory(RefID + ibetOddType, ibetOddType);
                                                this._ibetEngine.ibetAgent2.RefreshBetList();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        text = BetStrategy + ":: Keo nho hon 0.35 >> Hien tai: " + newOddValue + ". Xem xet xa tay >>>>>>>>>>";
                                    }
                                }
                                else
                                {
                                    iBet.Utilities.WriteLog.Write("Not same match: Tim: " + ibetMatch.HomeTeamName + "-" 
                                    + ibetMatch.AwayTeamName + "Tra ve: " + homeTeamName + "-" + awayTeamName);
                                }

                                #endregion


                            }                            
                        }
                        catch (Exception ex)
                        {
                            text = ex.Message;
                        }
                    }
                    else
                    {
                        text = "Odd value is smaller than lowest accepted:" + ibetOddNow;
                    }
                //}
                //else
                //{
                //    string text2 = string.Empty;                    
                //    text = "Odd not found.";
                //}
            }
            else
                text = "Match not found ";


            transactionDTO.HomeTeamName = homeTeamName + ":" + homeScore;
            transactionDTO.AwayTeamName = awayTeamName + ":" + awayScore;
            transactionDTO.HomeScore = homeScore;
            transactionDTO.AwayScore = awayScore;
            transactionDTO.Score = homeScore + "-" + awayScore;
            transactionDTO.AccountPair = this._ibetAccount;// +" - " + this._ibetSubAccount;
            transactionDTO.OddType = oddType.ToString();
            transactionDTO.Odd = betKindValue;
            transactionDTO.OddKindValue = betKindValue;
            transactionDTO.OddValue = newOddValue;
            transactionDTO.Stake = stake;            
            transactionDTO.Note = text + " >>> " + acctoScan;
            transactionDTO.IBETTrade = flag2;
            transactionDTO.IBETAllow = flag;
            transactionDTO.IsFollowTypeTrans = true;
            transactionDTO.DateTime = DateTime.Now;
            transactionDTO.FollowRef = followref;

            this._betting = false;
            return transactionDTO;
        }
コード例 #20
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();
            }
        }
コード例 #21
0
        private TransactionDTO PlaceBetAllowMaxBet(bool sendOrNOT, MatchDTO ibetMatch, MatchDTO sbobetMatch, eOddType oddType, string ibetOddID, string sbobetOddID, string ibetOddType, string sbobetOddType, string ibetOddValue, string sbobetOddValue, int ibetStake, int sbobetStake, bool ibetHomeGive, IBetEngine ibetEngine, SbobetEngine sbobetEngine, string sbobetOdd)
        {
            this._betting = true;
            TransactionDTO transactionDTO = new TransactionDTO();
            
            //transactionDTO.OddType = current2.Type.ToString() + " - Home / Away";
            string text = "";
            string text2 = "";
            string text3 = "";
            bool flag = false;
            bool flag2 = false;
            int num = 0;
            int num2 = 0;
            string text4 = "";
            string text5 = "";
            string text6 = "";
            bool flag3 = false;
            bool flag4 = false;
            bool sBOBETReTrade = false;
            int num3 = 0;
            string text7 = "";
            string betCount = "";
            string text8 = "";
            bool flag5 = false;

            float ibetOddValue_ = float.Parse(ibetOddValue);
            float sboOddValue_ = float.Parse(sbobetOddValue);

            if (ibetOddValue_ > 0.84 || (ibetOddValue_ > 0f && txtAddValue.Value.ToString() == "0.01"))
            {
                float valueAdd = ibetStake * (float)txtAddValue.Value;
                ibetStake = ibetStake + (int)valueAdd;
            }
            if (sboOddValue_ > 0.84 || (sboOddValue_ > 0f && txtAddValue.Value.ToString() == "0.01"))
            {
                float valueAdd = sbobetStake * (float)txtAddValue.Value;
                sbobetStake = sbobetStake + (int)valueAdd;
            }

            bool ibetGoFirst = true;// who is Away or Under

            if (checkEdit11.Checked) //safe bet
            {
                if (sbobetOddType == "a") //  ibet  vs sbo
                {
                    if (oddType == eOddType.FirstHalfOverUnder || oddType == eOddType.FulltimeOverUnder)//neu bong over under
                    {
                        ibetGoFirst = false;
                    }
                    else // bong handicap
                    {
                        if (ibetHomeGive) // neu away la doi cua duoi
                        {
                            ibetGoFirst = false;
                        }
                    }
                }
                else //  sbo vs ibet
                {
                    if (oddType == eOddType.FirstHalfOverUnder || oddType == eOddType.FulltimeOverUnder)//neu bong over under
                    {
                        ibetGoFirst = true;
                    }
                    else // bong handicap
                    {
                        if (ibetHomeGive) // neu away la doi cua duoi
                        {
                            ibetGoFirst = true;
                        }
                    }
                }
            }

            if (MatchDTO.IsSameMatch(ibetMatch.HomeTeamName.ToLower(), sbobetMatch.HomeTeamName.ToLower(), ibetMatch.AwayTeamName.ToLower(), sbobetMatch.AwayTeamName.ToLower()))
            {
                try
                {
                    ibetEngine.PrepareBet(ibetOddID, ibetOddType, ibetOddValue, ibetStake.ToString(), out flag, out num, out num2, out text4, out text2, out text3);
                    sbobetEngine.PrepareBet(sbobetOddID, sbobetOddValue, sbobetOddType, out betCount, out num3, out flag3, out text7, out text5, out text6);
                    //object result = this.CallJavascriptFunction("bet", new object[] { 0, ibetMatch.ID.Remove(0, 2), ibetOddID, ibetOddType, ibetOddValue });
                    
                    if (MatchDTO.IsSameMatch(text2, text5, text3, text6)) // ten hom - away giong nhau
                    {                        
                        float num4 = 0f;
                        float num5 = 0f;
                        if (flag && flag3 && float.TryParse(text4, out num4) && float.TryParse(text7, out num5))
                        {
                            if ((checkEdit13.Checked || checkEdit15.Checked) && sendOrNOT)//gui lenh
                            {
                                var taskA = new Task(() => this.AddOddToLocalCommunity(ibetMatch, sbobetMatch, oddType, sbobetOdd, sbobetOdd, ibetOddType, sbobetOddType, ibetOddValue, sbobetOddValue, ibetHomeGive));
                                taskA.Start();
                            }

                            //try parse de tranh hien tuong mat Odd 1 ben
                            //float num4 = float.Parse(text4); 
                            //float num5 = float.Parse(text7);
                            if (num4 + num5 == 0f || num4 == num5)
                            {
                                int num6 = 0;
                                if (num2 >= num3) // num2 maxbet ibet
                                {
                                    num6 = num3; // num3 maxbet sbo
                                }
                                else
                                {
                                    if (num2 <= num3)
                                    {
                                        num6 = num2;
                                    }
                                }
                                if (ibetStake >= num6)
                                {
                                    ibetStake = num6;
                                }
                                if (sbobetStake >= num6)
                                {
                                    sbobetStake = num6;
                                }
                                try
                                {
                                    float currentCredit = 0;
                                    float currentCredit2 = 0;
                                    if (checkEdit8.Checked)
                                    {
                                        currentCredit = ibetEngine.GetCurrentCredit();
                                        currentCredit2 = sbobetEngine.GetCurrentCredit();
                                    }
                                    else
                                    {
                                        currentCredit = ibetEngine._currentCredit;
                                        currentCredit2 = sbobetEngine._currentCredit;
                                    }

                                    if ((float)ibetStake <= currentCredit && (float)sbobetStake <= currentCredit2)
                                    {
                                        try
                                        {
                                            if (ibetGoFirst)
                                            {
                                                
#if TESTMODE
                                                #region IBET_FIRTST_THEN_SBO
                                                if (!checkEdit12.Checked || (checkEdit12.Checked && ibetOddType == "a" && (oddType == eOddType.FirstHalfOverUnder || oddType == eOddType.FulltimeOverUnder)))
                                                    ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), num.ToString(), num2.ToString(), out flag2);
                                                if (flag2 && !checkEdit12.Checked)
                                                {
                                                    sbobetEngine.ConfirmBet(sbobetOddID, sbobetOddValue, sbobetOddType, sbobetStake.ToString(), betCount, out text8, out flag4);
                                                    if (!flag4)
                                                    {
                                                        try
                                                        {
                                                            sbobetEngine.PrepareBet(sbobetOddID, text8, sbobetOddType, out betCount, out num3, out flag5, out text7, out text5, out text6);
                                                            if (MatchDTO.IsSameMatch(text2, text5, text3, text6))
                                                            {
                                                                if (!float.TryParse(text7, out num5)) //text 7 = BetKindValue
                                                                {
                                                                    Thread.Sleep(3000);
                                                                    sbobetEngine.PrepareBet(sbobetOddID, text8, sbobetOddType, out betCount, out num3, out flag5, out text7, out text5, out text6);
                                                                    float.TryParse(text7, out num5);
                                                                }

                                                                if (num4 + num5 == 0f || num4 == num5)
                                                                {
                                                                    text = "Retrade. IBET: " + ibetOddValue + " -  SBOBET: " + text8;
                                                                    //text = "No retrade in this version please trade manually.";
                                                                    sbobetEngine.ConfirmBet(sbobetOddID, text8, sbobetOddType, sbobetStake.ToString(), betCount, out text8, out sBOBETReTrade);
                                                                    this._lastTransactionTime = System.DateTime.Now;
                                                                    playSound(false);
                                                                    
                                                                }
                                                                else
                                                                {
                                                                    text = "Invalid Odd in SBOBET. IBET Odd: " + text4 + " - SBOBET Odd:" + text7;
                                                                    playSound(false);
                                                                }
                                                            }
                                                            else
                                                            {
                                                                text = string.Concat(new string[]
															    {
																    "Not Same Match - Retrade. IBET: ", 
																    text2, 
																    " / ", 
																    text3, 
																    " - SBOBET: ", 
																    text5, 
																    " / ", 
																    text6
															    });
                                                            }
                                                        }
                                                        catch (System.Exception ex)
                                                        {
                                                            text = "Error while Retrade. Details: " + ex.Message;
                                                            playSound(false);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        playSound(true);
                                                    }

                                                    this._lastTransactionTime = System.DateTime.Now;
                                                    object obj = text;
                                                    text = string.Concat(new object[]
												    {
													    obj, 
													    " - Success Transaction. Half: ", 
													    ibetMatch.Half, 
													    " - Minute: ", 
													    ibetMatch.Minute, 
													    " - Halftime: ", 
													    ibetMatch.IsHalfTime
												    });
                                                    ibetEngine.GetCurrentCredit();
                                                    sbobetEngine.GetCurrentCredit();

                                                }
                                                
                                                #endregion
#endif
                                            }

                                            else
                                            {
                                                text = "No more SBOBET comes first.";
                                                //#region SBO_BET_FIRST_THEN_IBET

                                                //sbobetEngine.ConfirmBet(sbobetOddID, sbobetOddValue, sbobetOddType, sbobetStake.ToString(), betCount, out text8, out flag4);
                                                //if (flag4)
                                                //{ 
                                                //    ibetEngine.ConfirmBet(oddType, ibetOddValue, ibetStake.ToString(), num.ToString(), num2.ToString(), out flag2);
                                                //    if (!flag2)
                                                //    {
                                                //        text = "Invalid Odd while Retrade.";// IBET Odd: " + text4 + " - SBOBET Odd:" + text7;
                                                //        sbobetEngine.GetCurrentCredit();
                                                //        playSound(false);
                                                //    }
                                                //    else
                                                //    {
                                                //        this._lastTransactionTime = System.DateTime.Now;
                                                //        object obj = text;
                                                //        text = string.Concat(new object[]
                                                //        {
                                                //            obj, 
                                                //            " - Success Transaction. Half: ", 
                                                //            ibetMatch.Half, 
                                                //            " - Minute: ", 
                                                //            ibetMatch.Minute, 
                                                //            " - Halftime: ", 
                                                //            ibetMatch.IsHalfTime
                                                //        });
                                                //        ibetEngine.GetCurrentCredit();
                                                //        sbobetEngine.GetCurrentCredit();
                                                //        playSound(true);
                                                //    }
                                                //}

                                                //#endregion
                                            }

                                        }
                                        catch (System.Exception ex)
                                        {
                                            text = "Error while Trading. Details: " + ex.Message;
                                        }
                                    }
                                    else
                                    {
                                        text = string.Concat(new object[]
										{
											"Out of Cash. IBET Credit: ", 
											currentCredit, 
											" -  SBOBET Credit: ", 
											currentCredit2
										});
                                    }
                                }
                                catch (System.Exception ex)
                                {
                                    text = "Error while getting Credit. Details: " + ex.Message;
                                }
                            }
                            else
                            {
                                text = "Invalid Odd while Preparing Ticket. IBET Odd: " + text4 + " - SBOBET Odd:" + text7;
                            }
                        }
                    }                        
                    else
                    {
                        text = string.Concat(new string[]
						{
							"Not Same Match - Preparing Ticket. IBET: ", 
							text2, 
							" / ", 
							text3, 
							" - SBOBET: ", 
							text5, 
							" / ", 
							text6
						});
                    }                    
                }
                catch (System.Exception ex)
                {
                    text = "Error while Preparing Trade. Details: " + ex.Message;
                }
            }
            else
            {
                text = string.Concat(new string[]
				{
					"Not Same Match - Comparing. IBET: ", 
					ibetMatch.HomeTeamName, 
					" / ", 
					ibetMatch.AwayTeamName, 
					" - SBOBET: ", 
					sbobetMatch.HomeTeamName, 
					" / ", 
					sbobetMatch.AwayTeamName
				});
            }
            transactionDTO.HomeTeamName = ibetMatch.HomeTeamName + ":" + ibetMatch.HomeScore + " / " + sbobetMatch.HomeTeamName;
            transactionDTO.AwayTeamName = ibetMatch.AwayTeamName + ":" + ibetMatch.AwayScore + " / " + sbobetMatch.AwayTeamName;
            transactionDTO.Odd = text4 + " / " + text7;
            transactionDTO.OddKindValue = text4 + " / " + text7;
            transactionDTO.OddValue = ibetOddValue + " / " + sbobetOddValue;
            transactionDTO.Stake = ibetStake + " / " + sbobetStake;
            transactionDTO.IBETAllow = flag;
            transactionDTO.IBETTrade = flag2;
            transactionDTO.IBETReTrade = false;
            transactionDTO.SBOBETAllow = flag3;
            transactionDTO.SBOBETTrade = flag4;
            transactionDTO.SBOBETReTrade = sBOBETReTrade;
            //transactionDTO.OddType = oddType.ToString() + ;
            transactionDTO.OddType = oddType.ToString() + " - " + ibetOddType.Replace("h", "Home").Replace("a", "Away") + " / " + sbobetOddType.Replace("h", "Home").Replace("a", "Away");
            transactionDTO.Note = text;
            transactionDTO.DateTime = System.DateTime.Now.ToLocalTime();

            transactionDTO.HomeTeamSBOBET = sbobetMatch.HomeTeamName;
            transactionDTO.AwayTeamSBOBET = sbobetMatch.AwayTeamName;
            
            this._betting = false;
            return transactionDTO;            
        }        
コード例 #22
0
		public static MatchDTO SearchMatch(MatchDTO matchToSearch, System.Collections.Generic.List<MatchDTO> dataSource)
		{
			string text = matchToSearch.HomeTeamName.ToLower();
			string text2 = matchToSearch.AwayTeamName.ToLower();
			string text3 = matchToSearch.League.Name.ToLower();
			MatchDTO result;
			if (text3.Contains("special") || text3.Contains("specific") || text3.Contains("fantasy") || text3.Contains("which") || text3.Contains("team") || text3.Contains("advance") || text3.Contains("next") || text3.Contains("winner"))
			{
				result = null;
			}
			else
			{
				if (text.Contains("+") || text.Contains("corner") || text.Contains("(et)") || text.Contains("(pen)") || text.Contains("(winner)") || text.Contains("winner"))
				{
					result = null;
				}
				else
				{
					if (text2.Contains("+") || text2.Contains("corner") || text2.Contains("(et)") || text2.Contains("(pen)") || text2.Contains("(winner)") || text2.Contains("winner"))
					{
						result = null;
					}
					else
					{
						foreach (MatchDTO current in dataSource)
						{
							string text4 = current.HomeTeamName.ToLower();
							string text5 = current.AwayTeamName.ToLower();
							string text6 = current.League.Name.ToLower();
							if (!text6.Contains("special") && !text6.Contains("specific") && !text6.Contains("fantasy") && !text3.Contains("which") && !text3.Contains("team") && !text3.Contains("advance") && !text3.Contains("next") && !text3.Contains("winner"))
							{
								if (!text5.Contains("+") && !text5.Contains("corner") && !text5.Contains("(et)") && !text5.Contains("(pen)") && !text5.Contains("(winner)") && !text5.Contains("winner"))
								{
									if (!text4.Contains("+") && !text4.Contains("corner") && !text4.Contains("(et)") && !text4.Contains("(pen)") && !text4.Contains("(winner)") && !text4.Contains("winner"))
									{
										if ((text.Contains(text4) && text2.Contains(text5)) ||  text5 == text2 || text == text4 )
										{
											result = current;
											return result;
										}
										if (text4.Contains(text) && text5.Contains(text2))
										{
											result = current;
											return result;
										}
									}
								}
							}
						}
						result = null;
					}
				}
			}
			return result;
		}
コード例 #23
0
        internal void GetOddFromLocalCommunity(string ibetAccount, MatchDTO ibetmatch, MatchDTO sbobetmatch, eOddType oddtype, string ibetOdd, string sbobetOdd, string ibetoddType, string sbobetoddType, string ibetoddValue, string sbobetoddValue, bool homeFavor)
        {
            if (!checkEdit15.Checked && (checkEdit14.Checked && ibetAccount != this._ibetAccount && this._running && !this._betting && this._listSameMatch != null))
            {
                try
                {
                    TransactionDTO transactionDTO;
                    //phai tim betID trong list vi khong giong nhau cho tung user
                    string sbobetoddID = string.Empty;
                    string ibetoddID = string.Empty;
                    System.Collections.Generic.List<MatchDTO> listSbobetMatch = this._listSbobetMatch;
                    System.Collections.Generic.List<MatchDTO> listIbetMatch = this._listIBETMatch;
                    MatchDTO matchDTO = MatchDTO.SearchMatch(ibetmatch, listSbobetMatch);
                    if (matchDTO != null && matchDTO.Odds.Count > 0)
                    {
                        OddDTO oddDTO = OddDTO.SearchOdd(oddtype, sbobetOdd, matchDTO.Odds);
                        if (oddDTO != null)
                        {
                            sbobetoddID = oddDTO.ID;
                            MatchDTO matchDTO2 = MatchDTO.SearchMatch(ibetmatch, listIbetMatch);
                            if (matchDTO2 != null && matchDTO.Odds.Count > 0)
                            {
                                OddDTO oddDTO2 = OddDTO.SearchOdd(oddtype, ibetOdd, matchDTO2.Odds);
                                if (oddDTO2 != null)
                                {
                                    ibetoddID = oddDTO2.ID;
                                    if (this.AllowOddBet(ibetoddID,""))
                                    {
                                        if (this.chbRandomStake.Checked)
                                        {
                                            int num = 0;
                                            while (num == 0)
                                            {
                                                string strNum = this.txtStake.Lines[new System.Random().Next(this.txtStake.Lines.Length)];
                                                int.TryParse(strNum, out num);
                                            }
                                            int ibetStake = num;
                                            int sbobetStake = num;

                                            transactionDTO = this.PlaceBetAllowMaxBet(false, ibetmatch, matchDTO, oddtype, ibetoddID, sbobetoddID, ibetoddType, sbobetoddType, ibetoddValue, sbobetoddValue.ToString(), ibetStake, sbobetStake, homeFavor, this._ibetEngine, this._sbobetEngine, sbobetOdd);
                                            transactionDTO.OddType = oddtype + " - " + ibetoddType + " / " + sbobetoddType;
                                            this.AddTransaction(transactionDTO);
                                        }
                                        else
                                        {
                                            int num = 0;
                                            while (num == 0)
                                            {
                                                string strNum = this.txtStake.Lines[new System.Random().Next(this.txtStake.Lines.Length)];
                                                int.TryParse(strNum, out num);
                                            }

                                            int ibetStake = num;
                                            int sbobetStake = (int)Math.Round(num * ((float)this.txtSBOBETFixedStake.Value / (float)this.txtIBETFixedStake.Value));

                                            transactionDTO = this.PlaceBet(false, ibetmatch, matchDTO, oddtype, ibetoddID, sbobetoddID, ibetoddType, sbobetoddType, ibetoddValue, sbobetoddValue.ToString(), ibetStake, sbobetStake, this._ibetEngine, this._sbobetEngine, sbobetOdd, homeFavor);
                                            transactionDTO.OddType = oddtype + " - " + ibetoddType + " / " + sbobetoddType;
                                            this.AddTransaction(transactionDTO);
                                        }
                                        if (transactionDTO != null && transactionDTO.IBETTrade)
                                        {
                                            this.UpdateOddBetHistory(ibetoddID,"");
                                        }
                                    }
                                }
                                else
                                    SendReportToMainForm(this._ibetAccount + "-" + this._sbobetAccount + " >> " + ibetmatch.HomeTeamName + " - " + ibetmatch.AwayTeamName + " : can not find odd " + sbobetOdd + "in IBET list");
                            }
                            else
                                SendReportToMainForm(this._ibetAccount + " match not found in ibet list");                            
                        }
                        else
                            SendReportToMainForm(this._ibetAccount + "-" + this._sbobetAccount + " >> " + ibetmatch.HomeTeamName + " - " + ibetmatch.AwayTeamName + " : can not find odd " + sbobetOdd + "in SBOBET list");
                    }
                    else
                        SendReportToMainForm(this._ibetAccount + "-" + this._sbobetAccount + " >> " + ibetmatch.HomeTeamName + " - " + ibetmatch.AwayTeamName + ": match not found in sbobet list");
                    
                }
                catch (Exception ex)
                {
                    //ShowWarningDialog("Error: " + ex);
                }
            }
        }
コード例 #24
0
 public static bool IsValidMatch(MatchDTO match)
 {
     return(!match.LeagueName.ToLower().Contains("special") && !match.LeagueName.ToLower().Contains("specific") && !match.LeagueName.ToLower().Contains("fantasy") && !match.LeagueName.ToLower().Contains("winner") && (!match.HomeTeamName.ToLower().Contains("+") && !match.HomeTeamName.ToLower().Contains("corner") && !match.HomeTeamName.ToLower().Contains("(et)") && !match.HomeTeamName.ToLower().Contains("(pen)") && !match.HomeTeamName.ToLower().Contains("(winner)")) && !match.HomeTeamName.ToLower().Contains("winner") && (!match.AwayTeamName.ToLower().Contains("+") && !match.AwayTeamName.ToLower().Contains("corner") && !match.AwayTeamName.ToLower().Contains("(et)") && !match.AwayTeamName.ToLower().Contains("(pen)") && !match.AwayTeamName.ToLower().Contains("(winner)")) && !match.AwayTeamName.ToLower().Contains("winner"));
 }
コード例 #25
0
        private void TestRuleEngine()
        {
            RulesEngine.Engine engine = new RulesEngine.Engine();
            engine.For<Person>()                    
                    .Setup(p => p.Name)
                        .MustNotBeNull()
                        .MustMatchRegex("^[a-zA-z]+$")
                    .Setup(p => p.Phone)
                        .MustNotBeNull()
                        .MustMatchRegex("^[0-9]+$");

            engine.For<MatchDTO>()
                .Setup(m => m.HomeTeamName)
                    .MustEqual("Man U");

            MatchDTO match = new MatchDTO();
            match.HomeTeamName = "Man U";
            match.AwayTeamName = "Chelsea";
            match.AwayScore = "2";
            match.HomeScore = "1";

            bool isV = engine.Validate(match);
            iBet.Utilities.WriteLog.Write(isV.ToString());

            Person person = new Person();
            person.Name = "Bill";
            person.Phone = "1234214";
            //person.DateOfBirth = new DateTime(1999, 10, 2);

            bool isValid = engine.Validate(person);
            iBet.Utilities.WriteLog.Write(isValid.ToString());
        }
コード例 #26
0
        public static System.Collections.Generic.List<MatchDTO> ConvertUpdateData(
            string data,
            System.Collections.Generic.List<MatchDTO> originalDataSource,
            out string updateTime)
        {
            System.Collections.Generic.List<MatchDTO> list = BaseDTO.DeepClone<System.Collections.Generic.List<MatchDTO>>(originalDataSource);
            updateTime = string.Empty;
            data = data.Replace("\n", "");
            string[] array = data.Split(new string[]
			{
				";"
			}, System.StringSplitOptions.None);
            MatchDTO matchDTO = null;
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string text = array2[i];
                if (text.Contains("var Dell"))
                {
                    JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
					{
						"="
					}, System.StringSplitOptions.None)[2]);
                    foreach (object current in javaScriptArray)
                    {
                        MatchDTO matchDTO2 = MatchDTO.SearchMatch(current.ToString(), list);
                        if (matchDTO2 != null)
                        {
                            list.Remove(matchDTO2);
                        }
                    }
                }
                else
                {
                    if (text.StartsWith("Insl"))
                    {
                        JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
						{
							"="
						}, System.StringSplitOptions.None)[1]);
                        if (javaScriptArray[3].ToString() == "1")
                        {
                            MatchDTO matchDTO3 = new MatchDTO();
                            matchDTO3.Odds = new System.Collections.Generic.List<OddDTO>();
                            matchDTO3.ID = javaScriptArray[0].ToString();
                            if (javaScriptArray[4].ToString() == string.Empty)
                            {
                                matchDTO3.League = matchDTO.League;
                            }
                            else
                            {
                                matchDTO3.League = new LeagueDTO();
                                matchDTO3.League.ID = javaScriptArray[4].ToString();
                                matchDTO3.League.Name = javaScriptArray[5].ToString();
                            }
                            matchDTO3.HomeTeamName = javaScriptArray[6].ToString();
                            matchDTO3.AwayTeamName = javaScriptArray[7].ToString();
                            if (javaScriptArray.Count >= 12)
                            {
                                if (javaScriptArray[12] != null && javaScriptArray[12].ToString() != string.Empty && !javaScriptArray[12].ToString().ToLower().Contains("t") && !javaScriptArray[12].ToString().ToLower().Contains("live"))
                                {
                                    string[] array3 = javaScriptArray[12].ToString().ToLower().Split(new string[]
									{
										"h"
									}, System.StringSplitOptions.None);
                                    matchDTO3.Half = int.Parse(array3[0]);
                                    matchDTO3.Minute = int.Parse(array3[1].Trim().Replace("'", ""));
                                    matchDTO3.IsHalfTime = false;
                                }
                                else
                                {
                                    matchDTO3.Minute = 0;
                                    matchDTO3.Half = 0;
                                    matchDTO3.IsHalfTime = true;
                                }
                            }
                            else
                            {
                                matchDTO3.Minute = 0;
                                matchDTO3.Half = 0;
                                matchDTO3.IsHalfTime = true;
                            }
                            float num = 0f;
                            if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeHandicap;
                                oddDTO.ID = javaScriptArray[24].ToString();
                                oddDTO.Odd = javaScriptArray[25].ToString();
                                if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[28].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                oddDTO.ID = javaScriptArray[29].ToString();
                                oddDTO.Odd = javaScriptArray[30].ToString();
                                if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                oddDTO.ID = javaScriptArray[37].ToString();
                                oddDTO.Odd = javaScriptArray[38].ToString();
                                if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[41].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                oddDTO.ID = javaScriptArray[42].ToString();
                                oddDTO.Odd = javaScriptArray[43].ToString();
                                if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO3.Odds.Add(oddDTO);
                            }
                            list.Add(matchDTO3);
                            matchDTO = matchDTO3;
                        }
                        else
                        {
                            float num = 0f;
                            if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeHandicap;
                                oddDTO.ID = javaScriptArray[24].ToString();
                                oddDTO.Odd = javaScriptArray[25].ToString();
                                if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[28].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FulltimeOverUnder;
                                oddDTO.ID = javaScriptArray[29].ToString();
                                oddDTO.Odd = javaScriptArray[30].ToString();
                                if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                oddDTO.ID = javaScriptArray[37].ToString();
                                oddDTO.Odd = javaScriptArray[38].ToString();
                                if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                {
                                    oddDTO.HomeFavor = false;
                                    oddDTO.AwayFavor = false;
                                }
                                else
                                {
                                    if (javaScriptArray[41].ToString() == "h")
                                    {
                                        oddDTO.HomeFavor = true;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "a")
                                        {
                                            oddDTO.HomeFavor = false;
                                            oddDTO.AwayFavor = true;
                                        }
                                    }
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                            if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                            {
                                OddDTO oddDTO = new OddDTO();
                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                oddDTO.ID = javaScriptArray[42].ToString();
                                oddDTO.Odd = javaScriptArray[43].ToString();
                                if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                {
                                    oddDTO.Home = num;
                                }
                                else
                                {
                                    oddDTO.Home = 0f;
                                }
                                if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                {
                                    oddDTO.Away = num;
                                }
                                else
                                {
                                    oddDTO.Away = 0f;
                                }
                                matchDTO.Odds.Add(oddDTO);
                            }
                        }
                    }
                    if (text.StartsWith("uLl"))
                    {
                        JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
						{
							"="
						}, System.StringSplitOptions.None)[1]);
                        MatchDTO matchDTO4 = MatchDTO.SearchMatch(javaScriptArray[0].ToString(), list);
                        if (matchDTO4 != null)
                        {
                            string text2 = javaScriptArray[1].ToString().Replace("'", "").Replace(" ", "").ToLower();
                            if (text2.Contains("t") || text2.Contains("live"))
                            {
                                matchDTO4.Half = 0;
                                matchDTO4.Minute = 0;
                                matchDTO4.IsHalfTime = true;
                            }
                            else
                            {
                                matchDTO4.IsHalfTime = false;
                                matchDTO4.Half = int.Parse(text2.Split(new string[]
								{
									"h"
								}, System.StringSplitOptions.None)[0]);
                                matchDTO4.Minute = int.Parse(text2.Split(new string[]
								{
									"h"
								}, System.StringSplitOptions.None)[1]);
                            }
                        }
                    }
                    else
                    {
                        if (text.StartsWith("uOl"))
                        {
                            JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(text.Split(new string[]
							{
								"="
							}, System.StringSplitOptions.None)[1]);
                            MatchDTO matchDTO4 = MatchDTO.SearchMatch(javaScriptArray[0].ToString(), list);
                            if (matchDTO4 != null)
                            {
                                OddDTO oddDTO2 = OddDTO.SearchOdd(javaScriptArray[2].ToString(), matchDTO4.Odds);
                                if (oddDTO2 != null)
                                {
                                    matchDTO4.Odds.Remove(oddDTO2);
                                }
                                if (javaScriptArray[3].ToString() != string.Empty && javaScriptArray[4].ToString() != string.Empty && javaScriptArray[5].ToString() != string.Empty)
                                {
                                    string text3 = javaScriptArray[1].ToString();
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.ID = javaScriptArray[2].ToString();
                                    oddDTO.Odd = javaScriptArray[3].ToString();
                                    oddDTO.Home = float.Parse(javaScriptArray[4].ToString());
                                    oddDTO.Away = float.Parse(javaScriptArray[5].ToString());
                                    if (javaScriptArray.Count >= 7)
                                    {
                                        if (javaScriptArray[6].ToString().ToLower() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[6].ToString().ToLower() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                        }
                                    }
                                    string text4 = text3;
                                    if (text4 == null)
                                    {
                                        goto IL_1134;
                                    }
                                    if (!(text4 == "1"))
                                    {
                                        if (!(text4 == "3"))
                                        {
                                            if (!(text4 == "7"))
                                            {
                                                if (!(text4 == "8"))
                                                {
                                                    goto IL_1134;
                                                }
                                                oddDTO.Type = eOddType.FirstHalfOverUnder;
                                            }
                                            else
                                            {
                                                oddDTO.Type = eOddType.FirstHalfHandicap;
                                            }
                                        }
                                        else
                                        {
                                            oddDTO.Type = eOddType.FulltimeOverUnder;
                                        }
                                    }
                                    else
                                    {
                                        oddDTO.Type = eOddType.FulltimeHandicap;
                                    }
                                IL_113F:
                                    if (oddDTO.Type != eOddType.Unknown)
                                    {
                                        matchDTO4.Odds.Add(oddDTO);
                                    }
                                    goto IL_115F;
                                IL_1134:
                                    oddDTO.Type = eOddType.Unknown;
                                    goto IL_113F;
                                }
                            IL_115F: ;
                            }
                        }
                        else
                        {
                            if (text.StartsWith("window"))
                            {
                                updateTime = text.Substring(43, 19);
                            }
                        }
                    }
                }
            }
            return list;
        }
コード例 #27
0
        internal void AddLocalValidOdd(string fromIbetAccount, MatchDTO ibetmatch, MatchDTO sbobetmatch, eOddType oddtype, string ibetodd, string sbobetodd, string ibetoddType, string sbobetoddType, string ibetoddValue, string sbobetoddValue, bool homeFavor)
        {

            foreach (TerminalFormIBETSBO current in this._listTerminal2)
            {
                current.GetOddFromLocalCommunity(fromIbetAccount, ibetmatch, sbobetmatch, oddtype, ibetodd, sbobetodd, ibetoddType, sbobetoddType, ibetoddValue, sbobetoddValue, homeFavor);
            }            
        }
コード例 #28
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string data, out string updateTime)
        {
            System.Collections.Generic.List<MatchDTO> list = null;
            updateTime = string.Empty;
            if (data != string.Empty)
            {
                list = new System.Collections.Generic.List<MatchDTO>();
                data = data.Replace("\n", "");
                string[] array = data.Split(new string[]
				{
					";"
				}, System.StringSplitOptions.None);
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string text = array2[i];
                    if (text.StartsWith("window"))
                    {
                        updateTime = text.Substring(43, 19);
                    }
                    else
                    {
                        if (text.StartsWith("Nl"))
                        {
                            string value = text.Split(new string[]
							{
								"="
							}, System.StringSplitOptions.None)[1];
                            JavaScriptArray javaScriptArray = (JavaScriptArray)JavaScriptConvert.DeserializeObject(value);
                            if (javaScriptArray[3].ToString() == "1")
                            {
                                MatchDTO matchDTO = new MatchDTO();
                                matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();
                                matchDTO.ID = javaScriptArray[0].ToString();
                                if (javaScriptArray[4].ToString() == string.Empty)
                                {
                                    MatchDTO matchDTO2 = list[list.Count - 1];
                                    matchDTO.League = matchDTO2.League;
                                }
                                else
                                {
                                    matchDTO.League = new LeagueDTO();
                                    matchDTO.League.ID = javaScriptArray[4].ToString();
                                    matchDTO.League.Name = javaScriptArray[5].ToString();
                                }
                                matchDTO.HomeTeamName = javaScriptArray[6].ToString();
                                matchDTO.AwayTeamName = javaScriptArray[7].ToString();
                                if (javaScriptArray.Count >= 12)
                                {
                                    if (javaScriptArray[12] != null
                                        && javaScriptArray[12].ToString() != string.Empty
                                        && !javaScriptArray[12].ToString().ToLower().Contains("t")
                                        && !javaScriptArray[12].ToString().ToLower().Contains("live"))
                                    {
                                        string[] array3 = javaScriptArray[12].ToString().ToLower().Split(new string[]
										{
											"h"
										}, System.StringSplitOptions.None);
                                        matchDTO.Half = int.Parse(array3[0]);
                                        matchDTO.Minute = int.Parse(array3[1].Trim().Replace("'", ""));
                                        matchDTO.IsHalfTime = false;
                                        //Utilities.WriteLog.Write(javaScriptArray[12].ToString());
                                    }
                                    else
                                    {
                                        matchDTO.Minute = 0;
                                        matchDTO.Half = 0;
                                        matchDTO.IsHalfTime = true;
                                    }
                                }
                                else
                                {
                                    matchDTO.Minute = 0;
                                    matchDTO.Half = 0;
                                    matchDTO.IsHalfTime = true;
                                }
                                float num = 0f;
                                if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME
                                    oddDTO.ID = javaScriptArray[24].ToString();
                                    oddDTO.Odd = javaScriptArray[25].ToString();
                                    //Utilities.WriteLog.Write(oddDTO.Odd);
                                    if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[28].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:" 
                                        + oddDTO.ID
                                        );
#endif

                                }
                                if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeOverUnder; //FULL TIME OVER UNDER
                                    oddDTO.ID = javaScriptArray[29].ToString();
                                    oddDTO.Odd = javaScriptArray[30].ToString();
                                    if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif
                                }
                                if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST
                                    oddDTO.ID = javaScriptArray[37].ToString();
                                    oddDTO.Odd = javaScriptArray[38].ToString();
                                    if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[41].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif

                                }
                                if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfOverUnder;
                                    oddDTO.ID = javaScriptArray[42].ToString();
                                    oddDTO.Odd = javaScriptArray[43].ToString();
                                    if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString()
                                        + ", odd ID:"
                                        + oddDTO.ID
                                        );
#endif
                                }
                                list.Add(matchDTO);
#if DDEBUG
                                Utilities.WriteLog.Write("~ M ~:ibet: Added match: "
                                    + matchDTO.HomeTeamName
                                    + " - " + matchDTO.AwayTeamName
                                    + ", with number of odds: " + matchDTO.OddCount);
#endif
                            }
                            else
                            {
                                MatchDTO matchDTO2 = list[list.Count - 1];
                                float num = 0f;
                                if (javaScriptArray[24] != null && javaScriptArray[24].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeHandicap;
                                    oddDTO.ID = javaScriptArray[24].ToString();
                                    oddDTO.Odd = javaScriptArray[25].ToString();
                                    if (float.TryParse(javaScriptArray[26].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[27].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[28] == null || javaScriptArray[28].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[28].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[28].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[29] != null && javaScriptArray[29].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FulltimeOverUnder;
                                    oddDTO.ID = javaScriptArray[29].ToString();
                                    oddDTO.Odd = javaScriptArray[30].ToString();
                                    if (float.TryParse(javaScriptArray[31].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[32].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[37] != null && javaScriptArray[37].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfHandicap;
                                    oddDTO.ID = javaScriptArray[37].ToString();
                                    oddDTO.Odd = javaScriptArray[38].ToString();
                                    if (float.TryParse(javaScriptArray[39].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[40].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    if (javaScriptArray[41] == null || javaScriptArray[41].ToString() == string.Empty)
                                    {
                                        oddDTO.HomeFavor = false;
                                        oddDTO.AwayFavor = false;
                                    }
                                    else
                                    {
                                        if (javaScriptArray[41].ToString() == "h")
                                        {
                                            oddDTO.HomeFavor = true;
                                            oddDTO.AwayFavor = false;
                                        }
                                        else
                                        {
                                            if (javaScriptArray[41].ToString() == "a")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                        }
                                    }
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                    matchDTO2.Odds.Add(oddDTO);
                                }
                                if (javaScriptArray[42] != null && javaScriptArray[42].ToString() != string.Empty)
                                {
                                    OddDTO oddDTO = new OddDTO();
                                    oddDTO.Type = eOddType.FirstHalfOverUnder;
                                    oddDTO.ID = javaScriptArray[42].ToString();
                                    oddDTO.Odd = javaScriptArray[43].ToString();
                                    if (float.TryParse(javaScriptArray[44].ToString(), out num))
                                    {
                                        oddDTO.Home = num;
                                    }
                                    else
                                    {
                                        oddDTO.Home = 0f;
                                    }
                                    if (float.TryParse(javaScriptArray[45].ToString(), out num))
                                    {
                                        oddDTO.Away = num;
                                    }
                                    else
                                    {
                                        oddDTO.Away = 0f;
                                    }
                                    matchDTO2.Odds.Add(oddDTO);
#if DDEBUG
                                    Utilities.WriteLog.Write("~o~:ibet:" +
                                        matchDTO2.HomeTeamName + "["
                                        + oddDTO.HomeFavor.ToString() + "]"
                                        + " - "
                                        + matchDTO2.AwayTeamName + "["
                                        + oddDTO.AwayFavor.ToString() + "]"
                                        + " >> add odd:"
                                        + oddDTO.Type.ToString()
                                        + ". "
                                        + oddDTO.Odd
                                        + " Price Home:"
                                        + oddDTO.Home.ToString()
                                        + ", Away:"
                                        + oddDTO.Away.ToString());
#endif
                                }
                            }
                        }
                    }
                }
            }
            return list;
        }
コード例 #29
0
        public void GetOddFromGlobal(OddNews odd, DateTime timestamp, string fromUser)
        {
            if (fromUser != this._currentUserID)
            {
                try
                {
                    SendOrPostCallback callback = new SendOrPostCallback(delegate(object state)
                    {
                        MatchDTO matchDTO = new MatchDTO();
                        matchDTO.HomeTeamName = odd.HomeTeamName;
                        matchDTO.AwayTeamName = odd.AwayTeamName;
                        matchDTO.League = new LeagueDTO();
                        matchDTO.League.Name = odd.LeagueName;
                        eOddType EOddType = eOddType.Unknown;
                        if (odd.OddType == "FirstHalfHandicap")
                            EOddType = eOddType.FirstHalfHandicap;
                        else if (odd.OddType == "FirstHalfOverUnder")
                            EOddType = eOddType.FirstHalfOverUnder;
                        else if (odd.OddType == "FulltimeHandicap")
                            EOddType = eOddType.FulltimeHandicap;
                        else
                            EOddType = eOddType.FulltimeOverUnder;

                        this.AddLocalValidOdd(fromUser, matchDTO, matchDTO, EOddType, odd.IbetOdd, odd.SbobetOdd,odd.IbetOddType, odd.SbobetOddType, odd.IbetOddValue, odd.SbobetOddValue, Boolean.Parse(odd.HomeFavor));

                        textEdit4.Text += "\r\n-- ["  + timestamp.ToLongTimeString() + "] Get odd: " +
                        odd.HomeTeamName + " - " +
                        odd.AwayTeamName + " " +
                        odd.LeagueName + " ; " +
                        odd.OddType + " " +
                        odd.IbetOdd + " / " +
                        odd.SbobetOdd + " . " +
                        odd.IbetOddType + " / " +
                        odd.SbobetOddType + " / " +
                        odd.IbetOddValue + " / " +
                        odd.SbobetOddValue + " . " +
                        odd.HomeFavor +
                        ". From: " + fromUser;
                    });
                    _uiSyncContext.Post(callback, null);
                    //MessageBox.Show("call from Bet broker server", "Bet Broker", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Bet Broker", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            } 
        }
コード例 #30
0
        public static System.Collections.Generic.List<MatchDTO> ConvertFullData(string data, out string updateTime, out Dictionary<string, string> mappingList3in1)
        { 
            System.Collections.Generic.List<MatchDTO> list = null;
            System.Collections.Generic.Dictionary<string, string> map = new Dictionary<string,string>();
            updateTime = string.Empty;
            if (data != string.Empty)
            {
                list = new System.Collections.Generic.List<MatchDTO>();

                JavaScriptObject javaScriptObj = (JavaScriptObject)JavaScriptConvert.DeserializeObject(data);
                if (javaScriptObj != null)
                {
                    string timeUpdate = javaScriptObj["t"].ToString();
                    updateTime = timeUpdate;
#if DEBUG
                    Utilities.WriteLog.Write("3in1: time after get full data:" + timeUpdate);
#endif
                    if (javaScriptObj["data"] != null)
                    {
                        string matchID = string.Empty;

                        JavaScriptArray objLiveMatch = (JavaScriptArray)javaScriptObj["data"];
                        objLiveMatch.RemoveAt(objLiveMatch.Count - 1);
#if DEBUG
                        Utilities.WriteLog.Write("3in1: Number of objects in first get data:" + objLiveMatch.Count.ToString()
                            + ". After remove the last item from [\"data\"]:" + (objLiveMatch.Count - 1).ToString());
#endif
                        using (System.Collections.Generic.List<object>.Enumerator enumerator = objLiveMatch.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {

                                JavaScriptArray objCurrentMatchProcess = (JavaScriptArray)enumerator.Current;
                                string string38 = objCurrentMatchProcess[38].ToString(); // HomeTeamName
                                string string53 = objCurrentMatchProcess[53].ToString(); //Time
                                if (!string38.ToLower().Contains("corner") && !string38.ToLower().Contains(":") && !string38.ToLower().Contains("(et)") && !string38.ToLower().Contains("(pen)"))
                                {
                                    if (objCurrentMatchProcess[34].ToString() != matchID)
                                    {
                                        MatchDTO matchDTO = new MatchDTO();
                                        matchDTO.ID = objCurrentMatchProcess[34].ToString();
                                        matchDTO.HomeTeamName = string38;
                                        matchDTO.AwayTeamName = objCurrentMatchProcess[39].ToString();
                                        matchDTO.League = new LeagueDTO();
                                        matchDTO.League.ID = objCurrentMatchProcess[3].ToString();
                                        matchDTO.League.Name = objCurrentMatchProcess[37].ToString();
                                        matchDTO.HomeScore = objCurrentMatchProcess[7].ToString();
                                        matchDTO.AwayScore = objCurrentMatchProcess[8].ToString();

                                        if (string53 == "HT")
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else if (string53.ToLower().Contains("live"))
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else if (string53.StartsWith("1H"))
                                        {
                                            matchDTO.Minute = ConvertSoccerTime(string53);
                                            matchDTO.Half = 1;
                                            matchDTO.IsHalfTime = true;
                                        }
                                        else if (string53.StartsWith("2H"))
                                        {
                                            matchDTO.Minute = ConvertSoccerTime(string53);
                                            matchDTO.Half = 2;
                                            matchDTO.IsHalfTime = false;
                                        }
                                        else
                                        {
                                            matchDTO.Minute = 0;
                                            matchDTO.Half = 0;
                                            matchDTO.IsHalfTime = false;
                                        }
                                            

                                        #region add odds
                                        matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();//add Odds
                                        string string24 = objCurrentMatchProcess[24].ToString();
                                        string string9 = objCurrentMatchProcess[9].ToString();
                                        string string13 = objCurrentMatchProcess[13].ToString();
                                        string string0 = objCurrentMatchProcess[0].ToString();

                                        float num = 0f;
                                        if (string9 != null && string9 != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME !!!!!!!!!
                                            oddDTO.ID = string0 + "^";
                                            oddDTO.Odd = string9.Replace("/", "-");
                                            if (objCurrentMatchProcess[40].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[40].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[41].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[41].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }                                            

                                            if (string24 == "1" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~3in1bet:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ": "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[11] != null
                                            && objCurrentMatchProcess[11].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeOverUnder;// FULL TIME OVER/UNDER
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[11].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[42].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[42].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[43].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[43].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[13] != null
                                            && objCurrentMatchProcess[13].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST HALF HANDICAP
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[13].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[44].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[44].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[45].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[45].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        if (objCurrentMatchProcess[15] != null
                                            && objCurrentMatchProcess[15].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfOverUnder; // FIRST HAFL OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[15].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[46].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[46].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[47].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[47].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                            Utilities.WriteLog.Write("~o~:3in1:" +
                                                matchDTO.HomeTeamName + "["
                                                + oddDTO.HomeFavor.ToString() + "]"
                                                + " - "
                                                + matchDTO.AwayTeamName + "["
                                                + oddDTO.AwayFavor.ToString() + "]"
                                                + " >> add odd:"
                                                + oddDTO.Type.ToString()
                                                + ". "
                                                + oddDTO.Odd
                                                + " Price Home:"
                                                + oddDTO.Home.ToString()
                                                + ", Away:"
                                                + oddDTO.Away.ToString()
                                                + ", ID: "
                                                + oddDTO.ID
                                                );
#endif
                                        }
                                        #endregion

                                        matchID = matchDTO.ID;
                                        list.Add(matchDTO);
#if DDEBUG
                                        Utilities.WriteLog.Write("~M~:3in1: Added match: "
                                            + matchDTO.HomeTeamName
                                            + " - " + matchDTO.AwayTeamName
                                            + "with number of odds: "
                                            + matchDTO.OddCount
                                            + ", ID: "
                                            + matchDTO.ID);                                        
#endif
                                    }
                                    else
                                    {
                                        //neu da co matchID thi lay tran dau vua add o tren
                                        MatchDTO matchDTO = list[list.Count - 1];
                                        string string24 = objCurrentMatchProcess[24].ToString();
                                        string string9 = objCurrentMatchProcess[9].ToString();
                                        string string0 = objCurrentMatchProcess[0].ToString();
                                        string string13 = objCurrentMatchProcess[13].ToString();

                                        #region add odds
                                        //matchDTO.Odds = new System.Collections.Generic.List<OddDTO>();//add Odds
                                        float num = 0f;
                                        if (string9 != null && string9 != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeHandicap;//FULL TIME !!!!!!!!!
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[9].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[40].ToString() != "-999" &&  float.TryParse(objCurrentMatchProcess[40].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[41].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[41].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string9 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string9 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[11] != null
                                            && objCurrentMatchProcess[11].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FulltimeOverUnder; // FULL TIME OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[0].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[11].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[42].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[42].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[43].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[43].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[13] != null
                                            && objCurrentMatchProcess[13].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfHandicap; // FIRST HALF HANDICAP
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString() + "^";
                                            oddDTO.Odd = objCurrentMatchProcess[13].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[44].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[44].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[44].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[45].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }
                                            if (string24 == "1" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "1" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = true;
                                                oddDTO.AwayFavor = false;

                                            }
                                            else if (string24 == "0" && string13 == "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }
                                            else if (string24 == "0" && string13 != "0")
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = true;
                                            }
                                            else
                                            {
                                                oddDTO.HomeFavor = false;
                                                oddDTO.AwayFavor = false;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        if (objCurrentMatchProcess[15] != null
                                            && objCurrentMatchProcess[15].ToString() != "-999")
                                        {
                                            OddDTO oddDTO = new OddDTO();
                                            oddDTO.Type = eOddType.FirstHalfOverUnder; // FIRST HALF OVER UNDER
                                            oddDTO.ID = objCurrentMatchProcess[2].ToString();
                                            oddDTO.Odd = objCurrentMatchProcess[15].ToString().Replace("/", "-");
                                            if (objCurrentMatchProcess[46].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[46].ToString(), out num))
                                            {
                                                oddDTO.Home = num;
                                            }
                                            else
                                            {
                                                oddDTO.Home = 0f;
                                            }
                                            if (objCurrentMatchProcess[47].ToString() != "-999" && float.TryParse(objCurrentMatchProcess[47].ToString(), out num))
                                            {
                                                oddDTO.Away = num;
                                            }
                                            else
                                            {
                                                oddDTO.Away = 0f;
                                            }

                                            oddDTO.IsHomeGive = bool.Parse(string24.Replace("1","true").Replace("0","false"));
                                            matchDTO.Odds.Add(oddDTO);
                                            if (!map.ContainsKey(oddDTO.ID))
                                                map.Add(oddDTO.ID, matchDTO.ID);
#if DDEBUG
                                        Utilities.WriteLog.Write("~o~:3in1:" +
                                            matchDTO.HomeTeamName + "["
                                            + oddDTO.HomeFavor.ToString() + "]"
                                            + " - "
                                            + matchDTO.AwayTeamName + "["
                                            + oddDTO.AwayFavor.ToString() + "]"
                                            + " >> add odd:"
                                            + oddDTO.Type.ToString()
                                            + ". "
                                            + oddDTO.Odd
                                            + " Price Home:"
                                            + oddDTO.Home.ToString()
                                            + ", Away:"
                                            + oddDTO.Away.ToString()
                                            + ", ID: "
                                            + oddDTO.ID
                                            );
#endif
                                        }
                                        #endregion
#if DDEBUG
                                        Utilities.WriteLog.Write("3in1: " + matchDTO.ID + " was added one more odd");
#endif
                                    }
                                }
                            }
                        }
#if DDEBUG
                        Dictionary<string, string>.KeyCollection keyColl = map.Keys;
                        foreach (string s in keyColl)
                        {
                            Utilities.WriteLog.Write("Add odd ID: " + s + " match ID: " + map[s]);
                        }
                        //foreach (MatchDTO matchVaiLon in matchDTO
#endif
                    }
                    else // [data] is null
                    {
 
                    }
                }             
            }
            mappingList3in1 = map;
            if (list != null)
              return list;
            else 
            {
                MatchDTO mNull = new MatchDTO();
                list.Add(mNull);
                return list;
            }
        }
コード例 #31
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;
        }
コード例 #32
0
        public static MatchDTO SearchMatchFull(MatchDTO matchToSearch, System.Collections.Generic.List<MatchDTO> dataSource)
        {
            string text = matchToSearch.HomeTeamName.ToLower();
            string text2 = matchToSearch.AwayTeamName.ToLower();
            string text3 = matchToSearch.League.Name.ToLower();
            MatchDTO result;

            foreach (MatchDTO current in dataSource)
            {
                string text4 = current.HomeTeamName.ToLower();
                string text5 = current.AwayTeamName.ToLower();
                string text6 = current.League.Name.ToLower();
                if (text5 == text2 || text == text4)
                {
                    result = current;
                    return result;
                }
            }
            result = null;
            return result;
        }