Ejemplo n.º 1
0
        public List<MatchBetNew> GenerateMemberBetlistFromText(string text1)
        {
            List<MatchBetNew> list4 = new List<MatchBetNew>();
            List<string> list3 = new List<string>();
            ArrayList list2 = new ArrayList();
            ArrayList list5 = new ArrayList();
            int num = 0;
            string current = "";
            try
            {
                while (num > -1)
                {
                    list3.Add(CommonFunction.substring(text1, num, ",['", "])", ref num).Trim());
                }
                List<string>.Enumerator enumerator = list3.GetEnumerator();
                try
                {
                    //enumerator;
                    while (enumerator.MoveNext())
                    {
                        current = enumerator.Current;
                        list2 = CommonFunction.SeperateStringBySymbol(current, "','");
                        if (list2.Count >= 14)
                        {
                            bool flag = false;
                            MatchBetNew item = new MatchBetNew();
                            item.set_ID(list2[8].ToString().Trim());
                            int num2 = 0;
                            item.set_MemberName(CommonFunction.substring(list2[7].ToString() + "#", 0, "],'", "#", ref num2));
                            if (base._objMemberList.get_MemberRange() == EnumCollection.eMemberRange.AllMember)
                            {
                                item.set_BetFollowMethod(base._objMemberList.get_GlobalBetFollowMethod());
                            }
                            else
                            {
                                Member member = base._objMemberList.get_Item(item.get_MemberName());
                                if (member != null)
                                {
                                    item.set_BetFollowMethod(member.get_BetFollowMethod());
                                }
                                else
                                {
                                    item.set_BetFollowMethod(EnumCollection.eBetFollowMethod.Normal);
                                }
                            }
                            string sportType = list2[9].ToString().Trim();
                            if (Enum.IsDefined(typeof(EnumCollection.eSportType), sportType))
                            {
                                item.set_SportType((EnumCollection.eSportType)Enum.Parse(typeof(EnumCollection.eSportType), sportType));
                            }
                            item.set_BetDate(list2[10].ToString() + " " + list2[11].ToString());
                            item.set_Company(base._strAgentSiteName);
                            item.set_League(list2[6].ToString().Trim().Replace("&nbsp;", ""));
                            item.set_HomeName(list2[4].ToString().Trim().Replace("&nbsp;", ""));
                            item.set_AwayName(list2[5].ToString().Trim().Replace("&nbsp;", ""));
                            item.set_SelectedMatch(list2[0].ToString().Trim().Replace("&nbsp;", ""));
                            item.set_HDP(list2[1].ToString().Trim().Replace("&nbsp;", ""));
                            item.HDPValue = list2[1].ToString().Trim().Replace("&nbsp;", "");

                            string matchType = list2[2].ToString().ToLower();
                            item.set_MatchType(matchType);
                            switch (matchType)
                            {
                                case "handicap":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                                    item.set_BetType(EnumCollection.eBetType.HDP);
                                    if (item.get_SelectedMatch().ToLower() == item.get_AwayName().ToLower())
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Away);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == item.get_HomeName().ToLower())
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Home);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;

                                case "first half o/u":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                                    item.set_BetType(EnumCollection.eBetType.OU);
                                    if (item.get_SelectedMatch().ToLower() == "over")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Over);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "under")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Under);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;

                                case "over/under":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                                    item.set_BetType(EnumCollection.eBetType.OU);
                                    if (item.get_SelectedMatch().ToLower() == "over")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Over);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "under")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_Under);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;

                                case "first half hdp":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                                    item.set_BetType(EnumCollection.eBetType.HDP);
                                    if (item.get_SelectedMatch().ToLower() == item.get_AwayName().ToLower())
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Away);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == item.get_HomeName().ToLower())
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_Home);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;
                                case "first half 1x2":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FirstHalf);
                                    item.set_BetType(EnumCollection.eBetType.lX2);
                                    if (item.get_SelectedMatch().ToLower() == "1")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_1);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "x")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_X);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "2")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.Half_2);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;
                                    break;
                                case "1x2":
                                    item.set_BetCoverage(EnumCollection.eBetCoverage.FT);
                                    item.set_BetType(EnumCollection.eBetType.lX2);
                                    if (item.get_SelectedMatch().ToLower() == "1")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_1);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "x")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_X);
                                    }
                                    else if (item.get_SelectedMatch().ToLower() == "2")
                                    {
                                        item.set_BetTarget(EnumCollection.eBetTarget.FT_2);
                                    }
                                    else
                                    {
                                        flag = true;
                                    }
                                    break;
                                default:
                                    item.set_MemberName(string.Empty);
                                    break;
                            }
                            if (list2[3].ToString().Contains("Live"))
                            {
                                item.set_GameType(EnumCollection.eGameType.Running);
                                item.set_RunningStatus(EnumCollection.eRunningStatus.Running);
                                num2 = 0;
                                list5 = CommonFunction.SeperateStringBySymbol(CommonFunction.substring(Conversions.ToString(Operators.ConcatenateObject(list2[3], "#")), 0, "!", "#", ref num2).Trim(), ":");
                                if (list5.Count == 2)
                                {
                                    item.set_HomeScore((int)Math.Round(Conversion.Val(list5[0].ToString().Trim())));
                                    item.set_AwayScore((int)Math.Round(Conversion.Val(list5[1].ToString().Trim())));
                                }
                            }
                            else
                            {
                                item.set_GameType(EnumCollection.eGameType.Today);
                                string runningStatus = list2[16].ToString().Trim();
                                if (Enum.IsDefined(typeof(EnumCollection.eRunningStatus), runningStatus))
                                {
                                    item.set_RunningStatus(
                                        (EnumCollection.eRunningStatus)
                                        Enum.Parse(typeof(EnumCollection.eRunningStatus), runningStatus));
                                }
                            }
                            if (item.get_BetType() == EnumCollection.eBetType.HDP)
                            {
                                if (item.get_HDP().Length > 0)
                                {
                                    if (item.get_HDP().Substring(0, 1) == "-")
                                    {
                                        if ((item.get_BetTarget() == EnumCollection.eBetTarget.FT_Home) | (item.get_BetTarget() == EnumCollection.eBetTarget.Half_Home))
                                        {
                                            item.set_HomeColor(Color.Red);
                                            item.set_AwayColor(Color.Blue);
                                        }
                                        else
                                        {
                                            item.set_HomeColor(Color.Blue);
                                            item.set_AwayColor(Color.Red);
                                        }
                                    }
                                    else if ((item.get_BetTarget() == EnumCollection.eBetTarget.FT_Home) | (item.get_BetTarget() == EnumCollection.eBetTarget.Half_Home))
                                    {
                                        item.set_HomeColor(Color.Blue);
                                        item.set_AwayColor(Color.Red);
                                    }
                                    else
                                    {
                                        item.set_HomeColor(Color.Red);
                                        item.set_AwayColor(Color.Blue);
                                    }
                                }
                            }
                            else
                            {
                                item.set_HomeColor(Color.Blue);
                                item.set_AwayColor(Color.Blue);
                            }

                            if (string.IsNullOrEmpty(item.get_HDP()))
                            {
                                item.set_HDP("0.0");
                            }

                            item.set_HDP(SportBookFunction.ConvertHDPType(CommonFunction.TrimSymbol(item.get_HDP(), "-")));
                            if (item.get_HDP() == "0.0")
                            {
                                item.set_HomeColor(Color.Blue);
                                item.set_AwayColor(Color.Blue);
                            }
                            item.set_CreateDate(DateTime.Now);
                            item.set_MatchDate(list2[11].ToString().Trim());
                            item.set_OddsString(list2[12].ToString().Trim());
                            item.set_BetAmount(Conversions.ToString(Conversion.Val(list2[14].ToString().Trim().Replace(",", ""))));
                            /***switch (list2[13].ToString().Trim().ToLower())
                            {
                                case "h":
                                    item.set_Odds(SportBookFunction.ConvertHKToMalayOdds(item.get_Odds()));
                                    item.set_OddsType(EnumCollection.eOddsType.HK);
                                    break;

                                case "i":
                                    item.set_Odds(SportBookFunction.ConvertIndoToMalayOdds(item.get_Odds()));
                                    item.set_OddsType(EnumCollection.eOddsType.Indo);
                                    break;

                                case "e":
                                    item.set_Odds(SportBookFunction.ConvertEuroToMalayOdds(item.get_Odds()));
                                    item.set_OddsType(EnumCollection.eOddsType.Euro);
                                    break;
                            }***/
                            item.set_IPAddress(CommonFunction.TrimSymbol(list2[list2.Count - 1].ToString().Trim(), "'"));
                            if ((item.get_MemberName() != string.Empty) & !flag)
                            {
                                list4.Add(item);
                            }
                        }
                    }
                    return list4;
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN GenerateMemberBetlistFromText: " + exception.Message);
                ProjectData.ClearProjectError();
            }
            return list4;
        }
Ejemplo n.º 2
0
        public bool IsMatchBetCanBet(MatchBetNew new1)
        {
            bool flag = false;
            if (this.IsToBetAll)
            {
                return true;
            }
            switch (new1.get_BetTarget())
            {
                case EnumCollection.eBetTarget.FT_Home:
                    if (!((new1.get_HomeColor() == Color.Blue) & (new1.get_AwayColor() == Color.Blue)))
                    {
                        if (((new1.get_HomeColor() == Color.Blue) & this.IsToBetFTEat) | ((new1.get_HomeColor() == Color.Red) & this.IsToBetFTPut))
                        {
                            flag = true;
                        }
                        return flag;
                    }
                    if (this.IsToBetFTEat | this.IsToBetFTPut)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.FT_Away:
                    if (!((new1.get_HomeColor() == Color.Blue) & (new1.get_AwayColor() == Color.Blue)))
                    {
                        if (((new1.get_AwayColor() == Color.Blue) & this.IsToBetFTEat) | ((new1.get_AwayColor() == Color.Red) & this.IsToBetFTPut))
                        {
                            flag = true;
                        }
                        return flag;
                    }
                    if (this.IsToBetFTEat | this.IsToBetFTPut)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.FT_Over:
                    if (this.IsToBetFTOver)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.FT_Under:
                    if (this.IsToBetFTUnder)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.Half_Home:
                    if (!((new1.get_HomeColor() == Color.Blue) & (new1.get_AwayColor() == Color.Blue)))
                    {
                        if (((new1.get_HomeColor() == Color.Blue) & this.IsToBetHalfEat) | ((new1.get_HomeColor() == Color.Red) & this.IsToBetHalfPut))
                        {
                            flag = true;
                        }
                        return flag;
                    }
                    if (this.IsToBetHalfEat | this.IsToBetHalfPut)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.Half_Away:
                    if (!((new1.get_HomeColor() == Color.Blue) & (new1.get_AwayColor() == Color.Blue)))
                    {
                        if (((new1.get_AwayColor() == Color.Blue) & this.IsToBetHalfEat) | ((new1.get_AwayColor() == Color.Red) & this.IsToBetHalfPut))
                        {
                            flag = true;
                        }
                        return flag;
                    }
                    if (this.IsToBetHalfEat | this.IsToBetHalfPut)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.Half_Over:
                    if (this.IsToBetHalfOver)
                    {
                        flag = true;
                    }
                    return flag;

                case EnumCollection.eBetTarget.Half_Under:
                    if (this.IsToBetHalfUnder)
                    {
                        flag = true;
                    }
                    return flag;
            }
            return flag;
        }
Ejemplo n.º 3
0
        public override void GetTicketAndBet(AgentToClientBet bet1, EnumCollection.eBetFollowMethod method1)
        {
            try
            {
                if (base._isAutoBetting)
                {
                    if (!base._isBetting)
                    {
                        if (!this.IsWaitingBetCoolDown())
                        {
                            int num = 0;
                            if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(bet1.get_SourceAgentMemberBet(), ref num)))
                            {
                                bool flag = false;
                                MatchBetNew new2 = new MatchBetNew();
                                new2 = bet1.get_SourceAgentMemberBet().Clone();
                                EnumCollection.eBetTarget target = bet1.get_SourceAgentMemberBet().get_BetTarget();
                                switch (new2.get_BetTarget())
                                {
                                    case EnumCollection.eBetTarget.FT_Home:
                                    case EnumCollection.eBetTarget.FT_Over:
                                    case EnumCollection.eBetTarget.Half_Home:
                                    case EnumCollection.eBetTarget.Half_Under:
                                        flag = true;
                                        break;

                                    default:
                                        flag = false;
                                        break;
                                }
                                if (method1 == EnumCollection.eBetFollowMethod.Opposite)
                                {
                                    target = SpiderFunction.ConvertBetFollowMethodToOpposite(target);
                                }
                                this.GetTicketAndBetFromAgent(bet1.get_SourceAgentMemberBet(), bet1.get_TargetClientMatch(), target, bet1.get_TargetAmount() - bet1.get_BettedAmount(), bet1.CloneObject());
                            }
                            else
                            {
                                bet1.get_SourceAgentMemberBet().set_Description("Exceed Per Match Limit!");
                                base._objBetListFailed.Add(bet1.get_SourceAgentMemberBet());
                                this.get__objBetQueueMonitor().UpdateMatchStatus(bet1.get_SourceAgentMemberBet().get_ID(), "Exceed Per Match Limit!");
                                this.WriteProgramLogger("Exceed Per Match Limit!");
                            }
                        }
                        else
                        {
                            this.WriteProgramLogger("Please wait, program is waiting bet cool down...");
                        }
                    }
                    else
                    {
                        this.WriteProgramLogger("Please wait, program is betting other match...");
                    }
                }
                else
                {
                    bet1.get_SourceAgentMemberBet().set_Description("Auto Bet OFF.");
                    base._objBetListFailed.Add(bet1.get_SourceAgentMemberBet());
                    this.get__objBetQueueMonitor().UpdateMatchStatus(bet1.get_SourceAgentMemberBet().get_ID(), "Auto Bet OFF");
                    this.WriteProgramLogger("Auto Bet OFF.");
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN GetTicketAndBet: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN GetTicketAndBet: " + exception.Message);
                ProjectData.ClearProjectError();
            }
        }