コード例 #1
0
 /// <summary>
 /// Enters all entrants of this lottery into the given lottery
 /// </summary>
 public void CombineInto(ILottery <T> lottery)
 {
     foreach (var e in entrantBlocks.Keys)
     {
         lottery.Enter(e, entrantBlocks[e].TotalSize);
     }
 }
コード例 #2
0
        /// <summary>
        /// Writes the data of the provided <see cref="ILottery"/> to the <see cref="StringBuilder"/>
        /// </summary>
        /// <param name="lottery">The <see cref="ILottery"/> whose data is to be written</param>
        /// <returns>A <see cref="StringBuilder"/> containing string representation of the provided lottery</returns>
        private StringBuilder WriteLotteryData(ILottery lottery)
        {
            Guard.Argument(lottery, nameof(lottery)).NotNull();

            var builder = new StringBuilder();

            AddEntityData(lottery, builder);

            var sportId            = _taskProcessor.GetTaskResult(lottery.GetSportIdAsync());
            var sport              = _taskProcessor.GetTaskResult(lottery.GetSportAsync());
            var category           = _taskProcessor.GetTaskResult(lottery.GetCategoryAsync());
            var tournamentCoverage = _taskProcessor.GetTaskResult(lottery.GetTournamentCoverage());
            var bonusInfo          = _taskProcessor.GetTaskResult(lottery.GetBonusInfoAsync());
            var drawInfo           = _taskProcessor.GetTaskResult(lottery.GetDrawInfoAsync());
            var draws              = _taskProcessor.GetTaskResult(lottery.GetScheduledDrawsAsync());
            var drawsString        = draws == null
                ? "null"
                : string.Join(",", draws.Select(s => s));

            builder.Append(" SportId=").Append(sportId)
            .Append(" Sport=").Append(sport)
            .Append(" Category=").Append(category)
            .Append(" TournamentCoverage=").Append(tournamentCoverage?.LiveCoverage)
            .Append(" BonusInfo=").Append(bonusInfo)
            .Append(" DrawInfo=").Append(drawInfo)
            .Append(" Draws=[").Append(drawsString).Append("]");

            return(builder);
        }
コード例 #3
0
    /// <summary>
    /// Returns a combined lottery between this lottery and the given lottery
    /// </summary>
    /// <param name="lottery"></param>
    /// <returns></returns>
    public ILottery <T> CombineWith(ILottery <T> lottery)
    {
        Lottery <T> result = new Lottery <T>();

        lottery.CombineInto(result);
        this.CombineInto(result);
        return(result);
    }
コード例 #4
0
 public FixedMaster(
     ILottery gameLottery,
     ILottery mediaLottery)
 {
     _gameLottery  = gameLottery;
     _mediaLottery = mediaLottery;
     LoadRegularBookings();
     LoadOnceOffBookings();
 }
コード例 #5
0
 public DrawController(
     ILottery lottery,
     IDrawRepository drawRepository,
     IBallotRepository ballotRepository)
 {
     _lottery          = lottery;
     _drawRepository   = drawRepository;
     _ballotRepository = ballotRepository;
 }
コード例 #6
0
 public ShopController(ILottery lottery,
                       ICustomerRepository customerRepository,
                       IDrawRepository drawRepository,
                       IBallotRepository ballotRepository)
 {
     _lottery            = lottery;
     _customerRepository = customerRepository;
     _drawRepository     = drawRepository;
     _ballotRepository   = ballotRepository;
 }
コード例 #7
0
        public List <string> Save(ILottery newLottery)
        {
            List <string> message = new List <string>();
            ICollection <ValidationResult> validationResults = null;
            bool isValid = Validator.TryValidateObject(newLottery, new ValidationContext(newLottery), validationResults, true);

            if (isValid)
            {
                lotteryTable.Add(newLottery);
            }
            else
            {
                message = validationResults
                          .Select(x => x.ErrorMessage)
                          .ToList();
            }

            return(message);
        }
コード例 #8
0
ファイル: WinCalculate.cs プロジェクト: tianjing/Packages
 /// 
 /// <param name="pLotteryType"></param>
 /// <param name="pLottery"></param>
 public static List<WinDetail> GetWinResult(LotteryType pLotteryType, ILottery pLottery)
 {
     return null;
 }
コード例 #9
0
ファイル: GameList.cs プロジェクト: Quarterback16/RecSchedule
 public GameList(
     ILottery gameLottery)
 {
     Lottery = gameLottery;
 }
コード例 #10
0
ファイル: TwoColor.cs プロジェクト: tianjing/Packages
 /// 
 /// <param name="pLottery"></param>
 public List<WinDetail> GetWinDetails(ILottery pLottery)
 {
     return null;
 }
コード例 #11
0
ファイル: Lottery.cs プロジェクト: msfredb7/GameJam2017
 public void Add(ILottery item)
 {
     Add(item, item.Weight());
 }
コード例 #12
0
 /// <summary>
 /// 抽選を行う
 /// </summary>
 public static bool Lottery(this ILottery self, float addRate = 0.0f)
 {
     return((self.WinningRate + (self.WinningRate * addRate)).Lottery());
 }
コード例 #13
0
 public App(ILottery generator)
 {
     _generator = generator ?? throw new ArgumentNullException(nameof(generator));
 }