コード例 #1
0
ファイル: AwardsBLL.cs プロジェクト: PenAndy/Lottomat
 /// <summary>
 /// 保存表单(新增、修改)
 /// </summary>
 /// <param name="keyValue">主键值</param>
 /// <param name="entity">实体对象</param>
 /// <returns></returns>
 public void SaveForm(string keyValue, AwardsEntity entity)
 {
     try
     {
         service.SaveForm(keyValue, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #2
0
ファイル: AwardsController.cs プロジェクト: PenAndy/Lottomat
 public ActionResult SaveForm(string keyValue, AwardsEntity entity)
 {
     awardsbll.SaveForm(keyValue, entity);
     return(Success("操作成功。"));
 }
コード例 #3
0
        public HttpResponseMessage GetIntroductionOfLottery(IntroductionOfLotteryArgEntity arg)
        {
            BaseJson <IntroductionOfLotteryViewEntity> resultMsg = new BaseJson <IntroductionOfLotteryViewEntity> {
                Status = (int)JsonObjectStatus.Error, Message = "服务器未知错误。", Data = null
            };

            Logger(typeof(CommonController), arg.ToJson(), "获取彩票的玩法、介绍、中奖规则-GetIntroductionOfLottery", () =>
            {
                if (!string.IsNullOrEmpty(arg.t) && !string.IsNullOrEmpty(arg.EnumCode))
                {
                    if (arg.t.CheckTimeStamp())
                    {
                        IntroductionOfLotteryViewEntity cache = Cache.Factory.CacheFactory.Cache().GetCache <IntroductionOfLotteryViewEntity>(CacheKeyEnum.IntroductionOfLottery.ToString() + "__" + arg.EnumCode);
                        if (cache == null)
                        {
                            string codeList = GetCodeList();

                            //获取所有彩种
                            List <DataItemModel> dataItem = dataItemCache.GetDataItemList(codeList).OrderBy(d => d.SortCode ?? 0).ToList();
                            //得到当前彩种ID
                            string id = dataItem.Where(d => d.SimpleSpelling.Equals(arg.EnumCode)).Select(d => d.ItemDetailId).FirstOrDefault();

                            AwardsEntity temp = awardsBll.GetEntity(f => f.IsDelete == false && f.PrizeID.Equals(id));
                            if (temp != null)
                            {
                                cache = new IntroductionOfLotteryViewEntity
                                {
                                    Gameplay    = temp.Gameplay,
                                    LotteryRule = temp.LotteryRule,
                                    LotteryTime = temp.LotteryTime,
                                    Winning     = temp.Winning
                                };
                                Cache.Factory.CacheFactory.Cache().WriteCache(cache, CacheKeyEnum.IntroductionOfLottery.ToString() + "__" + arg.EnumCode, DateTimeHelper.Now.AddDays(30));
                            }
                        }

                        resultMsg = new BaseJson <IntroductionOfLotteryViewEntity>
                        {
                            Status  = (int)JsonObjectStatus.Success,
                            Data    = cache,
                            Message = JsonObjectStatus.Success.GetEnumText(),
                            BackUrl = null
                        };
                    }
                    else
                    {
                        resultMsg = new BaseJson <IntroductionOfLotteryViewEntity>
                        {
                            Status  = (int)JsonObjectStatus.Fail,
                            Data    = null,
                            Message = JsonObjectStatus.Fail.GetEnumText() + ",无效参数。",
                            BackUrl = null
                        };
                    }
                }
                else
                {
                    resultMsg = new BaseJson <IntroductionOfLotteryViewEntity>
                    {
                        Status  = (int)JsonObjectStatus.Fail,
                        Data    = null,
                        Message = JsonObjectStatus.Fail.GetEnumText() + ",请求参数为空。",
                        BackUrl = null
                    };
                }
            }, e =>
            {
                resultMsg = new BaseJson <IntroductionOfLotteryViewEntity>
                {
                    Status  = (int)JsonObjectStatus.Exception,
                    Data    = null,
                    Message = JsonObjectStatus.Exception.GetEnumText() + ",异常信息:" + e.Message,
                    BackUrl = null
                };
            });

            return(resultMsg.TryToJson().ToHttpResponseMessage());
        }