Example #1
0
        /// <summary>
        /// 创建一个注单并附加到一个Sheet上
        /// </summary>
        /// <param name="orderList">The order list.</param>
        /// <param name="companyType">Type of the company.</param>
        /// <param name="company">The company.</param>
        /// <param name="memberComm">The member comm.</param>
        /// <param name="num">The num.</param>
        /// <param name="wager">The wager.</param>
        /// <param name="user">The user.</param>
        /// <param name="fullArrangementNum">The full arrangement num.</param>
        /// <param name="isCon">if set to <c>true</c> [is con].</param>
        private void AddOrderToDic(IList<BetOrder> orderList, CompanyType companyType, LotteryCompany company, Pair<CommissionGroup, IEnumerable<ConcreteCommission>> memberComm,
            string num, WagerItem wager, User user, IList<long> fullArrangementNum, bool isCon = false)
        {
            List<GamePlayWay> gamePlayWayList = new List<GamePlayWay>();
            var gamePlayWay = LotterySystem.Current.FindGamePlayWay(wager.GamePlayTypeId);     //找到下注的游戏玩法
            var playWay = gamePlayWay.PlayWay;
            if (playWay == PlayWay.HeadAndLast)     //头尾则分解为头,尾两注
            {
                Func<PlayWay, GamePlayWay> findPlayWayFun = (pw) =>
                {
                    return LotterySystem.Current.FindGamePlayWay(gamePlayWay.GameType, pw);
                };
                var headPlayWay = findPlayWayFun(PlayWay.Head);
                var lastPlayWay = findPlayWayFun(PlayWay.Last);
                gamePlayWayList.Add(headPlayWay);
                gamePlayWayList.Add(lastPlayWay);
            }
            else
                gamePlayWayList.Add(gamePlayWay);
            Action<string, int, GamePlayWay> buildOrderToListFunc = (n, q, gpw) =>
            {
                var order = BuildBetOrder(n, q, memberComm, gpw, company, wager.Wager, user, isCon);
                this.BetResult.ExceptTurnover += order.Turnover;
                if (company.IsInBetTime(gpw) && Checker.Check(order, user))
                {
                    orderList.Add(order);
                    this.BetResult.ActualTurnover += order.Turnover;
                    Checker.BeInsertOrderList.Add(order);

                    if (Checker.IsDrop)
                        this.BetResult.DropOrderList.Add(order);
                }
                else
                {
                    this.BetResult.NotAcceptOrderList.Add(order);
                }
            };
            gamePlayWayList.ForEach(x =>
            {
                var counter = NumQuantityCounterFactory.GetFactory.GetCounter(x.GameType, companyType, LotterySystem.Current.GetNumLenSupport(companyType));
                var betNum = counter.GetRealyBetNum(num);
                int numQuantity = CountNumQuantity(betNum, x, companyType); //计算该玩法的号码长度
                if (wager.IsFullPermutation)    //是否全排列下注
                {
                    if (fullArrangementNum == null) //获取号码全排列
                        fullArrangementNum = MathHelper.GetFullArrangement(betNum);
                    fullArrangementNum.ForEach(it => buildOrderToListFunc(it.ToString("D" + betNum.Length), numQuantity, x));
                }
                else
                    buildOrderToListFunc(betNum, numQuantity, x);
            });
        }
Example #2
0
 /// <summary>
 /// 检查下注额(用于累加,最后表示本次注单的下注信息)
 /// </summary>
 /// <param name="gameplaywayId">The gameplayway id.</param>
 /// <param name="isFullPermutation">if set to <c>true</c> [is full permutation].</param>
 /// <param name="wagerList">The wager list.</param>
 private void CheckBetWager(int gameplaywayId, bool isFullPermutation, decimal amount, List<WagerItem> wagerList)
 {
     //var gpw = LotterySystem.Current.FindGamePlayWay(gameplaywayId);
     //PlayWay playway = gpw.PlayWay;
     ////將頭尾才分為頭,尾兩種
     //if (playway == PlayWay.HeadAndLast)
     //{
     //    var newGPW = LotterySystem.Current.FindGamePlayWay(gpw.GameType, PlayWay.Head);
     //    CheckBetWager(newGPW.Id, isFullPermutation, wagerList);
     //    newGPW = LotterySystem.Current.FindGamePlayWay(gpw.GameType, PlayWay.Last);
     //    CheckBetWager(newGPW.Id, isFullPermutation, wagerList);
     //}
     //else
     //{
     var wagerItem = wagerList.Find(it => it.GamePlayTypeId == gameplaywayId);
     if (wagerItem == null)
     {
         wagerItem = new WagerItem
         {
             GamePlayTypeId = gameplaywayId,
             IsFullPermutation = false,
             Wager = amount
         };
         wagerList.Add(wagerItem);
     }
     if (isFullPermutation)
         wagerItem.IsFullPermutation = true;
     //}
 }
Example #3
0
 public IDictionary<BetSheet, IList<BetOrder>> BuildFastBetOrder(User user, LotterySpecies specie, FastBetItem fastBetItem, GameType gameType)
 {
     this._betResult = new BetResult();
     var todayLotteryCompany = TodayLotteryCompany.Instance.GetTodayCompany();       //获取今日开奖公司
     var memberComm = CommManager.GetMemberCommissionInSession(user, specie);        //获取会员的佣金
     Dictionary<BetSheet, IList<BetOrder>> betSheetDic = new Dictionary<BetSheet, IList<BetOrder>>();    //注单字典
     List<WagerItem> betWagerList = new List<WagerItem>();        //下注金額列表
     StringBuilder betCompanySB = new StringBuilder();
     BetSheet sheet = new BetSheet               //注单
     {
         Num = "FastBet" + EnumHelper.GetEnumDescript(gameType).Description,
         UserId = user.UserId,
         Status = BetStatus.Valid
     };
     betSheetDic.Add(sheet, new List<BetOrder>());
     foreach (var companyId in fastBetItem.Companys)
     {
         IList<long> fullArrangementNum = null;      //全排列号码
         var company = todayLotteryCompany.Find(it => it.CompanyId == companyId);        //找到对应的公司
         var companyType = company.CompanyType;
         foreach (var gpwId in fastBetItem.GamePlayWays)
         {
             CheckBetWager(gpwId, fastBetItem.IsFullPermutation, fastBetItem.Wager, betWagerList);
             var wager = new WagerItem { GamePlayTypeId = gpwId, Wager = fastBetItem.Wager, IsFullPermutation = fastBetItem.IsFullPermutation };
             foreach (var num in fastBetItem.NumList)
             {
                 AddOrderToDic(betSheetDic[sheet], companyType, company, memberComm, num, wager, user, fullArrangementNum, false);
             }
         }
         betCompanySB.AppendFormat("{0} ", company.Abbreviation);    //现在只记录公司名称即可
         sheet.BetCompany = betCompanySB.ToString();
         sheet.BetAmount = GetBetWagerData(betSheetDic[sheet], betWagerList);
     }
     return betSheetDic;
 }