Ejemplo n.º 1
0
 /// <summary>
 /// Places a bet against the match
 /// </summary>
 /// <param name="b">The bet to place</param>
 public void placeBet(Bet b)
 {
     this._betPlaced = b;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Attempts to place a bet against this bookie
 /// If it fails, an exception is thrown with the reason for failure
 /// </summary>
 /// <param name="bet">The bet to place</param>
 public void addBet(Bet bet)
 {
     if (this.Connected)
     {
         string result = Connection.placeBet(bet);
         if (result.Equals(Model.RPC.Common.PlaceBetResult.ACCEPTED.ToString()))
         {
             lock (lockObj)
             {
                 this._listOfBets.Add(bet);
             }
         }
         else
         {
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.REJECTED_UNKNOWN_MATCH.ToString()))
                 throw new Controller.UnknownMatch(bet.MatchID);
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.REJECTED_UNKNOWN_TEAM.ToString()))
                 throw new Controller.UnknownTeam(bet.TeamID);
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.REJECTED_ALREADY_PLACED_BET.ToString()))
                 throw new Controller.BetAlreadyPlaced();
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.REJECTED_LIMIT_EXCEEDED.ToString()))
                 throw new Controller.BetLimitExceeded(result);
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.REJECTED_ODDS_MISMATCH.ToString()))
                 throw new Controller.OddsMismatch(bet.Odds, bet.TeamID);
             if (result.StartsWith(Model.RPC.Common.PlaceBetResult.LOST_CONNECTION.ToString()))
                 throw new Controller.ConnectionDropped();
         }
     }
 }