Beispiel #1
0
        private void CheckCanVote(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            StringBuilder builder = new StringBuilder("{");
            int           voteId  = 0;

            try
            {
                voteId = int.Parse(context.Request["voteId"]);
            }
            catch (Exception)
            {
                builder.Append("\"status\":\"0\",\"Desciption\":\"参数错误!\"}");
                context.Response.Write(builder.ToString());
                return;
            }
            if (VoteHelper.IsVote(voteId))
            {
                builder.Append("\"status\":\"2\",\"Desciption\":\"已投过票!\"}");
                context.Response.Write(builder.ToString());
            }
            else
            {
                builder.Append("\"status\":\"1\",\"Desciption\":\"可以投票!\"}");
                context.Response.Write(builder.ToString());
            }
        }
Beispiel #2
0
        private void CheckCanVote(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            StringBuilder builder = new StringBuilder("{");
            int           voteId  = 0;

            try
            {
                voteId = int.Parse(context.Request["voteId"]);
            }
            catch (Exception)
            {
                builder.Append("\"status\":\"0\",\"Desciption\":\"参数错误!\"}");
                context.Response.Write(builder.ToString());
                return;
            }
            VoteInfo vote = VoteHelper.GetVote((long)voteId);

            if (vote == null)
            {
                builder.Append("\"status\":\"2\",\"Desciption\":\"不存在该投票!\"}");
                context.Response.Write(builder.ToString());
            }
            else if (MemberProcessor.CheckCurrentMemberIsInRange(vote.MemberGrades, vote.DefualtGroup, vote.CustomGroup))
            {
                if (!VoteHelper.IsVote(voteId))
                {
                    builder.Append("\"status\":\"1\",\"Desciption\":\"可以投票!\"}");
                    context.Response.Write(builder.ToString());
                }
                else
                {
                    builder.Append("\"status\":\"2\",\"Desciption\":\"已投过票!\"}");
                    context.Response.Write(builder.ToString());
                }
            }
            else
            {
                builder.Append("\"status\":\"2\",\"Desciption\":\"该投票不适应您的会员,谢谢!\"}");
                context.Response.Write(builder.ToString());
            }
        }