예제 #1
0
        //private bool isProcess;
        private void OnSboUpdateScan(List <MatchOddDTO> updatedDataSbo, bool isLive, DateTime time)
        {
            if ((isLive && ScanType == eScanType.NonLive) ||
                (!isLive && ScanType == eScanType.Live))
            {
                return;
            }

            if (LastBetTime.AddSeconds(TimeOffStakeOdds) > time || isProcess)
            {
                return;
            }

            Task.Run(() => OnPingEvent(time, eServerType.Sbo));

            if (isLive)
            {
                lock (IbetEngine.LockLive)
                {
                    ////Compare Live
                    CompareOdd(updatedDataSbo, IbetEngine.LiveMatchOddDatas, true);
                }
            }
            else
            {
                lock (IbetEngine.LockNonLive)
                {
                    ////Compare Non Live
                    CompareOdd(updatedDataSbo, IbetEngine.NoneLiveMatchOddDatas, false);
                }
            }
        }
예제 #2
0
        private void OnIbetUpdateScan(List <MatchOddDTO> updatedDataIbet, bool isLive, DateTime time)
        {
            if (isProcess || LastBetTime.AddSeconds(TimeOffStakeOdds) > DateTime.Now)
            {
                return;
            }

            isProcess = true;
            Task.Run(() => OnPingEvent(time, eServerType.Ibet));

            if (isLive)
            {
                lock (SboEngine.LockLive)
                {
                    ////Compare Live
                    CompareOdd(SboEngine.LiveMatchOddDatas, updatedDataIbet, true, true);
                }
            }
            else
            {
                lock (SboEngine.LockNonLive)
                {
                    ////Compare Non Live
                    CompareOdd(SboEngine.NoneLiveMatchOddDatas, updatedDataIbet, false, true);
                }
            }

            isProcess = false;
        }
        public void ProcessPrepareBet(MatchOddDTO ibetMatchOdd, eBetType ibetBetType, MatchOddDTO sboMatchOdd, eBetType sboBetType, bool isLive)
        {
            try
            {
                if (MaxCountBet == 0 || CountBet <= MaxCountBet)
                {
                    var taskPrepareBetIbet = Task.Run(() => CallPrepareBet(ibetMatchOdd, ibetBetType, isLive));
                    var taskPrepareBetSbo  = Task.Run(() => CallPrepareBet(sboMatchOdd, sboBetType, isLive));

                    if (taskPrepareBetIbet.Result != null && taskPrepareBetSbo.Result != null &&
                        !taskPrepareBetIbet.Result.HasChangeOdd && !taskPrepareBetSbo.Result.HasChangeOdd)
                    {
                        if (LastBetTime.AddSeconds(TimeOffStakeOdds) <= DateTime.Now)
                        {
                            int ibetStake;
                            int sboStake;

                            if (CaculateStake(BetStakeType,
                                              taskPrepareBetIbet.Result.MatchOdd.MatchID, taskPrepareBetIbet.Result.MinBet, taskPrepareBetIbet.Result.MaxBet,
                                              taskPrepareBetSbo.Result.MatchOdd.MatchID, taskPrepareBetSbo.Result.MinBet, taskPrepareBetSbo.Result.MaxBet,
                                              out ibetStake, out sboStake))
                            {
                                if (CallConfirmBet(taskPrepareBetIbet.Result, ibetStake))
                                {
                                    if (CallConfirmBet(taskPrepareBetSbo.Result, sboStake))
                                    {
                                        Task.Run(
                                            () =>
                                            UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType,
                                                          taskPrepareBetSbo.Result.MatchOdd.MatchID, SboBetPool, sboStake));
                                        Logger.Info("BET SUCCESS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
                                        LastBetTime = DateTime.Now;
                                        CountBet++;
                                    }

                                    Task.Run(
                                        () =>
                                        UpdateBetPool(taskPrepareBetIbet.Result.MatchOdd.ServerType,
                                                      taskPrepareBetIbet.Result.MatchOdd.MatchID, IbetBetPool, ibetStake));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw;
            }
        }