Пример #1
0
        /// <summary>
        /// 查询领取红包
        /// </summary>
        public ActionResult AuthenticityQuery()
        {
            string msg = "";

            List <LotteryRecord> Lmodel = LotteryRecord.GetEntitysbytg("and LotteryRecord.UserName='******' and (LotteryRecord.ActivityID='3' or LotteryRecord.ActivityID='1' )");

            if (Lmodel.Count > 0)
            {
                msg = "您已经参与过此活动!";
            }
            RedPackLottery code = RedPackLottery.GetEntityByUserName2(CurrentUser.UserName);

            if (code != null)
            {
                msg = "您已经参与过此活动";
            }
            ViewData["ip"] = System.Web.HttpContext.Current.Request.ServerVariables.Get("Remote_Addr").ToString();
            LotteryActivitys act = LotteryActivitys.GetEntityByID(1);

            ViewData["act"]  = act;
            ViewData["IsWx"] = Request.UserAgent.ToLower().Contains("micromessenger");
            ViewData["user"] = CurrentUser;

            ViewData["msg"] = msg;
            return(View());
        }
Пример #2
0
        public ContentResult UploadPrizeInfo(int ID, string Phone, string Name, string Address)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(Phone))
                {
                    return(Content("手机号不能为空"));
                }
                if (Phone.Length != 11)
                {
                    return(Content("手机号有误"));
                }
                if (string.IsNullOrWhiteSpace(Name))
                {
                    return(Content("姓名不能为空"));
                }
                if (string.IsNullOrWhiteSpace(Address))
                {
                    return(Content("姓名不能为空"));
                }

                LotteryRecord rec = LotteryRecord.GetEntityByID(ID);
                rec.Phone      = Phone;
                rec.Name       = Name;
                rec.RecAddress = Address;

                rec.UpdateByID();

                return(Content("ok"));
            }
            catch (Exception ex)
            {
                return(Content("提交出错,请联系客服!"));
            }
        }
Пример #3
0
        // 找回奖品
        public ContentResult RetrievePrizes(string SecurityCode)
        {
            string ResultStr = "";

            try
            {
                WXUserInfo userInfo   = new WXUserInfo();
                string     UserOpenId = "";
                if (Session["openid"] != null)
                {
                    UserOpenId = Session["openid"].ToString();
                    string ACCESS_TOKEN = Session["ACCESS_TOKEN"].ToString();

                    WXVariousApi VariousApi = new WXVariousApi();
                    userInfo = GetUserInfo(UserOpenId, ACCESS_TOKEN);
                }

                LotteryRecord lotteryRecord = LotteryRecord.GetRecByIntegralCode(SecurityCode);
                if (lotteryRecord != null && !lotteryRecord.IsNot)
                {
                    if (lotteryRecord.UserOpenId == "12345" || lotteryRecord.UserOpenId == "")
                    {
                        lotteryRecord.UserOpenId = Session["openid"].ToString();
                        lotteryRecord.UserWxName = userInfo.nickname;
                        lotteryRecord.UserWxImg  = userInfo.headimgurl;

                        int iRet = lotteryRecord.UpdateByID();
                        if (iRet > 0)
                        {
                            ResultStr = "ok";
                        }
                        else
                        {
                            ResultStr = "找回奖品失败,请联系管理员!";
                        }
                    }
                    else
                    {
                        ResultStr = "此防伪码不参与奖品找回!";
                    }
                }
                else
                {
                    ResultStr = "此防伪码没有中奖!";
                }
            }
            catch (Exception ex)
            {
                ResultStr = "找回奖品异常!error:" + ex.Message;
            }

            return(Content(ResultStr));
        }
        // POST api/LotteryRecords
        public HttpResponseMessage Post(LotteryRecord tbl)
        {
            if (ModelState.IsValid)
            {
                db.LotteryRecords.Add(tbl);
                db.SaveChanges();

                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, tbl);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = tbl.id }));
                return response;
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
Пример #5
0
        public ActionResult GetVerify(int id)
        {
            LotteryRecord r = LotteryRecord.GetEntityByID(id);

            if (r != null)
            {
                r.States = "已发放";
                r.ID     = r.UpdateByID();
            }
            else
            {
                return(Content("数据错误!!!"));
            }

            return(Content("ok"));
        }
Пример #6
0
        /// <summary>
        /// 我的扫码记录
        /// </summary>
        /// <param name="condition"></param>
        /// <returns></returns>
        public ActionResult LoadAuthenticityList(BaseSearch condition)
        {
            string where = " and UserName='******' and (ActivityID='1'  or ActivityID='3')";

            List <LotteryRecord> mode = LotteryRecord.GetEntitysbywhere(where);

            where = " and l.UserName='******' and (ActivityID='1'  or ActivityID='3')";
            if (mode.Count > 0)
            {
                //where = " and l.IntegralCode='" + mode[0].IntegralCode + "'";
            }

            PageJsonModel <LotteryRecord> page = new PageJsonModel <LotteryRecord>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = string.Format(" LotteryRecord  l left join C_User  c on c.userName=l.UserName ");
            page.strSelect = " l.* ,PortraitUrl,NickName ";
            //page.strWhere = " " + where;
            page.strOrder = " l.ID desc";
            page.LoadList();

            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
        // PUT api/LotteryRecords/5
        public HttpResponseMessage Put(int id, LotteryRecord tbl)
        {
            if (ModelState.IsValid && id == tbl.id)
            {
                db.LotteryRecords.Attach(tbl);
                db.Entry(tbl).State = EntityState.Modified;

                try
                {
                    db.SaveChanges();
                }
                catch (DbUpdateConcurrencyException)
                {
                    return Request.CreateResponse(HttpStatusCode.NotFound);
                }

                return Request.CreateResponse(HttpStatusCode.OK);
            }
            else
            {
                return Request.CreateResponse(HttpStatusCode.BadRequest);
            }
        }
Пример #8
0
 public static long CalcPossibilities(LotteryRecord record)
 {
     return(CalcPossibilities(record.choices, record.blanks, record.sorted, record.unique));
 }
Пример #9
0
        //
        // GET: /Plan/

        public ActionResult Index(int id, int size = 10)
        {
            int lType = id;

            ViewBag.lType = lType;


            #region 官方推荐


            //1.获取数据
            int    count     = Util.GetGFTJCount(lType);
            int    totalSize = (size + 1) * count;
            string sql       = "select top(" + totalSize + ") * from [Plan] where lType = " + lType + " order by Issue desc";
            ViewBag.list2 = Util.ReaderToList <Plan>(sql);        //计划列表



            //2.取最新10期开奖号
            sql          = "select top(10)* from LotteryRecord where lType = " + lType + " order by Issue desc";
            ViewBag.list = Util.ReaderToList <LotteryRecord>(sql);

            //3.最后一期
            sql = "select top(1)* from LotteryRecord where lType =" + lType + " order by Issue desc";
            LotteryRecord lr = Util.ReaderToModel <LotteryRecord>(sql);

            ViewBag.lastIssue = lr.Issue;
            ViewBag.lastNum   = lr.Num;

            //剩余时间
            string time = Util.GetOpenRemainingTime(lType);

            if (time != "正在开奖")
            {
                string[] timeArr = time.Split('&');

                ViewBag.min = timeArr[1];
                ViewBag.sec = timeArr[2];
            }
            else
            {
                ViewBag.time = "正在开奖";
            }

            //彩种名字
            string lotteryName = Util.GetLotteryTypeName(lType);
            ViewBag.lotteryName = lotteryName;

            //当前期号
            string currentIssue = Util.GetCurrentIssue(lType);
            ViewBag.currentIssue = currentIssue;
            ViewBag.msg          = "查看" + currentIssue + "期" + lotteryName + "计划";

            //彩种图标
            string icon = Util.GetLotteryIcon(lType) + ".png";

            ViewBag.icon = icon;

            #endregion



            return(View());
        }