Exemplo n.º 1
0
        /// <summary>
        /// 处理兑奖
        /// </summary>
        private void OnSaveStatus()
        {
            string itemsAppend = hV.Value.Trim();

            if (string.IsNullOrEmpty(itemsAppend))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "请至少勾选一行进行操作", "错误提醒", "error");
                return;
            }

            if (bll == null)
            {
                bll = new BLL.UserTicket();
            }
            string[]      itemsAppendArr = itemsAppend.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            List <string> list           = itemsAppendArr.ToList <string>();

            if (bll.UpdateStatusBatch(list))
            {
                WebHelper.MessageBox.MessagerShow(this.Page, lbtnPostBack, "操作成功");
                Bind();
            }
            else
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "操作失败", "系统提示");
            }
        }
Exemplo n.º 2
0
        private void Bind()
        {
            //查询条件
            GetSearchItem();

            int totalCount = 0;

            if (bll == null)
            {
                bll = new BLL.UserTicket();
            }

            rpData.DataSource = bll.GetDataSet(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms == null ? null : parms.ToArray());;
            rpData.DataBind();
            AspNetPager1.RecordCount = totalCount;
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取前第15行数据
        /// </summary>
        /// <returns></returns>
        public static List <Model.UserTicket> GetListByTop()
        {
            BLL.UserTicket bll = new BLL.UserTicket();

            if (!enableCaching)
            {
                return(bll.GetList(1, 15, "", null));
            }

            string key = "userTicket_top";
            List <Model.UserTicket> data = (List <Model.UserTicket>)HttpRuntime.Cache[key];

            if (data == null)
            {
                data = bll.GetList(1, 15, "", null);

                AggregateCacheDependency cd = DependencyFactory.GetUserTicketDependency();
                HttpRuntime.Cache.Add(key, data, cd, DateTime.Now.AddHours(userTicketTimeout), Cache.NoSlidingExpiration, CacheItemPriority.High, null);
            }

            return(data);
        }
Exemplo n.º 4
0
        private void OnSave(object nId)
        {
            BLL.PrizeTicket   ptBll   = new BLL.PrizeTicket();
            Model.PrizeTicket ptModel = ptBll.GetModel(nId.ToString());
            if (ptModel == null)
            {
                WebHelper.MessageBox.Messager(this.Page, rpData.Controls[0], "没有找到相关奖品");
                return;
            }

            decimal pointNum = ptModel.PointNum;

            BLL.UserPoint uBll     = new BLL.UserPoint();
            object        userId   = WebHelper.Common.GetUserId();
            DateTime      currTime = DateTime.Now;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
            {
                Model.UserPoint uModel = uBll.GetModelByUser(userId);
                if (uModel == null)
                {
                    WebHelper.MessageBox.Messager(this.Page, rpData.Controls[0], "您的棋子数额不足,无法兑换");
                    return;
                }
                decimal userPointNum = uModel.PointNum;
                decimal currPointNum = userPointNum - pointNum;
                if (currPointNum < 0)
                {
                    WebHelper.MessageBox.Messager(this.Page, rpData.Controls[0], "您的棋子数额不足,无法兑换");
                    return;
                }

                Model.UserTicket utModel = new Model.UserTicket();
                utModel.PrizeTicketID   = ptModel.NumberID;
                utModel.UserID          = userId;
                utModel.Status          = 0;
                utModel.LastUpdatedDate = currTime;

                BLL.UserTicket utBll = new BLL.UserTicket();
                if (utBll.Insert(utModel) > 0)
                {
                    uModel.PointNum        = currPointNum;
                    uModel.LastUpdatedDate = currTime;

                    if (uBll.Update(uModel) > 0)
                    {
                        //操作成功,提交事务
                        scope.Complete();

                        Response.Redirect("/u/ta.html");
                    }
                    else
                    {
                        WebHelper.MessageBox.Messager(this.Page, rpData.Controls[0], "奖品兑换失败,无法兑换", "系统异常");
                        return;
                    }
                }
                else
                {
                    WebHelper.MessageBox.Messager(this.Page, rpData.Controls[0], "奖品兑换失败,无法兑换", "系统异常");
                    return;
                }
            }
        }