Example #1
0
        /// <summary>
        /// 创建快速下单(十二生肖,双单等)注单
        /// </summary>
        /// <param name="member">The member.</param>
        /// <param name="specie">The specie.</param>
        /// <param name="betList">The bet list.</param>
        /// <returns></returns>
        public IDictionary<BetSheet, IList<BetOrder>> BuildAutoBetOrder(User member, LotterySpecies specie, IEnumerable<AutoBetItem> betList)
        {
            this._betResult = new BetResult();
            BetResult returnResult = new Models.BetResult();
            var todayLotteryCompany = TodayLotteryCompany.Instance.GetTodayCompany();       //获取今日开奖公司
            var memberComm = CommManager.GetMemberCommissionInSession(member, specie);        //获取会员的佣金
            IDictionary<BetSheet, IList<BetOrder>> betSheetDic = new Dictionary<BetSheet, IList<BetOrder>>();
            IDictionary<BetSheet, IList<BetOrder>> resultDic = new Dictionary<BetSheet, IList<BetOrder>>();
            foreach (var betOrder in betList)
            {
                int[] nums;
                switch (betOrder.BetType)
                {
                    case AutoBetType.TwelveZodiac: nums = LotterySystem.Current.TwelveZodiac; break;
                    case AutoBetType.EvenEven: nums = LotterySystem.Current.EvenEven; break;
                    case AutoBetType.EvenOdd: nums = LotterySystem.Current.EvenOdd; break;
                    case AutoBetType.OddEven: nums = LotterySystem.Current.OddEven; break;
                    case AutoBetType.OddOdd: nums = LotterySystem.Current.OddOdd; break;
                    default: throw new InvalidDataException("不可到达,数据异常!");
                }
                var sheet = BuildAutoElectionCodeOrder(member, specie, betOrder.CompanyList, betOrder.WagerList, nums);
                betSheetDic.AddRange(sheet);
                returnResult.Append(this.BetResult);

                List<BetOrder> orderList = new List<BetOrder>();
                foreach (var item in betSheetDic)
                    orderList.AddRange(item.Value);
                StringBuilder companySb = new StringBuilder();
                foreach (var companyId in betOrder.CompanyList)
                {
                    var company = todayLotteryCompany.Find(it => it.CompanyId == companyId);
                    if (company == null)
                        throw new InvalidDataException("CompanyId:" + companyId);
                    companySb.AppendFormat("{0} ", company.Abbreviation);
                }
                BetSheet orderSheet = new BetSheet
                {
                    Num = betOrder.BetType.ToString(),
                    Turnover = orderList.Sum(it => it.Turnover),
                    NetAmount = orderList.Sum(it => it.NetAmount),
                    Commission = orderList.Sum(it => it.Commission),
                    UserId = member.UserId,
                    Status = BetStatus.Valid,
                    IPAddress = IPHelper.IPAddress,
                    BetCompany = companySb.ToString(),
                    BetAmount = JoinSheetBetAmount(sheet.Keys)
                };
                resultDic.Add(orderSheet, orderList);
                betSheetDic.Clear();
            }
            this._betResult = returnResult;
            return resultDic;
        }
Example #2
0
        public void Append(BetResult result)
        {
            this.ActualTurnover += result.ActualTurnover;
            this.ExceptTurnover += result.ExceptTurnover;
            if (result.NotAcceptOrderList != null && result.NotAcceptOrderList.Count > 0)
            {
                var notAccept = this.NotAcceptOrderList as List<BetOrder>;
                notAccept.AddRange(result.NotAcceptOrderList);
            }

            if (result.DropOrderList != null && result.DropOrderList.Count > 0)
            {
                var dropList = this.DropOrderList as List<BetOrder>;
                dropList.AddRange(result.DropOrderList);
            }
        }
Example #3
0
 public object BuildBetResult(BetResult result)
 {
     var companys = TodayLotteryCompany.Instance.GetTodayCompany();
     return new
     {
         ActualTurnover = result.ActualTurnover,
         ExceptTurnover = result.ExceptTurnover,
         Drops = result.DropOrderList.Select(it => new
         {
             Num = it.Num,
             Company = companys.Find(x => x.CompanyId == it.CompanyId).Abbreviation,
             GameType = Extended.GetGPWDescription(it.GamePlayWayId),
             Drop = it.DropWater,
             Net = it.Net.ToString("N")
         }),
         NotAccept = result.NotAcceptOrderList.Select(it => new
         {
             Num = it.Num,
             Company = companys.Find(x => x.CompanyId == it.CompanyId).Abbreviation,
             GameType = Extended.GetGPWDescription(it.GamePlayWayId)
         })
     };
 }
Example #4
0
 /// <summary>
 /// 创建注单
 /// </summary>
 /// <param name="user">The user.</param>
 /// <param name="speice">The speice.</param>
 /// <param name="betList">The bet list.</param>
 /// <param name="isCon">是否快速下单.</param>
 /// <returns></returns>
 public IDictionary<BetSheet, IList<BetOrder>> BuildOrder(User user, LotterySpecies specie, IEnumerable<BetItem> betList, bool isCon = false)
 {
     try
     {
         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();
         foreach (var betItem in betList)
         {
             var numList = ParseBetNums(betItem.Num);
             if (numList == null) continue;
             IList<long> fullArrangementNum = null;      //全排列号码
             BetSheet sheet = new BetSheet               //注单
             {
                 Num = betItem.Num,
                 UserId = user.UserId,
                 Status = BetStatus.Valid
             };
             betCompanySB.Clear();
             betWagerList.Clear();
             betSheetDic.Add(sheet, new List<BetOrder>());
             foreach (var companyId in betItem.CompanyList)      //先遍历公司列表,同个号码支持多个公司
             {
                 var company = todayLotteryCompany.Find(it => it.CompanyId == companyId);        //找到对应的公司
                 var companyType = company.CompanyType;
                 foreach (var wager in betItem.WargerList)       //便利下注订单
                 {
                     if (wager.Wager <= 0) continue;
                     CheckBetWager(wager.GamePlayTypeId, wager.IsFullPermutation, wager.Wager, betWagerList);
                     foreach (var num in numList)
                         AddOrderToDic(betSheetDic[sheet], companyType, company, memberComm, num, wager, user, fullArrangementNum, isCon);
                 }
                 betCompanySB.AppendFormat("{0} ", company.Abbreviation);    //现在只记录公司名称即可
             }
             sheet.BetCompany = betCompanySB.ToString();
             sheet.BetAmount = GetBetWagerData(betSheetDic[sheet], betWagerList);
         }
         return betSheetDic;
     }
     catch
     {
         //回滚注单
         foreach (var order in Checker.BeInsertOrderList)
             Checker.RollLimit(order);
         throw;
     }
 }
Example #5
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;
 }