Пример #1
0
 public string GetPrizeName(PrizeGrade prizeGrade)
 {
     if (prizeGrade == PrizeGrade.未中奖)
     {
         return("谢谢参与");
     }
     return(prizeGrade.ToString());
 }
Пример #2
0
        private GamePrizeInfo GetModel(PrizeGrade prizeGrade)
        {
            GamePrizeInfo gamePrizeInfo = new GamePrizeInfo();

            gamePrizeInfo.PrizeGrade = prizeGrade;
            PrizeType prizeType = PrizeType.赠送积分;

            try
            {
                prizeType = (PrizeType)Enum.Parse(typeof(PrizeType), base.Request[string.Format("prizeType_{0}", (int)prizeGrade)]);
            }
            catch (Exception)
            {
            }
            gamePrizeInfo.PrizeType = prizeType;
            switch (prizeType)
            {
            case PrizeType.赠送积分:
                try
                {
                    gamePrizeInfo.GivePoint = int.Parse(base.Request[string.Format("txtGivePoint{0}", (int)prizeGrade)]);
                    gamePrizeInfo.Prize     = base.Request[string.Format("txtPrize{0}", (int)prizeGrade)];
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("{0}的赠送积分格式不对!", prizeGrade.ToString()));
                }
                break;

            case PrizeType.赠送优惠券:
                break;

            case PrizeType.赠送商品:
                gamePrizeInfo.GiveShopBookId      = base.Request[string.Format("txtShopbookId{0}", (int)prizeGrade)];
                gamePrizeInfo.GriveShopBookPicUrl = base.Request[string.Format("txtProductPic{0}", (int)prizeGrade)];
                gamePrizeInfo.Prize = base.Request[string.Format("txtPrize{0}", (int)prizeGrade)];
                break;

            case PrizeType.其他奖品:
                try
                {
                    gamePrizeInfo.IsLogistics = ((base.Request[string.Format("ckbNeed_{0}", (int)prizeGrade)] == "on") ? 1 : 0);
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("{0}的是否配送格式不对!", prizeGrade.ToString()));
                }
                gamePrizeInfo.PrizeImage = base.Request[string.Format("hiddPrizeImage{0}", (int)prizeGrade)];
                try
                {
                    gamePrizeInfo.Prize = base.Request[string.Format("txtPrize{0}", (int)prizeGrade)];
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("{0}的奖品名称格式不对!", prizeGrade.ToString()));
                }
                break;

            default:
                gamePrizeInfo.Prize = base.Request[string.Format("txtPrize{0}", (int)prizeGrade)];
                break;
            }
            gamePrizeInfo.GiveCouponId = base.Request[string.Format("seletCouponId{0}", (int)prizeGrade)];
            try
            {
                gamePrizeInfo.PrizeCount = int.Parse(base.Request[string.Format("txtPrizeCount{0}", (int)prizeGrade)]);
            }
            catch (Exception)
            {
                throw new Exception(string.Format("{0}的奖品数量格式不对!", prizeGrade.ToString()));
            }
            try
            {
                gamePrizeInfo.PrizeId = int.Parse(base.Request[string.Format("prizeInfoId{0}", (int)prizeGrade)]);
            }
            catch (Exception)
            {
                gamePrizeInfo.PrizeId = 0;
            }
            try
            {
                gamePrizeInfo.GameId = int.Parse(base.Request[string.Format("prizeGameId{0}", (int)prizeGrade)]);
            }
            catch (Exception)
            {
                gamePrizeInfo.GameId = 0;
            }
            return(gamePrizeInfo);
        }
Пример #3
0
        private GamePrizeInfo GetModel(PrizeGrade prizeGrade)
        {
            GamePrizeInfo info = new GamePrizeInfo {
                PrizeGrade = prizeGrade
            };
            int       num  = (int)prizeGrade;
            PrizeType type = PrizeType.赠送积分;

            try
            {
                type = (PrizeType)Enum.Parse(typeof(PrizeType), base.Request[string.Format("prizeType_{0}", num)]);
            }
            catch (Exception)
            {
            }
            info.PrizeType = type;
            switch (type)
            {
            case PrizeType.赠送积分:
                try
                {
                    info.GivePoint = int.Parse(base.Request[string.Format("txtGivePoint{0}", num)]);
                    goto Label_0112;
                }
                catch (Exception)
                {
                    throw new Exception(string.Format("{0}的赠送积分格式不对!", prizeGrade.ToString()));
                }
                break;

            case PrizeType.赠送优惠劵:
                break;

            case PrizeType.赠送商品:
                info.GiveShopBookId      = base.Request[string.Format("txtShopbookId{0}", num)];
                info.GriveShopBookPicUrl = base.Request[string.Format("txtProductPic{0}", num)];
                goto Label_0112;

            default:
                goto Label_0112;
            }
            info.GiveCouponId = base.Request[string.Format("seletCouponId{0}", num)];
Label_0112:
            try
            {
                info.PrizeCount = int.Parse(base.Request[string.Format("txtPrizeCount{0}", num)]);
            }
            catch (Exception)
            {
                throw new Exception(string.Format("{0}的奖品数量格式不对!", prizeGrade.ToString()));
            }
            try
            {
                info.PrizeRate = int.Parse(base.Request[string.Format("txtPrizeRate{0}", num)]);
            }
            catch (Exception)
            {
                throw new Exception(string.Format("{0}的中奖率格式不对!", prizeGrade.ToString()));
            }
            try
            {
                info.PrizeId = int.Parse(base.Request[string.Format("prizeInfoId{0}", num)]);
            }
            catch (Exception)
            {
                info.PrizeId = 0;
            }
            try
            {
                info.GameId = int.Parse(base.Request[string.Format("prizeGameId{0}", num)]);
            }
            catch (Exception)
            {
                info.GameId = 0;
            }
            return(info);
        }