예제 #1
0
        /// <summary>
        /// Evaluates the supplied bet and returns a bet result that contains information including whether or not the bet was won and the amount won or lost.
        /// </summary>
        /// <param name="betToEvaluate">Bet to be evaluated.</param>
        /// <returns>Bet result indicating the outcome of the bet.</returns>
        public BetResult EvaluateBet(BetBase betToEvaluate)
        {
            if (betToEvaluate == null)
            {
                throw new ArgumentNullException("betToEvaluate", "betToEvaluate cannot be null.");
            }

            return BetEvaluatorService.GetBetEvaluationStrategy(betToEvaluate).EvaluateBet(betToEvaluate);
        }
예제 #2
0
 /// <summary>
 /// Returns a bet evaluation strategy instance according to the type of bet that is to be evaluated.
 /// </summary>
 /// <param name="betToEvaluate">Bet to be evaluated.</param>
 /// <returns>Implementation of the IBetEvaluationStrategy interface.</returns>
 private static IBetEvaluationStrategy GetBetEvaluationStrategy(BetBase betToEvaluate)
 {
     if (betToEvaluate.GetType() == typeof(PointSpreadBet))
     {
         return new PointSpreadBetEvaluationStrategy();
     }
     else
     {
         throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "The supplied type of bet {0} does not have a bet evaluation strategy.  Make sure a bet with an associated bet evaluation strategy is supplied.", betToEvaluate.GetType()));
     }
 }
        /// <summary>
        /// Evaluates the supplied bet <paramref name="betToEvaluate"/> made against the point spread of a game.
        /// </summary>
        /// <param name="betToEvaluate">Point spread bet to evaluate.</param>
        /// <returns>Result of the point spread bet evaluation.</returns>
        public BetResult EvaluateBet(BetBase betToEvaluate)
        {
            if (betToEvaluate == null)
            {
                throw new ArgumentNullException("betToEvaluate", "betToEvaluate cannot be null.");
            }

            ////Cont. here.  Validate that parameter is of PointSpreadBet type!!

            return null;
        }
예제 #4
0
        internal void RemoveAllMatchBetsOnMatch(Match match)
        {
            foreach (Better better in Round.Tournament.Betters)
            {
                for (int betIndex = 0; betIndex < better.Bets.Count; ++betIndex)
                {
                    if (better.Bets[betIndex] is MatchBet matchBet)
                    {
                        if (matchBet.MatchId == match.Id)
                        {
                            BetBase bet = better.Bets[betIndex--];

                            better.Bets.Remove(bet);
                            bet.MarkForDeletion();
                        }
                    }
                }
            }
        }