public static GamePrizeInfo UserPrize(int gameId, int useId) { IList <GamePrizeInfo> gamePrizeListsByGameId = GetGamePrizeListsByGameId(gameId); int num = gamePrizeListsByGameId.Max <GamePrizeInfo>((Func <GamePrizeInfo, int>)(p => p.PrizeRate)); GamePrizeInfo item = new GamePrizeInfo { PrizeId = 0, PrizeRate = (num >= 100) ? 0 : 100, PrizeGrade = PrizeGrade.未中奖 }; gamePrizeListsByGameId.Add(item); GamePrizeInfo info2 = ChouJiang(gamePrizeListsByGameId); if ((info2.PrizeId != 0) && (info2.PrizeCount <= 0)) { info2 = item; } if (((info2.PrizeId != 0) && (info2.PrizeType == PrizeType.赠送优惠劵)) && (CouponHelper.IsCanSendCouponToMember(int.Parse(info2.GiveCouponId), useId) != SendCouponResult.正常领取)) { info2 = item; } PrizeResultInfo model = new PrizeResultInfo { GameId = gameId, PrizeId = info2.PrizeId, UserId = useId }; new PrizeResultDao().AddPrizeLog(model); return(info2); }
public static string GetPrizeName(PrizeResultViewInfo item) { switch (item.PrizeType) { case PrizeType.赠送积分: return(string.Format("{0} 积分", item.GivePoint)); case PrizeType.赠送优惠劵: return(Globals.SubStr(CouponHelper.GetCoupon(int.Parse(item.GiveCouponId)).CouponName, 12, "..")); case PrizeType.赠送商品: return(Globals.SubStr(ProductHelper.GetProductBaseInfo(int.Parse(item.GiveShopBookId)).ProductName, 12, "..")); } return(""); }
public static string GetCouponProductIds(int couponId) { DataTable couponProducts = CouponHelper.GetCouponProducts(couponId); StringBuilder stringBuilder = new StringBuilder(); if (couponProducts != null) { int count = couponProducts.Rows.Count; for (int i = 0; i < count; i++) { stringBuilder.Append(couponProducts.Rows[i]["ProductId"].ToString()); if (i != count - 1) { stringBuilder.Append("_"); } } } return(stringBuilder.ToString()); }