Exemple #1
0
 public WebRequestStateEx2(string text2, WebRequest request1, string text1, EnumCollection.eBetType type1, EnumCollection.eBetTarget target1, MatchNew new4, MatchBetNew new2, MatchNew new3, MatchBetNew new1)
 {
     this._strTitle = "";
     this._strPost = "";
     this._intBetAmount = 0;
     this._objBetType = EnumCollection.eBetType.HDP;
     this._objBetTarget = EnumCollection.eBetTarget.FT_Home;
     this._objMatchParentSite = new MatchNew();
     this._objMatchBetParentSite = new MatchBetNew();
     this._objMatchChildSite = new MatchNew();
     this._objMatchBetChildSite = new MatchBetNew();
     this._objMatchBetChildSite = new1;
     this._objMatchBetParentSite = new2;
     this._objMatchChildSite = new3;
     this._objMatchParentSite = new4;
     this._objRequest = request1;
     this._strPost = text1;
     this._strTitle = text2;
     this._objBetType = type1;
     this._objBetTarget = target1;
     this._intBetAmount = Conversions.ToInteger(new1.get_BetAmount());
 }
Exemple #2
0
        /// <summary>
        /// 下发下注命令过滤器
        /// </summary>
        /// <param name="agent">当前代理对象</param>
        /// <param name="gamer">玩家对象</param>
        /// <param name="betNew">Ghost下注信息</param>
        public static bool DoFilter(AgentConvert agentConvert, MatchBetNew betNew, PlayerConvert gamer,ref int sign)
        {
            bool isFilter = true;
               Member member = agentConvert.AgentSite.get_TargetMemberList().get_Item(betNew.get_MemberName());

               // 保存Agent下的Ghost详细信息
               if (null != member && !string.IsNullOrEmpty(member.get_Name()))
               {
               string name = member.get_Name();
               //List<Member> members = agentConvert.AgentSite.get_MemberCreditList();
               //foreach (var item in members)
               //{
               //    if (null != item && !string.IsNullOrEmpty(item.get_Name()) && name == item.get_Name())
               //    {
               //        member = item;
               //    }
               //}
               if (agentConvert.Ghosts.ContainsKey(name) && agentConvert.Ghosts[name].Gamers.ContainsKey(gamer.Player.LoginName))
               {
                   if (Conversions.ToInteger(betNew.get_BetAmount()) < agentConvert.Ghosts[name].Ghost.RealBetAccount)
                   {
                      sign = 1;
                      return isFilter;
                   }
                   GhostConvert ghostConvert = agentConvert.Ghosts[name];
                   ghostConvert.Member = member;
                   // set gamer bet follow method.
                   if (ghostConvert.Ghost.IsOppositeBet)
                   {
                       ghostConvert.FollowMethod = EnumCollection.eBetFollowMethod.Opposite;
                   }
                   gamer.Member.set_BetFollowMethod(ghostConvert.FollowMethod);
                   isFilter = false;
               }
               }

               return isFilter;
        }
Exemple #3
0
        public static string GenerateDetailedMatchInfo(MatchNew new1, MatchBetNew new3, MatchBetNew new2, EnumCollection.eBetTarget target1, string text1, string text2)
        {
            string str4 = "";
            string str3 = "";
            double num = 0.0;
            switch (target1)
            {
                case EnumCollection.eBetTarget.FT_Home:
                    str3 = new1.get_FTHDP();
                    str4 = new1.get_FT_AwayOddsString();
                    num = new1.get_FTHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Away:
                    str3 = new1.get_FTHDP();
                    str4 = new1.get_FT_HomeOddsString();
                    num = new1.get_FTHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Over:
                    str3 = new1.get_FTOU();
                    str4 = new1.get_FT_UnderOddsString();
                    num = new1.get_FTOU_Commission();
                    break;

                case EnumCollection.eBetTarget.FT_Under:
                    str3 = new1.get_FTOU();
                    str4 = new1.get_FT_OverOddsString();
                    num = new1.get_FTOU_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Home:
                    str3 = new1.get_HalfHDP();
                    str4 = new1.get_Half_AwayOddsString();
                    num = new1.get_HalfHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Away:
                    str3 = new1.get_HalfHDP();
                    str4 = new1.get_Half_HomeOddsString();
                    num = new1.get_HalfHDP_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Over:
                    str3 = new1.get_HalfOU();
                    str4 = new1.get_Half_UnderOddsString();
                    num = new1.get_HalfOU_Commission();
                    break;

                case EnumCollection.eBetTarget.Half_Under:
                    str3 = new1.get_HalfOU();
                    str4 = new1.get_Half_OverOddsString();
                    num = new1.get_HalfOU_Commission();
                    num = new1.get_HalfOU_Commission();
                    break;
            }
            return ("\r\n============================================================\r\n" + text1 + "\r\n============================================================\r\nLeague: " + new2.get_League() + "\r\nHome: " + new3.get_HomeName() + "\r\nAway: " + new3.get_AwayName() + "\r\nBet: " + new3.get_SelectedMatch() + "\r\nHDP: " + new3.get_HDP() + "\r\nOdd: " + new3.get_OddsString() + "\r\nNew HDP: " + new2.get_HDP() + "\r\nNew Odd: " + new2.get_OddsString() + "\r\n" + text2 + " HDP: " + str3 + "\r\n" + text2 + " Opponent Odd: " + str4 + "\r\n" + text2 + " Commission: " + num.ToString() + "\r\nAmount: " + new2.get_BetAmount() + "\r\n============================================================");
        }
Exemple #4
0
 public static string GenerateDetailedMatchInfo(MatchBetNew new2, MatchBetNew new1, string text1, string text2)
 {
     return ("\r\n============================================================\r\n" + text1 + "\r\n============================================================\r\nLeague: " + new1.get_League() + "\r\nHome: " + new2.get_HomeName() + "\r\nAway: " + new2.get_AwayName() + "\r\nBet: " + new2.get_SelectedMatch() + "\r\n" + text2 + " HDP: " + new2.get_HDP() + "\r\n" + text2 + " Odd: " + new2.get_OddsString() + "\r\nNew HDP: " + new1.get_HDP() + "\r\nNew Odd: " + new1.get_OddsString() + "\r\nAmount: " + new1.get_BetAmount() + "\r\n============================================================");
 }
Exemple #5
0
 public static string GenerateDetailedMatchInfo(MatchBetNew new1, string text1)
 {
     return ("\r\n============================================================\r\n" + text1 + "\r\n============================================================\r\nCompany: " + new1.get_Company() + "\r\nRef ID: " + new1.get_ID() + "\r\nMember: " + new1.get_MemberName() + "\r\nBetType: " + new1.get_BetType().ToString() + "\r\nGameType: " + new1.get_GameType().ToString() + "\r\nMatchTime: " + new1.get_MatchDate() + "\r\nScore: " + new1.get_HomeScore().ToString() + "-" + Conversions.ToString(new1.get_AwayScore()) + "\r\nLeague: " + new1.get_League() + "\r\nHome: " + new1.get_HomeName() + "\r\nAway: " + new1.get_AwayName() + "\r\nBet: " + new1.get_SelectedMatch() + "\r\nHDP: " + new1.get_HDP() + "\r\nOdds: " + Conversions.ToString(new1.get_Odds()) + "\r\nAmount: " + new1.get_BetAmount() + "\r\n============================================================");
 }
Exemple #6
0
 private void RequestCompleteTicketFromAgent(IAsyncResult result1)
 {
     try
     {
         int num2 = 0;
         int num3 = 0;
         string str11 = "";
         string str12 = "";
         string str9 = "";
         string str7 = "";
         string str3 = "";
         string inputStr = "";
         string str4 = "";
         string str6 = "";
         string str13 = "";
         ArrayList list = new ArrayList();
         string str14 = "";
         string str = "";
         int num = 0;
         WebRequestStateEx2 asyncState = (WebRequestStateEx2) result1.AsyncState;
         WebRequest request = asyncState.get_Request();
         int num4 = 0;
         string str15 = null;
         str13 = CommonFunction.ConvertWebRequestToString(request, ref num4, ref str15);
         if (this.IsLoggedOut(ref str13))
         {
             base._isLoginSuccess = false;
             throw new Exception("Get Ticket Failed, Account Logged Out!");
         }
         this.WriteProgramLogger("Get SingBet Ticket Complete. (" + DateTime.Now.Subtract(base._datTicketStart).TotalMilliseconds.ToString() + "ms)");
         this.WriteBetlistLogger("Ticket: " + str13 + "\r\nActually selected: " + asyncState.get_MatchBetParentSite().get_SelectedMatch());
         this.ExtractInfoFromTicket(str13, asyncState.get_BetType(), ref str11, ref str12, ref str9, ref str4, ref str3, ref str7, ref inputStr, ref str6, ref num2, ref num3, ref str, ref list);
         this.WriteProgramLogger("Odds : " + str7);
         MatchBetNew item = new MatchBetNew();
         item.set_League(str4);
         item.set_SelectedMatch(str9);
         item.set_HDP(str3);
         item.set_OddsString(str7);
         item.set_MaxBetAmount(inputStr);
         item.set_HomeColor(asyncState.get_MatchBetParentSite().get_HomeColor());
         item.set_AwayColor(asyncState.get_MatchBetParentSite().get_AwayColor());
         item.set_BetCoverage(asyncState.get_MatchBetParentSite().get_BetCoverage());
         item.set_BetType(asyncState.get_MatchBetParentSite().get_BetType());
         item.set_BetFollowMethod(asyncState.get_MatchBetParentSite().get_BetFollowMethod());
         item.set_ID(asyncState.get_MatchBetParentSite().get_ID());
         item.set_MemberName(asyncState.get_MatchBetParentSite().get_MemberName());
         item.set_OddsType(base._objBetOddsType);
         if (asyncState.get_MatchChildSite().get_AwayName().ToUpper() == str12.ToUpper())
         {
             item.set_HomeName(str11);
             item.set_HomeScore(num2);
             item.set_AwayName(str12);
             item.set_AwayScore(num3);
         }
         else
         {
             item.set_HomeName(str12);
             item.set_HomeScore(num3);
             item.set_AwayName(str11);
             item.set_AwayScore(num2);
         }
         if (asyncState.get_BetAmount() == Conversions.ToDouble("-1"))
         {
             item.set_BetAmount(inputStr);
         }
         else
         {
             item.set_BetAmount(Conversions.ToString(asyncState.get_BetAmount()));
         }
         if (Conversion.Val(item.get_BetAmount()) > Conversion.Val(inputStr))
         {
             item.set_BetAmount(inputStr);
         }
         if (Conversion.Val(item.get_BetAmount()) > base._intMaxBetLimiter)
         {
             item.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
         }
         if (base._isAutoAdjustToMinBetAmount && (Conversion.Val(item.get_BetAmount()) < Conversion.Val(str6)))
         {
             item.set_BetAmount(str6);
         }
         item.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(item.get_BetAmount()))));
         if (asyncState.get_BetType() == EnumCollection.eBetType.HDP)
         {
             str14 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(("gold=" + item.get_BetAmount() + "&uid=") + this._strUID + "&active=", list[1]), "&strong="), list[2]), "&line_type="), list[3]), "&gid="), list[4]), "&type="), list[5]), "&gnum="), list[6]), "&concede_r="), list[7]), "&radio_r="), list[8]), "&ioradio_r_h="), list[9]), "&gmax_single="), list[10]), "&gmin_single="), list[11]), "&singlecredit="), list[12]), "&singleorder="), list[13]), "&restsinglecredit="), list[14]), "&wagerstotal="), list[15]), "&restcredit="), list[0x10]), "&pay_type="), list[0x11]), "&odd_f_type="), list[0x12]));
         }
         else
         {
             str14 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(Operators.ConcatenateObject(("gold=" + item.get_BetAmount() + "&uid=") + this._strUID + "&active=", list[1]), "&line_type="), list[2]), "&gid="), list[3]), "&type="), list[4]), "&gnum="), list[5]), "&concede_h="), list[6]), "&radio_h="), list[7]), "&ioradio_r_h="), list[8]), "&gmax_single="), list[9]), "&gmin_single="), list[10]), "&singlecredit="), list[11]), "&singleorder="), list[12]), "&restsinglecredit="), list[13]), "&wagerstotal="), list[14]), "&restcredit="), list[15]), "&pay_type="), list[0x10]), "&odd_f_type="), list[0x11]));
         }
         this.WriteBetlistLogger("Bet Post: " + str14);
         if ((asyncState.get_AgentToClientBetObj() != null) && (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt() != null))
         {
             if (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsLessThan)
             {
                 if (SpiderFunction.IsOddsALessThanOddsB(item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                 {
                     this.WriteProgramLogger(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                     item.set_Description(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                     base._objBetListFailed.Add(item);
                     this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                     base._isBetting = false;
                     this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                     return;
                 }
             }
             else if (((asyncState.get_MatchBetParentSite().get_BetFollowMethod() == EnumCollection.eBetFollowMethod.Normal) & (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsDifferentMoreThan)) && (SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()) > asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
             {
                 this.WriteProgramLogger(string.Format("Odds Different Too Much ([{0}] > [{1}])", SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                 item.set_Description(string.Format("Odds Different Too Much ([{0}] > [{1}])", SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()));
                 base._objBetListFailed.Add(item);
                 this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                 base._isBetting = false;
                 this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                 return;
             }
         }
         if ((asyncState.get_MatchBetParentSite().get_HomeScore() == item.get_HomeScore()) & (asyncState.get_MatchBetParentSite().get_AwayScore() == item.get_AwayScore()))
         {
             if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(item, (int) Math.Round(Conversion.Val(item.get_BetAmount())), ref num)))
             {
                 if (num < Conversion.Val(item.get_BetAmount()))
                 {
                     item.set_BetAmount(num.ToString());
                 }
                 this.RaiseEventGetTicketComplete(base._strName, true, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), item);
                 if (base._isAutoBetting)
                 {
                     if (base._isToTrySimilarHDP | (!base._isToTrySimilarHDP & (asyncState.get_MatchBetParentSite().get_HDP() == str3)))
                     {
                         this.WriteProgramLogger("Can Bet SingBet.");
                         this.Bet(request.RequestUri.ToString(), str14, str, item, asyncState.get_MatchParentSite(), asyncState.get_BetTarget());
                     }
                     else
                     {
                         base._isBetting = false;
                         this.WriteProgramLogger("Cannot Bet SingBet.");
                         this.WriteBetlistLogger(SpiderFunction.GenerateDetailedMatchInfo(asyncState.get_MatchBetParentSite(), asyncState.get_MatchBetChildSite(), "Failed Ticket HDP/ODDS Change", "SingAgent"));
                         item.set_Description("HDP/Odds Change");
                         base._objBetListFailed.Add(item);
                         this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                         this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                     }
                 }
                 else
                 {
                     base._isBetting = false;
                     this.WriteProgramLogger("Auto Bet OFF.");
                     item.set_Description("Auto Bet OFF.");
                     base._objBetListFailed.Add(item);
                     this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                     this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                 }
             }
             else
             {
                 base._isBetting = false;
                 this.WriteProgramLogger("Exceed Per Match Limit!");
                 item.set_Description("Exceed Per Match Limit!");
                 base._objBetListFailed.Add(item);
                 this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                 this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
             }
         }
         else
         {
             base._isBetting = false;
             this.WriteProgramLogger(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), item.get_HomeScore(), item.get_AwayScore() }));
             item.set_Description(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), item.get_HomeScore(), item.get_AwayScore() }));
             base._objBetListFailed.Add(item);
             this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
             this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
         }
     }
     catch (Exception exception1)
     {
         ProjectData.SetProjectError(exception1);
         Exception exception = exception1;
         base._isBetting = false;
         base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
         this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
         WebRequestStateEx2 ex2 = (WebRequestStateEx2) result1.AsyncState;
         this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
         ProjectData.ClearProjectError();
     }
 }
Exemple #7
0
        private void RequestCompleteTicketFromAgent(IAsyncResult result1)
        {
            try
            {
                // Michael
                // EnumCollection.eBetType type;
                EnumCollection.eBetType type = EnumCollection.eBetType.HDP;
                int num4 = 0;
                int num = 0;
                string str4 = "";
                string str = "";
                string str10 = "";
                string str8 = "";
                string str3 = "";
                string inputStr = "";
                string str7 = "";
                string str5 = "";
                string str12 = "";
                ArrayList list = new ArrayList();
                string str13 = "";
                int num3 = 0;
                int num2 = 0;
                WebRequestStateEx2 asyncState = (WebRequestStateEx2)result1.AsyncState;
                int num5 = 0;
                string str14 = null;
                str12 = CommonFunction.ConvertWebRequestToString(asyncState.get_Request(), ref num5, ref str14);
                this.WriteProgramLogger("Get SBOBet Ticket Complete. (" + DateTime.Now.Subtract(base._datTicketStart).TotalMilliseconds.ToString() + "ms)");
                this.WriteBetlistLogger("Ticket: " + str12);
                this.WriteProgramLogger("Ticket: " + str12);
                if(string.IsNullOrEmpty(str12) || this.IsLoggedOut(ref str12))
                {
                    throw new Exception(this._strAccountID + " has getted ticket fail.");
                }
                this.ExtractInfoFromTicket(str12, ref str4, ref str, ref str10, ref str5, ref type, ref str3, ref str8, ref inputStr, ref str7, ref num4, ref num, ref num2);
                this.WriteProgramLogger("Odds : " + str8);
                MatchBetNew item = new MatchBetNew();
                item.set_Company(asyncState.get_MatchBetParentSite().get_Company());
                item.set_League(str5);
                item.set_HomeName(str4);
                item.set_AwayName(str);
                item.set_SelectedMatch(asyncState.get_MatchBetParentSite().get_SelectedMatch());
                item.HDPValue = str3;
                if (!string.IsNullOrEmpty(str3))
                {
                    string HDP_id = this.ConvertHDPTypeSBO(str3);
                    item.set_HDP(HDP_id);
                }
                item.set_OddsString(str8);
                item.set_MaxBetAmount(inputStr);
                item.set_SportType(asyncState.get_MatchBetParentSite().get_SportType());
                item.set_HomeColor(asyncState.get_MatchBetParentSite().get_HomeColor());
                item.set_AwayColor(asyncState.get_MatchBetParentSite().get_AwayColor());
                item.set_BetCoverage(asyncState.get_MatchBetParentSite().get_BetCoverage());
                item.set_BetType(asyncState.get_BetType());
                item.set_BetTarget(asyncState.get_BetTarget());
                item.set_BetFollowMethod(asyncState.get_MatchBetParentSite().get_BetFollowMethod());
                item.set_ID(asyncState.get_MatchBetParentSite().get_ID());
                item.set_MemberName(asyncState.get_MatchBetParentSite().get_MemberName());
                item.set_HomeScore(num4);
                item.set_AwayScore(num);
                item.set_MatchType(asyncState.get_MatchBetParentSite().get_MatchType());
                item.set_MatchDate(asyncState.get_MatchBetChildSite().get_MatchDate());
                item.set_OddsType(base._objBetOddsType);
                item.set_GameType(asyncState.get_MatchBetParentSite().get_GameType());
                item.set_RunningStatus(asyncState.get_MatchBetParentSite().get_RunningStatus());

                if (asyncState.get_BetAmount() == Conversions.ToDouble("-1"))
                {
                    item.set_BetAmount(inputStr);
                }
                else
                {
                    item.set_BetAmount(Conversions.ToString(asyncState.get_BetAmount()));
                }

                if (Conversion.Val(item.get_BetAmount()) > Conversion.Val(inputStr))
                {
                    item.set_BetAmount(inputStr);
                }

                /*** start Aorta
                if (Conversion.Val(item.get_BetAmount()) > base._intMaxBetLimiter)
                {
                    item.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
                }
                if (base._isAutoAdjustToMinBetAmount && (Conversion.Val(item.get_BetAmount()) < Conversion.Val(str7)))
                {
                    item.set_BetAmount(str7);
                }***/

                item.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(item.get_BetAmount()))));

                if (str12.Contains(".showTicket(0)"))
                {
                    throw new Exception("Odds are closed or temporary not available.");
                }
                if ((asyncState.get_AgentToClientBetObj() != null) && (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt() != null))
                {
                    if (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsLessThan)
                    {
                        if (SpiderFunction.IsOddsALessThanOddsB(item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                        {
                            item.set_Description(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_OddsString(), asyncState.get_MatchBetParentSite().get_OddsString()));
                            this.WriteProgramLogger(item.get_Description());
                            base._objBetListFailed.Add(item);
                            this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                            this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                            base._isBetting = false;
                            this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                            return;
                        }
                    }
                    else if (((asyncState.get_MatchBetParentSite().get_BetFollowMethod() == EnumCollection.eBetFollowMethod.Normal) & (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsDifferentMoreThan)) && (SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()) > asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                    {
                        item.set_Description(string.Format("Odds Different Too Much ([{0}] > [{1}]", item.get_OddsString(), asyncState.get_MatchBetParentSite().get_OddsString()));
                        this.WriteProgramLogger(item.get_Description());
                        base._objBetListFailed.Add(item);
                        this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                        this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                        base._isBetting = false;
                        this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                        return;
                    }
                }
                base._isBetting = false;
                if ((asyncState.get_MatchBetParentSite().get_HomeScore() == num4) & (asyncState.get_MatchBetParentSite().get_AwayScore() == num))
                {
                    if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(item, (int)Math.Round(Conversion.Val(item.get_BetAmount())), ref num3)))
                    {
                        if (num3 < Conversion.Val(item.get_BetAmount()))
                        {
                            item.set_BetAmount(num3.ToString());
                        }
                        str13 = string.Format("stake={0}&betcount={1}&loginname={2}&stakeInAuto={3}", new object[] { item.get_BetAmount(), num2.ToString(), this._strLoginName, item.get_BetAmount() });
                        this.RaiseEventGetTicketComplete(base._strName, true, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), item);
                        if (base._isAutoBetting)
                        {
                            if (base._isToTrySimilarHDP | (!base._isToTrySimilarHDP & (asyncState.get_MatchBetParentSite().get_HDP() == str3)))
                            {
                                this.WriteProgramLogger("Can Bet SBOBet.[INFO]  " + str13);
                                this.WriteBetlistLogger("Can Bet SBOBet. POST: " + str13);
                                this.Bet(str13, item, asyncState.get_MatchChildSite(), asyncState.get_BetTarget());
                            }
                            else
                            {
                                this.WriteProgramLogger("Cannot Bet SBOBet.");
                                this.WriteBetlistLogger(" Cannot Bet SBOBet. POST: " + str13);
                                this.WriteBetlistLogger(SpiderFunction.GenerateDetailedMatchInfo(asyncState.get_MatchBetParentSite(), asyncState.get_MatchBetChildSite(), "Failed Ticket HDP/ODDS Change", "SBOAgent"));
                                item.set_Description("HDP/Odds Change");
                                base._objBetListFailed.Add(item);
                                this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                                this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                                this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                            }
                        }
                        else
                        {
                            this.WriteProgramLogger("Auto Bet OFF.");
                            item.set_Description("Auto Bet OFF.");
                            base._objBetListFailed.Add(item);
                            this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                            this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                            this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                        }
                    }
                    else
                    {
                        this.WriteProgramLogger("Exceed Per Match Limit!");
                        item.set_Description("Exceed Per Match Limit!");
                        base._objBetListFailed.Add(item);
                        this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                        this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                        this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                    }
                }
                else
                {
                    this.WriteProgramLogger(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), num4, num }));
                    item.set_Description(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), num4, num }));
                    base._objBetListFailed.Add(item);
                    this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                    this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                    this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
                WebRequestStateEx2 ex2 = (WebRequestStateEx2)result1.AsyncState;
                this.get__objBetQueueMonitor().SaveBetInfo(exception.Message, ex2.get_MatchBetParentSite());
                this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #8
0
        private void RequestCompleteTicket(IAsyncResult result1)
        {
            try
            {
                // Michael
                // EnumCollection.eBetType type;
                EnumCollection.eBetType type = EnumCollection.eBetType.HDP;
                string str4 = "";
                string str = "";
                string str10 = "";
                int num2 = 0;
                int num = 0;
                string str8 = "";
                string str3 = "";
                string inputStr = "";
                string str5 = "";
                string str12 = "";
                ArrayList list = new ArrayList();
                WebRequestStateEx2 asyncState = (WebRequestStateEx2) result1.AsyncState;
                int num3 = 0;
                string str14 = null;
                str12 = CommonFunction.ConvertWebRequestToString(asyncState.get_Request(), ref num3, ref str14);
                this.WriteProgramLogger("Get SB188 Ticket Complete.");
                str14 = Conversions.ToString((int) type);
                this.ExtractInfoFromTicket(str12, ref str4, ref str, ref str10, ref str5, ref str14, ref str3, ref str8, ref inputStr, ref num2, ref num);
                type = (EnumCollection.eBetType) Conversions.ToInteger(str14);
                this.WriteProgramLogger("Odds : " + str8);
                MatchBetNew new2 = new MatchBetNew();
                new2.set_League(str5);
                new2.set_HomeName(str4);
                new2.set_AwayName(str);
                new2.set_SelectedMatch(str10);
                new2.set_HDP(str3);
                new2.set_OddsString(str8);
                new2.set_BetType(type);
                new2.set_BetTarget(asyncState.get_BetTarget());
                new2.set_MaxBetAmount(inputStr);
                new2.set_HomeScore(num2);
                new2.set_AwayScore(num);
                switch (base._objBetAmountStyle)
                {
                    case EnumCollection.eBetAmountStyle.Fixed:
                        if (Conversion.Val(base._intDefaultBetAmount) <= Conversion.Val(inputStr))
                        {
                            break;
                        }
                        new2.set_BetAmount(Conversion.Val(inputStr).ToString());
                        goto Label_01A7;

                    case EnumCollection.eBetAmountStyle.MaxBet:
                        new2.set_BetAmount(Conversion.Val(inputStr).ToString());
                        goto Label_01A7;

                    default:
                        goto Label_01A7;
                }
                new2.set_BetAmount(this._intDefaultBetAmount.ToString());
            Label_01A7:
                if (Conversion.Val(new2.get_BetAmount()) > Conversion.Val(inputStr))
                {
                    new2.set_BetAmount(inputStr);
                }
                if (Conversion.Val(new2.get_BetAmount()) > base._intMaxBetLimiter)
                {
                    new2.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
                }
                new2.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(new2.get_BetAmount()))));
                base._isBetting = false;
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicket: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicket: " + exception.Message);
                WebRequestStateEx2 ex2 = (WebRequestStateEx2) result1.AsyncState;
                this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #9
0
        // Aorta
        private void RequestCompleteTicketFromAgent(IAsyncResult result1)
        {
            try
            {
                int num3 = 0;
                int num = 0;
                string str4 = "";
                string str = "";
                string str10 = "";
                string str8 = "";
                string str3 = "";
                string inputStr = "";
                string str5 = "";
                string str7 = "";
                string str2 = "";
                string str11 = "";
                string str9 = "";
                string str12 = "";
                ArrayList list = new ArrayList();
                string str14 = "";
                int num2 = 0;
                string str13 = "";
                WebRequestStateEx2 asyncState = (WebRequestStateEx2)result1.AsyncState;
                int num4 = 0;
                string str16 = null;

                str12 = CommonFunction.ConvertWebRequestToString(asyncState.get_Request(), ref num4, ref str16);
                str13 = str12.ToLower();
                this.WriteProgramLogger("Get IBCBet Ticket Complete. (" + Conversions.ToString(DateTime.Now.Subtract(base._datTicketStart).TotalMilliseconds) + "ms)");
                this.WriteBetlistLogger("Ticket: " + str12);
                this.WriteProgramLogger("Ticket: " + str12);
                if (string.IsNullOrEmpty(str13) || this.IsLoggedOut(ref str12))
                {
                    throw new Exception(this._strAccountID + " has getted ticket fail.");
                }
                this.ExtractInfoFromTicket(str12, ref str4, ref str, ref str10, ref str5, ref str3, ref str8, ref inputStr, ref str7, ref str2, ref str9, ref str11, ref num3, ref num);
                this.WriteProgramLogger("IBCBet Client Odds : " + str8);

                if (!(str13.Contains("suspend") | str13.Contains("'close'")))
                {
                    MatchBetNew item = new MatchBetNew();
                    item.set_Company(asyncState.get_MatchBetParentSite().get_Company());
                    item.set_League(str5);
                    item.set_HomeName(str4);
                    item.set_AwayName(str);
                    item.set_SelectedMatch(str10);
                    item.HDPValue = str3;
                    if (!string.IsNullOrEmpty(str3))
                    {
                        string HDP_id = SportBookFunction.ConvertHDPType(str3);
                        item.set_HDP(HDP_id);
                    }
                    item.set_OddsString(str8);
                    item.set_MaxBetAmount(inputStr);
                    item.set_SportType(asyncState.get_MatchBetParentSite().get_SportType());
                    item.set_HomeColor(asyncState.get_MatchBetParentSite().get_HomeColor());
                    item.set_AwayColor(asyncState.get_MatchBetParentSite().get_AwayColor());
                    item.set_BetCoverage(asyncState.get_MatchBetParentSite().get_BetCoverage());
                    item.set_BetType(asyncState.get_MatchBetParentSite().get_BetType());
                    item.set_BetFollowMethod(asyncState.get_MatchBetParentSite().get_BetFollowMethod());
                    item.set_ID(asyncState.get_MatchBetParentSite().get_ID());
                    item.set_MemberName(asyncState.get_MatchBetParentSite().get_MemberName());
                    item.set_HomeScore(num3);
                    item.set_AwayScore(num);
                    item.set_MatchType(asyncState.get_MatchBetParentSite().get_MatchType());
                    item.set_MatchDate(asyncState.get_MatchBetChildSite().get_MatchDate());
                    item.set_GameType(asyncState.get_MatchBetParentSite().get_GameType());
                    item.set_RunningStatus(asyncState.get_MatchBetParentSite().get_RunningStatus());
                    item.set_MatchID(asyncState.get_MatchBetChildSite().getMatchID());
                    item.set_IPAddress(base.ipAdress);

                    switch (str9)
                    {
                        case "2":
                            item.set_OddsType(EnumCollection.eOddsType.HK);
                            break;

                        case "4":
                            item.set_OddsType(EnumCollection.eOddsType.Malay);
                            break;
                    }

                    if (asyncState.get_BetAmount() == Conversions.ToDouble("-1"))
                    {
                        item.set_BetAmount(inputStr);
                    }
                    else
                    {
                        item.set_BetAmount(Conversions.ToString(asyncState.get_BetAmount()));
                    }

                    if (Conversion.Val(item.get_BetAmount()) > Conversion.Val(inputStr))
                    {
                        item.set_BetAmount(inputStr);
                    }
                    /***** start Aorta
                    if (Conversion.Val(item.get_BetAmount()) > base._intMaxBetLimiter)
                    {
                        //item.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
                    }

                    if (base._isAutoAdjustToMinBetAmount && (Conversion.Val(item.get_BetAmount()) < Conversion.Val(str7)))
                    {
                        item.set_BetAmount(str7);
                    }
                     end Aorta *****/

                    item.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(item.get_BetAmount()))));

                    if ((asyncState.get_AgentToClientBetObj() != null) && (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt() != null))
                    {
                        if (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsLessThan)
                        {
                            if (SpiderFunction.IsOddsALessThanOddsB(item.get_Odds(), asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                            {
                                item.set_Description(string.Format("Odds Too Less ([{0}] < [{1}])", item.get_OddsString(), asyncState.get_MatchBetParentSite().get_OddsString()));
                                this.WriteProgramLogger(item.get_Description());
                                base._objBetListFailed.Add(item);
                                this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                                this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                                base._isBetting = false;
                                this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                                return;
                            }
                        }
                        else if (((asyncState.get_MatchBetParentSite().get_BetFollowMethod() == EnumCollection.eBetFollowMethod.Normal) & (asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_FollowOddsOption() == EnumCollection.eFollowOddsOption.HaltIfOddsDifferentMoreThan)) && (SpiderFunction.GetOddsDiffSameSide(item.get_Odds(), asyncState.get_MatchBetParentSite().get_Odds()) > asyncState.get_AgentToClientBetObj().get_FollowOddsOpt().get_OddsValue()))
                        {
                            item.set_Description(string.Format("Odds Different Too Much ([{0}] > [{1}]", item.get_OddsString(), asyncState.get_MatchBetParentSite().get_OddsString()));
                            this.WriteProgramLogger(item.get_Description());
                            base._objBetListFailed.Add(item);
                            this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                            this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                            base._isBetting = false;
                            this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                            return;
                        }
                    }
                    if ((asyncState.get_MatchBetParentSite().get_HomeScore() == num3) & (asyncState.get_MatchBetParentSite().get_AwayScore() == num))
                    {
                        if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(item, (int)Math.Round(Conversion.Val(item.get_BetAmount())), ref num2)))
                        {
                            if (num2 < Conversion.Val(item.get_BetAmount()))
                            {
                                item.set_BetAmount(num2.ToString());
                            }
                            str14 = "BPstake=" + item.get_BetAmount() + "&stakeRequest=&oddsRequest=" + str8 + "&oddChange1=Odds+has+changed+from&oddChange2=to&MINBET=" + str7 + "&MAXBET=" + inputStr + "&bettype=" + str2 + "&lowerminmesg=Your+stake+is+lower+than+minimun+bet%21%21%21&highermaxmesg=Your+stake+is+higher+than+maximum+bet%21%21%21&areyousuremesg=Are+you+sure+you+want+process+the+bet%3F&incorrectStakeMesg=Incorrect+Stake.&oddsWarning=WARNING%21%21%21+WE+HAVE+GIVEN+A+NEW+ODDS+%26+NEW+STAKE%21%21%21&betconfirmmesg=Please+click+OK+to+confirm+the+bet%3F&siteType=&hidStake10=Stake+must+be+in+multiples+of+10&hidStake20=Stake+must+be+in+multiples+of+20&sporttype=" + str11 + "&username="******"&oddsType=" + str9;
                            this.RaiseEventGetTicketComplete(base._strName, true, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), item);
                            if (base._isAutoBetting)
                            {
                                if (base._isToTrySimilarHDP | (!base._isToTrySimilarHDP & (asyncState.get_MatchBetParentSite().get_HDP() == str3)))
                                {
                                    this.WriteProgramLogger("Can Bet IBCBet.[INFO] " + str14);
                                    this.WriteBetlistLogger("Can Bet IBCBet. POST: " + str14);
                                    this.Bet(str14, item, asyncState.get_MatchChildSite(), asyncState.get_BetTarget());
                                }
                                else
                                {
                                    this.WriteProgramLogger("Cannot Bet IBCBet.[INFO] " + str14);
                                    this.WriteBetlistLogger(" Cannot Bet IBCBet. POST: " + str14);
                                    this.WriteBetlistLogger(SpiderFunction.GenerateDetailedMatchInfo(asyncState.get_MatchBetParentSite(), asyncState.get_MatchBetChildSite(), "Failed Ticket HDP/ODDS Change", "IBCAgent"));
                                    item.set_Description("HDP/Odds Change");
                                    base._objBetListFailed.Add(item);
                                    this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                                    this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                                    base._isBetting = false;
                                    this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                                }
                            }
                            else
                            {
                                this.WriteProgramLogger("Auto Bet OFF.");
                                item.set_Description("Auto Bet OFF.");
                                base._objBetListFailed.Add(item);
                                this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                                base._isBetting = false;
                                this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                            }
                        }
                        else
                        {
                            this.WriteProgramLogger("Exceed Per Match Limit!");
                            item.set_Description("Exceed Per Match Limit!");
                            base._objBetListFailed.Add(item);
                            this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                            this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                            base._isBetting = false;
                            this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                        }
                    }
                    else
                    {
                        this.WriteProgramLogger(string.Format("h Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), num3, num }));
                        item.set_Description(string.Format("Score Changed [{0}-{1}] -> [{2}-{3}]", new object[] { asyncState.get_MatchBetParentSite().get_HomeScore(), asyncState.get_MatchBetParentSite().get_AwayScore(), num3, num }));
                        base._objBetListFailed.Add(item);
                        this.get__objBetQueueMonitor().SaveBetInfo(item.get_Description(), asyncState.get_MatchBetParentSite());
                        this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), item.get_Description());
                        base._isBetting = false;
                        this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                    }
                }
                else
                {
                    string str15 = "";
                    if (str13.Contains("suspend"))
                    {
                        str15 = "Cannot Bet...Match Suspended!";
                    }
                    else if (str13.Contains("'close'"))
                    {
                        str15 = "Cannot Bet...Match Closed!";
                    }
                    else
                    {
                        str15 = "Cannot Bet...Odds is Empty!";
                    }
                    base._isBetting = false;
                    this.WriteProgramLogger(str15);
                    this.get__objBetQueueMonitor().SaveBetInfo(str15, asyncState.get_MatchBetParentSite());
                    this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetParentSite().get_ID(), str15);
                    this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicketFromAgent: " + exception.Message);
                WebRequestStateEx2 ex2 = (WebRequestStateEx2)result1.AsyncState;
                this.get__objBetQueueMonitor().SaveBetInfo(exception.Message, ex2.get_MatchBetParentSite());
                this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
                ProjectData.ClearProjectError();
            }
        }
Exemple #10
0
        private void RequestCompleteTicket(IAsyncResult result1)
        {
            try
            {
                int num2 = 0;
                int num = 0;
                string str4 = "";
                string str = "";
                string str10 = "";
                string str8 = "";
                string str3 = "";
                string inputStr = "";
                string str5 = "";
                string str7 = "";
                string str2 = "";
                string str11 = "";
                string str9 = "";
                string str12 = "";
                ArrayList list = new ArrayList();
                string str13 = "";

                WebRequestStateEx2 asyncState = (WebRequestStateEx2)result1.AsyncState;

                int num3 = 0;
                string str14 = null;
                str12 = CommonFunction.ConvertWebRequestToString(asyncState.get_Request(), ref num3, ref str14);

                this.WriteProgramLogger("Get IBCBet Ticket Complete.");
                this.ExtractInfoFromTicket(str12, ref str4, ref str, ref str10, ref str5, ref str3, ref str8, ref inputStr, ref str7, ref str2, ref str9, ref str11, ref num2, ref num);
                this.WriteProgramLogger("IBCBet Client Odds : " + str8);

                MatchBetNew item = new MatchBetNew();
                item.set_League(str5);
                item.set_HomeName(str4);
                item.set_AwayName(str);
                item.set_SelectedMatch(str10);
                item.set_HDP(str3);
                item.set_OddsString(str8);
                item.set_BetType(asyncState.get_BetType());
                item.set_BetTarget(asyncState.get_BetTarget());
                item.set_MaxBetAmount(inputStr);
                item.set_HomeScore(num2);
                item.set_AwayScore(num);

                switch (base._objBetAmountStyle)
                {
                    case EnumCollection.eBetAmountStyle.Fixed:
                        if (Conversion.Val(base._intDefaultBetAmount) <= Conversion.Val(inputStr))
                        {
                            break;
                        }
                        item.set_BetAmount(Conversion.Val(inputStr).ToString());
                        goto Label_019F;

                    case EnumCollection.eBetAmountStyle.MaxBet:
                        item.set_BetAmount(Conversion.Val(inputStr).ToString());
                        goto Label_019F;

                    default:
                        goto Label_019F;
                }
                item.set_BetAmount(this._intDefaultBetAmount.ToString());
            Label_019F:
                if (Conversion.Val(item.get_BetAmount()) > Conversion.Val(inputStr))
                {
                    item.set_BetAmount(inputStr);
                }
                if (Conversion.Val(item.get_BetAmount()) > base._intMaxBetLimiter)
                {
                    item.set_BetAmount(Conversions.ToString(base._intMaxBetLimiter));
                }

                item.set_BetAmount(Conversions.ToString(Conversion.Int(Conversion.Val(item.get_BetAmount()))));
                base._isBetting = false;

                if ((asyncState.get_MatchBetParentSite().get_HomeScore() == num2) & (asyncState.get_MatchBetParentSite().get_AwayScore() == num))
                {
                    num3 = 0;
                    if (!base._isPerMatchLimitEnabled | (base._isPerMatchLimitEnabled & base._objPerMatchLimitList.IsCanBet(item, ref num3)))
                    {
                        str13 = "BPstake=" + item.get_BetAmount() + "&stakeRequest=&oddsRequest=" + str8 + "&oddChange1=Odds+has+changed+from&oddChange2=to&MINBET=" + str7 + "&MAXBET=" + inputStr + "&bettype=" + str2 + "&lowerminmesg=Your+stake+is+lower+than+minimun+bet%21%21%21&highermaxmesg=Your+stake+is+higher+than+maximum+bet%21%21%21&areyousuremesg=Are+you+sure+you+want+process+the+bet%3F&incorrectStakeMesg=Incorrect+Stake.&oddsWarning=WARNING%21%21%21+WE+HAVE+GIVEN+A+NEW+ODDS+%26+NEW+STAKE%21%21%21&betconfirmmesg=Please+click+OK+to+confirm+the+bet%3F&siteType=&hidStake10=Stake+must+be+in+multiples+of+10&hidStake20=Stake+must+be+in+multiples+of+20&sporttype=" + str11 + "&username="******"&oddsType=" + str9;
                        this.RaiseEventGetTicketComplete(base._strName, true, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), item);
                        if (base._isAutoBetting)
                        {
                            if (SpiderFunction.IsTicketValid(str12, asyncState.get_MatchBetParentSite(), item, 5.0, base._dblOddsDifferentBad, (int)Math.Round(base._dblOddsDifferentBetter)))
                            {
                                this.WriteProgramLogger("Can Bet IBCBet.");
                            }
                            else
                            {
                                this.WriteProgramLogger("Cannot Bet IBCBet.");
                                this.WriteBetlistLogger(SpiderFunction.GenerateDetailedMatchInfo(asyncState.get_MatchParentSite(), asyncState.get_MatchBetChildSite(), item, asyncState.get_BetTarget(), "Failed Ticket HDP/ODDS Change", "IBCAgent"));
                                item.set_Description("HDP/Odds Change");
                                base._objBetListFailed.Add(item);
                                this.get__objBetQueueMonitor().UpdateMatchStatus(asyncState.get_MatchBetChildSite().get_ID(), "Cannot Bet IBCBet.");
                                this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                            }
                        }
                        else
                        {
                            this.WriteProgramLogger("Auto Bet OFF.");
                            this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                        }
                    }
                    else
                    {
                        this.WriteProgramLogger("Exceed Per Match Limit!");
                        this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                    }
                }
                else
                {
                    this.WriteProgramLogger("Score Changed!");
                    this.RaiseEventGetTicketComplete(base._strName, false, asyncState.get_BetTarget(), asyncState.get_MatchParentSite(), asyncState.get_MatchBetParentSite(), asyncState.get_MatchChildSite(), asyncState.get_MatchBetChildSite(), null);
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                Exception exception = exception1;
                base._isBetting = false;
                base._objErrorLogger.write(base._strName + ": EXCEPTION IN RequestCompleteTicket: " + exception.Message);
                this.WriteProgramLogger(base._strName + ": EXCEPTION IN RequestCompleteTicket: " + exception.Message);
                WebRequestStateEx2 ex2 = (WebRequestStateEx2)result1.AsyncState;
                this.RaiseEventGetTicketComplete(base._strName, true, ex2.get_BetTarget(), ex2.get_MatchParentSite(), ex2.get_MatchBetParentSite(), ex2.get_MatchChildSite(), ex2.get_MatchBetChildSite(), null);
                ProjectData.ClearProjectError();
            }
        }
 private void UpdateInfo()
 {
     List<MatchBetNew>.Enumerator enumerator = this._objList.GetEnumerator();
     MatchBetNew current = new MatchBetNew();
     int num = 0;
     try
     {
         //enumerator;
         while (enumerator.MoveNext())
         {
             current = enumerator.Current;
             num = (int) Math.Round((double) (this._intAmountLimit - Conversion.Val(current.get_BetAmount())));
             if (num > 0)
             {
                 current.set_Description("Available: " + num.ToString());
             }
             else
             {
                 current.set_Description("Fulled.");
             }
         }
     }
     finally
     {
         enumerator.Dispose();
     }
 }
 public bool IsCanBet(MatchBetNew new1, ref int numRef1)
 {
     bool flag = false;
     int indexByMatch = -1;
     indexByMatch = this.GetIndexByMatch(new1);
     if (this._objPerMatchLimitType == EnumCollection.ePerMatchLimitType.ByAmount)
     {
         if (indexByMatch > -1)
         {
             numRef1 = (int) Math.Round((double) (this._intAmountLimit - Conversion.Val(this._objList[indexByMatch].get_BetAmount())));
             if (((double) numRef1) > Conversion.Val(new1.get_BetAmount()))
             {
                 numRef1 = (int) Math.Round(Conversion.Val(new1.get_BetAmount()));
             }
             if (numRef1 > 0)
             {
                 flag = true;
             }
             return flag;
         }
         flag = true;
         if (Conversion.Val(new1.get_BetAmount()) > this._intAmountLimit)
         {
             numRef1 = this._intAmountLimit;
             return flag;
         }
         numRef1 = (int) Math.Round(Conversion.Val(new1.get_BetAmount()));
         return flag;
     }
     numRef1 = (int) Math.Round(Conversion.Val(new1.get_BetAmount()));
     if (indexByMatch > -1)
     {
         if (this._objList[indexByMatch].get_LeagueMatchingID() < this._intCountLimit)
         {
             flag = true;
         }
         return flag;
     }
     return (this._intCountLimit > 0);
 }
Exemple #13
0
        /// <summary>
        /// 保存Player下注信息
        /// </summary>
        /// <param name="matchBetNew">新的下注</param>
        /// <returns>保存是否成功</returns>
        public static bool SavePlayerBetInfo(PlayerBet playerBet, MatchBetNew matchBetNew)
        {
            bool isSuccess = false;
            try
            {
                playerBet.Ghost = GetGhostByGhostName(matchBetNew.get_MemberName(), matchBetNew.get_Company());
                playerBet.Player = GetPlayerByPlayerName(playerBet.Player.LoginName);
                playerBet.MatchId = matchBetNew.getMatchID();
                playerBet.LeagueName = matchBetNew.get_League();
                playerBet.SelectedMatch = matchBetNew.get_SelectedMatch();
                playerBet.MatchType = matchBetNew.get_MatchType();
                playerBet.HomeName = matchBetNew.get_HomeName();
                playerBet.AwayName = matchBetNew.get_AwayName();
                playerBet.MatchDate = matchBetNew.get_MatchDate();
                playerBet.betTime = matchBetNew.get_BetDate();
                playerBet.BetCoverage = System.Convert.ToString(matchBetNew.get_BetCoverage());
                playerBet.BetType = System.Convert.ToString(matchBetNew.get_BetType());
                playerBet.Status = System.Convert.ToString(matchBetNew.get_RunningStatus()) + "<br/>" + matchBetNew.get_IPAddress();
                playerBet.SportType = System.Convert.ToString(matchBetNew.get_SportType());
                if (string.IsNullOrEmpty(matchBetNew.HDPValue))
                {
                    matchBetNew.HDPValue = "0.0";
                }
                playerBet.HDP = Double.Parse(matchBetNew.HDPValue);
                playerBet.Odds = matchBetNew.get_Odds();
                playerBet.OddsType = System.Convert.ToString(matchBetNew.get_OddsType());
                playerBet.Amount = int.Parse(matchBetNew.get_BetAmount());
                playerBet.WinValue = 0;
                playerBet.IsOutstanding = true;

                // 创建下注数据访问对象
                BetService ghostBetService = new BetService();
                isSuccess = ghostBetService.AddPlayerBetInfo(playerBet);
            }
            catch (Exception e)
            {

                throw;
            }

            return isSuccess;
        }
Exemple #14
0
        /// <summary>
        /// 保存Ghost下注信息
        /// </summary>
        /// <param name="matchBetNew">新的下注</param>
        /// <returns>保存是否成功</returns>
        public static bool SaveGhostBetInfo(MatchBetNew matchBetNew)
        {
            bool isSuccess = false;
            try
            {
                // 创建gosht下注对象
                GhostBet ghostBet = new GhostBet();
                Ghost ghost = GetGhostByGhostName(matchBetNew.get_MemberName(), matchBetNew.get_Company());
                ghostBet.Ghost = ghost;
                ghostBet.MatchId = matchBetNew.getMatchID();
                ghostBet.LeagueName = matchBetNew.get_League();
                ghostBet.SelectedMatch = matchBetNew.get_SelectedMatch();
                ghostBet.MatchType = matchBetNew.get_MatchType();
                ghostBet.HomeName = matchBetNew.get_HomeName();
                ghostBet.AwayName = matchBetNew.get_AwayName();
                ghostBet.betTime = matchBetNew.get_BetDate();
                ghostBet.BetCoverage = System.Convert.ToString(matchBetNew.get_BetCoverage());
                ghostBet.BetType = System.Convert.ToString(matchBetNew.get_BetType());
                ghostBet.Status = System.Convert.ToString(matchBetNew.get_RunningStatus()) + "<br/>" + matchBetNew.get_IPAddress();
                ghostBet.SportType = System.Convert.ToString(matchBetNew.get_SportType());
                if (string.IsNullOrEmpty(matchBetNew.HDPValue))
                {
                    matchBetNew.HDPValue = "0.0";
                }
                ghostBet.HDP = float.Parse(matchBetNew.HDPValue);
                ghostBet.Odds = (float)matchBetNew.get_Odds();
                ghostBet.Amount = int.Parse(matchBetNew.get_BetAmount());
                ghostBet.WinValue = 0;
                ghostBet.IsOutstanding = true;

                // 创建下注数据访问对象
                BetService ghostBetService = new BetService();
                isSuccess = ghostBetService.AddGhostBetInfo(ghostBet);
            }
            catch (Exception e)
            {

            }

            return isSuccess;
        }