Ejemplo n.º 1
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();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  当投注额大于单场赛事限制投注额时,进行二分法投注
        /// </summary>
        /// <param name="gamerSite">博彩网</param>
        /// <param name="message">下注消息</param>
        /// <param name="currentBet">当前下注对象</param>
        private void TryBetAgain(WebSiteAbstractClass gamerSite, string message, AgentToClientBet currentBet)
        {
            if (message.Contains(IBC_STAKE_DESC) ||
                message.Contains(SBO_STAKE_DESC) ||
                message.Contains(IBC_BETCREDIT_DESC) ||
                message.Contains(SBO_BETCREDIT_DESC) ||
                currentBet.get_SourceAgentMemberBet().BetFailCount > ConstUtil.BET_FAIL_COUNT)
            {
                PlayerBetLog log = setBetLogMessage(message);
                DataServiceAdapter.SavePlayerBetLog(log);
                currentBet.set_IsRemoved(true);
            }
            else if (message.Contains(IBC_PERLIMIT) || message.Contains(SBO_PERLIMIT))
            {
                int betAmount = currentBet.get_TargetAmount();
                String[] arrays = message.Split(SPLIT);
                // 当单场赛事投注达到限制投注额时,将赌注降低为原来的一半进行下注
                if (arrays.Length == 2)
                {
                    betAmount = Conversions.ToInteger(arrays[1]) / 2;
                }
                currentBet.set_TargetAmount(betAmount);
                currentBet.set_BetAmountValue(MARK_VALUE);

                if (!gamerSite.get_IsGettingFullOdds())
                {
                    gamerSite.GetOddsFromServer();
                }
                List<MatchNew> newMatchNews = gamerSite.get_MatchListFull();
                MatchNew oldMatchNew = currentBet.get_TargetClientMatch();
                foreach (var newMatchNew in newMatchNews)
                {
                    // 取最新的赛事数据
                    if (oldMatchNew.get_FT_ID() == newMatchNew.get_FT_ID())
                    {
                        currentBet.set_TargetClientMatch(newMatchNew);
                        break;
                    }
                }
            }
            gamerSite.get_BetQueueList().UpdateBetMatchInfo(currentBet);
        }
Ejemplo n.º 3
0
 private void UpdateBetQueue(AgentToClientBet bet1)
 {
     if (this._synchronisingObject != null)
     {
         if (this._synchronisingObject.InvokeRequired)
         {
             this._synchronisingObject.BeginInvoke(new ProcessEventBetQueueDelegate(this.UpdateBetQueue), new object[] { bet1 });
         }
         else
         {
             IEnumerator enumerator = null;
             ListViewItem current = new ListViewItem();
             MatchBetNew new2 = bet1.get_SourceAgentMemberBet();
             try
             {
                 enumerator = this.get_lstBetQueue().Items.GetEnumerator();
                 while (enumerator.MoveNext())
                 {
                     current = (ListViewItem) enumerator.Current;
                     if (current.SubItems[3].Text == new2.get_ID())
                     {
                         current.SubItems[0x10].Text = bet1.get_Status();
                         if (bet1.get_Status().Contains("Stop") | bet1.get_Status().Contains("Changed"))
                         {
                             current.SubItems[0x10].ForeColor = Color.Red;
                         }
                         else
                         {
                             if (bet1.get_Status().Contains("OK"))
                             {
                                 current.SubItems[0x10].ForeColor = Color.Blue;
                                 continue;
                             }
                             if (bet1.get_Status().Contains("Betting"))
                             {
                                 current.SubItems[0x10].ForeColor = Color.Green;
                                 continue;
                             }
                             if (bet1.get_Status().Contains("Finding"))
                             {
                                 current.SubItems[0x10].ForeColor = Color.DarkGray;
                                 continue;
                             }
                             if (bet1.get_Status().Contains("Found"))
                             {
                                 current.SubItems[0x10].ForeColor = Color.LightGreen;
                             }
                         }
                     }
                 }
             }
             finally
             {
                 if (enumerator is IDisposable)
                 {
                     (enumerator as IDisposable).Dispose();
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 下注成功
        /// </summary>                                                                                                                       
        /// <param name="message">下注消息</param>
        /// <param name="currentBet">下注对象</param>
        private void SaveBetInfo(string message, AgentToClientBet currentBet)
        {
            if (string.IsNullOrEmpty(message))
            {
                return;
            }

            message = message.ToLower();

            if (message.Contains(BET_SUCCESS))
            {
                PlayerBet playerBet = new PlayerBet();
                playerBet.Player = playerConvert.Player;
                playerBet.IsSuccess = true;
                playerBet.Result = BET_SUCCESS;
                playerBet.Remarks = string.Empty;
                playerBet.AccountingDate = DateTime.Now.ToShortDateString();

                DataServiceAdapter.SavePlayerBetInfo(playerBet, currentBet.get_SourceAgentMemberBet());
            }
            else
            {
                if (0 == currentBet.get_SourceAgentMemberBet().BetFailCount |
                    currentBet.get_SourceAgentMemberBet().BetFailCount > ConstUtil.BET_FAIL_COUNT)
                {
                    PlayerBetLog log = setBetLogMessage(message);
                    DataServiceAdapter.SavePlayerBetLog(log);
                }
            }
        }
Ejemplo n.º 5
0
 private void AddBetQueue(AgentToClientBet bet1)
 {
     if (this._synchronisingObject != null)
     {
         if (this._synchronisingObject.InvokeRequired)
         {
             this._synchronisingObject.BeginInvoke(new ProcessEventBetQueueDelegate(this.AddBetQueue), new object[] { bet1 });
         }
         else
         {
             MatchBetNew new2 = bet1.get_SourceAgentMemberBet();
             ListViewItem item = new ListViewItem();
             item.UseItemStyleForSubItems = false;
             item.SubItems.Add(new2.get_MemberName());
             item.SubItems.Add(new2.get_Company());
             item.SubItems.Add(new2.get_ID());
             item.SubItems.Add(new2.get_BetCoverage().ToString());
             item.SubItems.Add(new2.get_GameType().ToString());
             if (new2.get_GameType() == EnumCollection.eGameType.Running)
             {
                 item.SubItems.Add(Conversions.ToString(new2.get_HomeScore()) + "-" + Conversions.ToString(new2.get_AwayScore()));
             }
             else
             {
                 item.SubItems.Add("-");
             }
             item.SubItems.Add(new2.get_HomeName());
             item.SubItems[item.SubItems.Count - 1].ForeColor = new2.get_HomeColor();
             item.SubItems.Add(new2.get_AwayName());
             item.SubItems[item.SubItems.Count - 1].ForeColor = new2.get_AwayColor();
             item.SubItems.Add(new2.get_SelectedMatch());
             item.SubItems[item.SubItems.Count - 1].ForeColor = Color.Green;
             if (this.get_IsShowHDPDoubleStyle())
             {
                 item.SubItems.Add(new2.get_HDPDouble().ToString("N2"));
             }
             else
             {
                 item.SubItems.Add(new2.get_HDP());
             }
             item.SubItems.Add(new2.get_OddsString());
             if (new2.get_Odds() >= 0.0)
             {
                 item.SubItems[item.SubItems.Count - 1].ForeColor = Color.Blue;
             }
             else
             {
                 item.SubItems[item.SubItems.Count - 1].ForeColor = Color.Red;
             }
             item.SubItems.Add(new2.get_BetAmount());
             if (bet1.get_TargetAmount() > -1)
             {
                 item.SubItems.Add(Conversions.ToString(bet1.get_TargetAmount()));
             }
             else
             {
                 item.SubItems.Add("Max Bet");
             }
             item.SubItems.Add(new2.get_CreateDate().ToLongTimeString());
             item.SubItems.Add(new2.get_BetFollowMethod().ToString());
             if (new2.get_BetFollowMethod() == EnumCollection.eBetFollowMethod.Opposite)
             {
                 item.SubItems[item.SubItems.Count - 1].ForeColor = Color.Red;
             }
             else
             {
                 item.SubItems[item.SubItems.Count - 1].ForeColor = Color.Blue;
             }
             item.SubItems.Add(bet1.get_Status());
             if (bet1.get_Status().Contains("Stop"))
             {
                 item.SubItems[0x10].ForeColor = Color.Red;
             }
             else if (bet1.get_Status().Contains("OK"))
             {
                 item.SubItems[0x10].ForeColor = Color.Blue;
             }
             else if (bet1.get_Status().Contains("Betting"))
             {
                 item.SubItems[0x10].ForeColor = Color.Green;
             }
             else if (bet1.get_Status().Contains("Finding"))
             {
                 item.SubItems[0x10].ForeColor = Color.DarkGray;
             }
             else if (bet1.get_Status().Contains("Found"))
             {
                 item.SubItems[0x10].ForeColor = Color.LightGreen;
             }
             if ((this.get_lstBetQueue().Items.Count % 2) == 1)
             {
                 int num3 = item.SubItems.Count - 1;
                 for (int i = 0; i <= num3; i++)
                 {
                     item.SubItems[i].BackColor = Color.FromArgb(240, 0xf8, 0xff);
                 }
             }
             this.get_lstBetQueue().Items.Add(item);
             if (this.get_lstBetQueue().Items.Count > 0)
             {
                 this.get_lstBetQueue().Items[this.get_lstBetQueue().Items.Count - 1].Selected = true;
                 this.get_lstBetQueue().Items[this.get_lstBetQueue().Items.Count - 1].EnsureVisible();
             }
             this.get_lblTotalCount().Text = "Total Count: " + this.get_lstBetQueue().Items.Count.ToString();
         }
     }
 }