Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            vote_id   = RequestHelper.GetQueryInt("vote_id", 0);
            option_id = RequestHelper.GetQueryInt("option_id", 0);
            vote      = new Bll.WeChat.wp_shop_votebll().GetItem(vote_id);
            option    = new Bll.WeChat.wp_shop_vote_optionbll().GetItem(option_id);

            url = Request.Url.ToString();
            if (vote == null || option == null)
            {
                //Response.Redirect("votelist.aspx?vote_id=" + vote_id);
            }
            else
            {
                var tmp = new Bll.WeChat.wp_picturebll().GetItem((int)option.image);
                option.ImagePath = tmp == null ? "" : tmp.path;
                uid = new Bll.WeChat.wp_userbll().GetUserIdByOpenId(openId);
                LogHandler.Info($"votedetaile页面,uid:{ uid},openId{openId}");
                //限制每个一天只能投一票
                //option.IsVoteCurrent = new Bll.WeChat.wp_shop_vote_logbll().GetVoteCountTodayByOptionId(uid, option_id) > 0;
                //不限制每个一天只能投一票
                option.IsVoteCurrent = false;
                var list = new Bll.WeChat.wp_shop_vote_logbll().GetVoteLogByVoteId(uid, vote_id);
                option.IsVote = false;
                if (list != null && list.Count > 0)
                {
                    option.IsVote = list.Count >= vote.multi_num;
                }
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            voteId = RequestHelper.GetQueryInt("voteId", 0);

            if (voteId > 0)
            {
                model = new Bll.WeChat.wp_shop_votebll().GetItem(voteId);
                int uid    = new Bll.WeChat.wp_userbll().GetUserIdByOpenId(openId);
                var option = new Bll.WeChat.wp_shop_vote_optionbll().GetOptionByUid(voteId, uid);
                if (option != null)
                {
                    //Response.Redirect($"/index.php?s=/w16/Vote/Wap/option_detail.html&option_id={option.Id}&vote_id={option.vote_id}");
                    Response.Redirect($"votedetaile.aspx?vote_id={option.vote_id}&option_id={option.Id}");
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            vote_id = RequestHelper.GetQueryInt("vote_id", 0);
            //vote_id = 4;
            int count = RequestHelper.GetQueryInt("count", 20);

            is_validity = false;
            vote        = new Bll.WeChat.wp_shop_votebll().GetItem(vote_id);
            list        = new Bll.WeChat.wp_shop_vote_optionbll().GetOptionListByVoteId(vote_id, count);
            url         = Request.Url.ToString();
            if (vote != null)
            {
                var now = BaseClass.ConvertDataTimeToLong(DateTime.Now);
                is_validity = vote.start_time <now && vote.end_time> now;
            }
            if (!string.IsNullOrEmpty(openId))
            {
                user = new Bll.WeChat.wp_userbll().GetUserInfoByOpenId(openId);
                //LogHandler.Info($"votelist页,openId{openId},user:{JsonHelper.Serialize(user)}");
                if (user != null)
                {
                    list_log = new Bll.WeChat.wp_shop_vote_logbll().GetVoteLogByVoteId(user.Id, vote_id);
                }
            }

            if (list != null && list.Count > 0 && list_log != null && list_log.Count > 0)
            {
                list.ForEach(s =>
                {
                    s.IsVote = list_log.Count >= vote.multi_num;
                    //限制每个一天只能投一票
                    //s.IsVoteCurrent = list_log.Any(l => l.uid == user.Id && l.option_id == s.Id);
                    //不限制每个一天只能投一票
                    s.IsVoteCurrent = false;
                });
            }
            if (list != null && list.Count > 0)
            {
                list.ForEach(s =>
                {
                    var tmp     = new Bll.WeChat.wp_picturebll().GetItem((int)s.image);
                    s.ImagePath = tmp == null ? "" : tmp.path;
                });
            }
        }