Exemplo n.º 1
0
 /// <summary>
 /// 重写虚方法,此方法将在Init事件前执行
 /// </summary>
 protected override void ShowPage()
 {
     BLL.prizes pbll = new BLL.prizes();
     DataSet ds = pbll.GetList(30, "*", "id>0", "id desc");
     if (ds != null && ds.Tables.Count > 0)
     {
         p_dt = ds.Tables[0];
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            BLL.prizes pbll = new BLL.prizes();
            DataSet    ds   = pbll.GetList(30, "*", "id>0", "id desc");

            if (ds != null && ds.Tables.Count > 0)
            {
                p_dt = ds.Tables[0];
            }
        }
Exemplo n.º 3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            BLL.prizes bll = new BLL.prizes();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "page={0}", "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 4
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);

            BLL.prizes bll = new BLL.prizes();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("list.aspx", "page={0}", "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Exemplo n.º 5
0
 /// <summary>
 /// 添加中间记录
 /// </summary>
 /// <param name="user_id"></param>
 /// <param name="user_name"></param>
 /// <param name="prize"></param>
 private void add_prize(int user_id, string user_name, string prize)
 {
     Model.prizes model = new Model.prizes();
     model.add_time = DateTime.Now;
     model.prize = prize;
     model.user_id = user_id;
     model.user_name = user_name;
     BLL.prizes pbll = new BLL.prizes();
     pbll.Add(model);
 }
Exemplo n.º 6
0
        /// <summary>
        /// 用户抽奖
        /// </summary>
        /// <param name="context"></param>
        private void user_get_prize(HttpContext context)
        {
            Model.users model = new BasePage().GetUserInfo();
            if (model != null && model.id > 0)
            {
                int num = 3;//默认3次抽奖机会
                BLL.share sbll = new BLL.share();
                DataSet sds = sbll.GetList("user_id=" + model.id);
                if (sds != null && sds.Tables[0].Rows.Count > 0)
                {
                    num = 4;//分享过之后4次抽奖机会
                }
                //获取抽奖次数
                BLL.prizes pbll = new BLL.prizes();
                DataSet ds = pbll.GetList("user_id=" + model.id);
                if (ds != null && ds.Tables[0].Rows.Count >= num)
                {
                    context.Response.Write("{\"status\":\"0\", \"msg\":\"您的抽奖次数已用尽!\"}");
                }
                else
                {
                    //抽奖操作
                    //抽奖概率:
                    //1.iphone6 小米4       0%
                    //2.100元话费  3%
                    //3.10元体验包  80%
                    //4.50元抵用券   50%
                    //5.100元抵用券  80%
                    //6.免费送货券  50%

                    Random rd = new Random();
                    int result = 0;
                    int prize = rd.Next(0, 3 + 80 + 50 + 80 + 50);
                    if (prize <= 3)
                    {
                        result = 5;
                        add_prize(model.id, model.user_name, "100元话费");
                    }
                    else if (prize <= 83)
                    {
                        result = 2;
                        add_prize(model.id, model.user_name, "10元体验包");
                    }
                    else if (prize <= 133)
                    {
                        result = 8;
                        add_prize(model.id, model.user_name, "50元抵用券");
                    }
                    else if (prize <= 213)
                    {
                        result = 4;
                        add_prize(model.id, model.user_name, "100元抵用券");
                    }
                    else if (prize <= 263)
                    {
                        result = 7;
                        add_prize(model.id, model.user_name, "免费送货劵");
                    }
                    context.Response.Write("{\"status\":\"" + result + "\", \"msg\":\"抽奖成功!\"}");
                }
            }
            else
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"请先登录!\"}");
            }
        }