Exemplo n.º 1
0
        // GET: Lottery
        //[OutputCache(Duration = 20, VaryByParam = "lotteryId")]
        public ActionResult Index(int lId = 2)
        {
            ViewBag.lId = lId;
            var data = LotteryHelper.GetPageOfData(lId);

            return(View(data));
        }
Exemplo n.º 2
0
        public ActionResult GetNewOpenNumber(GetNewOpenNumberDTO dto)
        {
            var _context = GlobalHost.ConnectionManager.GetHubContext <ChatHub>();
            //dto.LotteryId
            var html = LotteryHelper.Generate(dto.LotteryId);

            //dto.LotteryId.ToString()
            _context.Clients.Group(dto.LotteryId.ToString()).GetNewOpenNumber(html);
            return(Json("success", JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult GetLotteryPickCount(string codeList)
        {
            codeList = codeList.TrimEnd(',').Split(',').ToList().Aggregate(string.Empty, (c, r) => c + "'" + r + "',").TrimEnd(',');
            List <PickCount> list    = LotteryApp.GetPickCount(codeList);
            List <PickCount> newList = (from p in list
                                        let pl = LotteryHelper.GetPickerList(p.Code)
                                                 select new PickCount
            {
                Code = p.Code,
                TodayCount = p.TodayCount,
                TotalCount = p.TotalCount,
                TotalPickerCount = pl.Count,
                ValidPickerCount = pl.Count(pp => pp.IsValid)
            }).ToList();

            return(Json(newList));
        }
Exemplo n.º 4
0
        /// <summary>
        /// 采集详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult PickDetail(string id, string lotteryCode)
        {
            List <LotteryPickDetail> detailList = LotteryApp.GetPickDetail(lotteryCode);
            List <LotteryPickDetail> newList    = (from d in detailList
                                                   let p = LotteryHelper.GetTypeList(lotteryCode)
                                                           let p3 = LotteryHelper.GetPicker(lotteryCode, d.Code)
                                                                    let p2 = p == null ? new List <Type>() : p.Where(pp => pp.Name.Contains(d.Code)).ToList()
                                                                             select new LotteryPickDetail
            {
                Code = d.Code,
                TodayCount = d.TodayCount,
                TotalCount = d.TotalCount,
                PickerName = p2.Count == 0 ? "" : p2[0].Name,
                PickerValid = p3 == null ? false : p3.IsValid
            }).Where(p => !string.IsNullOrEmpty(p.PickerName)).ToList();

            return(View(newList));
        }
Exemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(Request.QueryString["ID"]))
         {
             Response.Write("非法的请求");
             this.Response.End();
             return;
         }
         int activityID = Convert.ToInt32(Request.QueryString["ID"]);
         var activity   = LotteryHelper.GetActivity(activityID);
         if (activity == null)
         {
             Response.Write("活动已关闭");
             this.Response.End();
             return;
         }
         string CookieKey      = WebUtil.GetOpenIDPrefix();
         string OpenID         = this.Request.Cookies[CookieKey].Value;
         string activityid_key = string.IsNullOrEmpty(WebUtil.getApplicationPath()) ? "activity" : WebUtil.getApplicationPath() + "_activity";
         string activityHome   = string.Empty;
         string file           = string.Empty;
         if (activity.UserLimit)
         {
             var joinuser = Foresight.DataAccess.Wechat_LotteryActivityUser.GetWechatLotteryActivityUserByOpenID(activity.ID, OpenID);
             if (joinuser == null)
             {
                 activityHome = "/html/newweixin/lottery/lotteryinfocollect.html";
                 file         = Server.MapPath("~" + activityHome);
                 if (System.IO.File.Exists(file))
                 {
                     this.Response.Cookies.Add(new HttpCookie(CookieKey, OpenID));
                     this.Response.Cookies.Add(new HttpCookie(activityid_key, activity.ID.ToString()));
                     this.Response.Redirect(WeixinHelper.ResolveClientUrl(activityHome + "?t=" + DateTime.Now.Ticks), true);
                     return;
                 }
                 else
                 {
                     Response.Write("活动页面未创建");
                     this.Response.End();
                     return;
                 }
             }
         }
         if (string.IsNullOrEmpty(activityHome))
         {
             activityHome = string.Format("/html/newweixin/lottery/{0}/index.html", activity.ID.ToString());
             file         = Server.MapPath("~" + activityHome);
             if (!System.IO.File.Exists(file))
             {
                 activityHome = string.Format("/html/newweixin/lottery/{0}/index.html", activity.Type);
                 file         = Server.MapPath("~" + activityHome);
             }
             if (!System.IO.File.Exists(file))
             {
                 activityHome = string.Format("/html/newweixin/lottery/{0}/index.html", activity.Type);
                 if (activity.Type.Equals(Utility.EnumModel.LotteryTypeDefine.Goldenegg.ToString()))
                 {
                     activityHome = "/html/newweixin/lottery/lottery_zjd/index.html";
                 }
                 else if (activity.Type.Equals(Utility.EnumModel.LotteryTypeDefine.Shake.ToString()))
                 {
                     activityHome = "/html/newweixin/lottery/lottery_yly/index.html";
                 }
                 else if (activity.Type.Equals(Utility.EnumModel.LotteryTypeDefine.Shave.ToString()))
                 {
                     activityHome = "/html/newweixin/lottery/lottery_ggl/index.html";
                 }
                 else if (activity.Type.Equals(Utility.EnumModel.LotteryTypeDefine.Turntable.ToString()))
                 {
                     activityHome = "/html/newweixin/lottery/lottery_zp/index.html";
                 }
                 file = Server.MapPath("~" + activityHome);
             }
         }
         this.Response.Clear();
         this.Response.Cookies.Add(new HttpCookie(CookieKey, OpenID));
         this.Response.Cookies.Add(new HttpCookie(activityid_key, activity.ID.ToString()));
         this.Response.Redirect(WeixinHelper.ResolveClientUrl(activityHome + "?t=" + DateTime.Now.Ticks), true);
     }
     catch (Exception ex)
     {
         LogHelper.WriteError("WeiXin", this.Request.Url.ToString(), ex);
         Response.Write("请求已过期,请刷新后重试");
         return;
     }
 }
 public void OnNumberChange(object param)
 {
     LotteryNumbers = LotteryHelper.GenerateLotteryNumbers(6, 1, 49);
 }
Exemplo n.º 7
0
 public IEnumerable <int> GetLotteryNumbers(int count, int startNumber, int endNumber)
 {
     return(LotteryHelper.GenerateLotteryNumbers(count, startNumber, endNumber));
 }
        public void GenerateLotteryNumbersTest()
        {
            var items = LotteryHelper.GenerateLotteryNumbers(6, 1, 49);

            Assert.AreEqual <int>(6, items.Count);
        }