public static string CompareByHashLive(List <objMatch> Ibet, List <objMatch> Sbo, double profitmin) { string result = ""; under_compare = ""; HashIbetLive.Clear(); HashSboLive.Clear(); //HashKeoDuoi.Clear(); foreach (objMatch ObjIbet in Ibet) { string key = string.Format("{0},{1},{2},{3}", ObjIbet.HomeName, ObjIbet.AwayName, ObjIbet.hdp, ObjIbet.BetType); if (!HashIbetLive.Contains(key)) { HashIbetLive.Add(key, ObjIbet); } //if (ObjIbet.hdp.Trim() != "") //{ // try // { // if (float.Parse(ObjIbet.hdp) < 0 && !HashKeoDuoi.Contains(ObjIbet.HomeName)) // HashKeoDuoi.Add(ObjIbet.HomeName, ObjIbet.HomeName); // else if (float.Parse(ObjIbet.hdp) >= 0 && !HashKeoDuoi.Contains(ObjIbet.AwayName)) // HashKeoDuoi.Add(ObjIbet.AwayName, ObjIbet.AwayName); // } // catch (Exception) // { // } //} } foreach (objMatch ObjSbo in Sbo) { string key = string.Format("{0},{1},{2},{3}", ObjSbo.HomeName, ObjSbo.AwayName, ObjSbo.hdp, ObjSbo.BetType); if (!HashSboLive.Contains(key)) { HashSboLive.Add(key, ObjSbo); } } ICollection keySbos = HashSboLive.Keys; foreach (string keySbo in keySbos) { try { if (HashIbetLive.ContainsKey(keySbo)) { string OddSbo1 = ((objMatch)HashSboLive[keySbo]).Odd1; string OddSbo2 = ((objMatch)HashSboLive[keySbo]).Odd2; string OddIbet1 = ((objMatch)HashIbetLive[keySbo]).Odd1; string OddIbet2 = ((objMatch)HashIbetLive[keySbo]).Odd2; double LeagueOdd = UtilSoccer.profit_odd(OddSbo1, OddSbo2); string IdKeoSbo = ((objMatch)HashSboLive[keySbo]).IdKeo; string IdKeoIbet = ((objMatch)HashIbetLive[keySbo]).IdKeo; string HomeName = ((objMatch)HashIbetLive[keySbo]).HomeName; string AwayName = ((objMatch)HashIbetLive[keySbo]).AwayName; string Keo = ((objMatch)HashIbetLive[keySbo]).hdp; string BetType = ((objMatch)HashSboLive[keySbo]).BetType; string Score = ((objMatch)HashIbetLive[keySbo]).Score; string Time = ((objMatch)HashIbetLive[keySbo]).TimeLive; //Time = Time.Split(' ')[Time.Split(' ').Length - 1]; if (profit_odd_new(OddSbo1, OddIbet2) >= profitmin) { result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; try { if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43) { if (Time.Split(' ')[0].ToUpper().Contains("1H")) { if (BetType == "7" && float.Parse(Keo) >= 0) { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } else if (BetType == "9") { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } } else if (Time.Split(' ')[0].ToUpper().Contains("2H")) { if (BetType == "1" && float.Parse(Keo) >= 0) { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } else if (BetType == "3") { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } } } } catch (Exception) { ; } } else if (profit_odd_new(OddSbo2, OddIbet1) >= profitmin) { result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; try { if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43) { if (Time.Split(' ')[0].ToUpper().Contains("1H")) { if (BetType == "7" && float.Parse(Keo) >= 0) { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } else if (BetType == "9") { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } } else if (Time.Split(' ')[0].ToUpper().Contains("2H")) { if (BetType == "1" && float.Parse(Keo) >= 0) { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } else if (BetType == "3") { under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n"; } } } } catch (Exception) { } } } } catch (Exception) { } } return(result); }