protected void Page_Load(object sender, EventArgs e)
 {
     if (base.Request.Params.AllKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref this.id))
     {
         this.vote = VoteHelper.GetVote((long)this.id);
         if (this.vote == null)
         {
             this.ShowMsg("没有这个投票调查!", false);
         }
         this.hidpic.Value   = this.vote.ImageUrl;
         this.fkContent.Text = this.vote.Description;
         this.calendarStartDate.SelectedDate = new DateTime?(this.vote.StartDate.Date);
         this.calendarEndDate.SelectedDate   = new DateTime?(this.vote.EndDate.Date);
         HiddenField field  = this.SetMemberRange.FindControl("txt_Grades") as HiddenField;
         HiddenField field2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as HiddenField;
         HiddenField field3 = this.SetMemberRange.FindControl("txt_CustomGroup") as HiddenField;
         this.SetMemberRange.Grade        = this.vote.MemberGrades;
         this.SetMemberRange.DefualtGroup = this.vote.DefualtGroup;
         this.SetMemberRange.CustomGroup  = this.vote.CustomGroup;
         field.Value  = this.vote.MemberGrades;
         field2.Value = this.vote.DefualtGroup;
         field3.Value = this.vote.CustomGroup;
         if ((this.vote.VoteItems != null) && (this.vote.VoteItems.Count > 0))
         {
             foreach (VoteItemInfo info in this.vote.VoteItems)
             {
                 this.items = this.items + info.VoteItemName + ",";
             }
         }
         this.items = this.items.TrimEnd(new char[] { ',' }).Replace(',', '\n');
     }
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            long result = 0L;

            long.TryParse(context.Request.QueryString["id"], out result);
            if (result > 0L)
            {
                VoteInfo vote = VoteHelper.GetVote(result);
                if (vote != null)
                {
                    var type = new
                    {
                        type     = "success",
                        VoteName = vote.VoteName,
                        data     = vote.VoteItems
                    };
                    string s = JsonConvert.SerializeObject(type);
                    context.Response.Write(s);
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"该投票调查不存在!\"}");
                }
            }
            else
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"参数错误!\"}");
            }
        }
Exemple #3
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());
            }
        }
Exemple #4
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            long num = 0L;

            long.TryParse(context.Request.QueryString["id"], out num);
            if (num <= 0L)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"参数错误!\"}");
                return;
            }
            VoteInfo vote = VoteHelper.GetVote(num);

            if (vote != null)
            {
                var value = new
                {
                    type     = "success",
                    VoteName = vote.VoteName,
                    data     = vote.VoteItems
                };
                string s = JsonConvert.SerializeObject(value);
                context.Response.Write(s);
                return;
            }
            context.Response.Write("{\"type\":\"error\",\"data\":\"该投票调查不存在!\"}");
        }
Exemple #5
0
        public DatabaseHelperProvider(VoteMystContext context, AvatarHelper avatarHelper)
        {
            Context = context;

            Authorization = new AuthorizationHelper(context);
            Users         = new UserAccountHelper(context, avatarHelper);
            Entries       = new EntryHelper(context);
            Events        = new EventHelper(context);
            Votes         = new VoteHelper(context);
        }
Exemple #6
0
        public override void Complete()
        {
            int winnerType = VoteHelper.GetWinner(_brainTypeVotes);

            BrainData.BrainDataEntry brainData = DataManager.Instance.GameData.Brains.Entries.GetOrDefault(winnerType);
            if (null == brainData)
            {
                return;
            }

            Brain = new Brain(brainData);
        }
Exemple #7
0
 public BookController(IBookRepository books, ILocker locker, IStorage storage, IMapper mapper,
                       UploadManager uploads, SnapshotHelper snapshots, ImageProcessor image, VoteHelper votes)
 {
     _books     = books;
     _locker    = locker;
     _storage   = storage;
     _mapper    = mapper;
     _uploads   = uploads;
     _snapshots = snapshots;
     _image     = image;
     _votes     = votes;
 }
        protected void DelBtn_Click(object sender, EventArgs e)
        {
            string text = this.txt_Ids.Text;

            if (text.Length > 1)
            {
                text = text.Substring(1);
            }
            foreach (string str2 in text.Split(new char[] { ',' }))
            {
                VoteHelper.Delete((long)int.Parse(str2));
            }
            this.BindData();
            this.ShowMsg("批量删除成功!", true);
        }
 private void grdDate_ItemCommand(object sender, RepeaterCommandEventArgs e)
 {
     if ((e.CommandName == "Delete") && !string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         if (VoteHelper.Delete((long)int.Parse(e.CommandArgument.ToString())))
         {
             this.ShowMsg("删除成功!", true);
             this.BindData();
         }
         else
         {
             this.ShowMsg("删除失败!", false);
         }
     }
 }
        public override void Complete()
        {
            int winnerType = VoteHelper.GetWinner(_weaponTypeVotes);

            WeaponData.WeaponDataEntry weaponData = DataManager.Instance.GameData.Weapons.Entries.GetOrDefault(winnerType);
            if (null == weaponData)
            {
                return;
            }

            Weapon = WeaponFactory.Create(Fighter, SlotData.Id, weaponData);
            if (null != Weapon)
            {
                Weapon.Strength = _weaponTypeVotes[winnerType];
            }
        }
Exemple #11
0
 private void grdDate_ItemCommand(object sender, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         if (string.IsNullOrEmpty(e.CommandArgument.ToString()))
         {
             return;
         }
         if (VoteHelper.Delete((long)int.Parse(e.CommandArgument.ToString())))
         {
             this.ShowMsg("删除成功!", true);
             this.BindData();
             return;
         }
         this.ShowMsg("删除失败!", false);
     }
 }
Exemple #12
0
        protected void lkDelete_Click(object sender, System.EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            int num = 0;

            if (text.bInt(ref num))
            {
                if (VoteHelper.Delete((long)num))
                {
                    this.ShowMsg("删除成功!", true);
                    this.BindData();
                    return;
                }
                this.ShowMsg("删除失败!", false);
            }
        }
Exemple #13
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());
            }
        }
Exemple #14
0
        private void UserVote(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder("{");
            int voteId = 0;

            try
            {
                voteId = int.Parse(context.Request["voteId"]);
            }
            catch (System.Exception)
            {
                stringBuilder.Append("\"status\":\"0\",\"Desciption\":\"参数错误!\"}");
                context.Response.Write(stringBuilder.ToString());
                return;
            }
            string text = context.Request["voteItem"];

            if (string.IsNullOrEmpty(text))
            {
                stringBuilder.Append("\"status\":\"0\",\"Desciption\":\"参数错误!\"}");
                context.Response.Write(stringBuilder.ToString());
            }
            else
            {
                try
                {
                    bool flag = VoteHelper.Vote(voteId, text);
                    if (!flag)
                    {
                        throw new System.Exception("投票失败!");
                    }
                    stringBuilder.Append("\"status\":\"1\",\"Desciption\":\"成功!\"}");
                    context.Response.Write(stringBuilder.ToString());
                }
                catch (System.Exception ex)
                {
                    stringBuilder.Append("\"status\":\"2\",\"Desciption\":\"" + ex.Message + "\"}");
                    context.Response.Write(stringBuilder.ToString());
                }
            }
        }
Exemple #15
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            long result = 0L;

            long.TryParse(context.Request.QueryString["id"], out result);
            try
            {
                if (Globals.GetCurrentManagerUserId() <= 0)
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}");
                    context.Response.End();
                }
                if (result > 0L)
                {
                    VoteInfo vote = VoteHelper.GetVote(result);
                    if (vote != null)
                    {
                        var type = new
                        {
                            type     = "success",
                            VoteName = vote.VoteName,
                            data     = vote.VoteItems
                        };
                        string s = JsonConvert.SerializeObject(type);
                        context.Response.Write(s);
                    }
                    else
                    {
                        context.Response.Write("{\"type\":\"error\",\"data\":\"该投票调查不存在!\"}");
                    }
                }
                else
                {
                    context.Response.Write("{\"type\":\"error\",\"data\":\"参数错误!\"}");
                }
            }
            catch (Exception exception)
            {
                context.Response.Write("{\"type\":\"error\",\"data\":\"" + Globals.String2Json(exception.ToString()) + "\"}");
            }
        }
        protected void lkDelete_Click(object sender, EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            int i = 0;

            if (text.bInt(ref i))
            {
                if (VoteHelper.Delete((long)i))
                {
                    this.ShowMsg("删除成功!", true);
                    this.BindData();
                }
                else
                {
                    this.ShowMsg("删除失败!", false);
                }
            }
        }
Exemple #17
0
        protected void lkStop_Click(object sender, System.EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            int num = 0;

            if (text.bInt(ref num))
            {
                VoteInfo vote = VoteHelper.GetVote((long)num);
                vote.EndDate = System.DateTime.Now;
                if (VoteHelper.Update(vote, false))
                {
                    this.ShowMsg("结束成功!", true);
                    this.BindData();
                    return;
                }
                this.ShowMsg("结束失败!", false);
            }
        }
Exemple #18
0
        private void CountTotal()
        {
            VoteSearch query = new VoteSearch {
                IsCount   = true,
                PageIndex = this.pager.PageIndex,
                PageSize  = this.pager.PageSize,
                SortBy    = "VoteId",
                SortOrder = SortAction.Desc,
                status    = VoteStatus.In
            };
            DbQueryResult result = VoteHelper.Query(query);

            this.lblIn.Text      = (result.Data != null) ? result.TotalRecords.ToString() : "0";
            query.status         = VoteStatus.End;
            result               = VoteHelper.Query(query);
            this.lblEnd.Text     = (result.Data != null) ? result.TotalRecords.ToString() : "0";
            query.status         = VoteStatus.unBegin;
            result               = VoteHelper.Query(query);
            this.lblUnBegin.Text = (result.Data != null) ? result.TotalRecords.ToString() : "0";
        }
Exemple #19
0
        private void UserVote(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;
            }
            string str = context.Request["voteItem"];

            if (!string.IsNullOrEmpty(str))
            {
                try
                {
                    if (!VoteHelper.Vote(voteId, str))
                    {
                        throw new Exception("投票失败!");
                    }
                    builder.Append("\"status\":\"1\",\"Desciption\":\"成功!\"}");
                    context.Response.Write(builder.ToString());
                }
                catch (Exception exception)
                {
                    builder.Append("\"status\":\"2\",\"Desciption\":\"" + exception.Message + "\"}");
                    context.Response.Write(builder.ToString());
                }
            }
            else
            {
                builder.Append("\"status\":\"0\",\"Desciption\":\"参数错误!\"}");
                context.Response.Write(builder.ToString());
            }
        }
Exemple #20
0
        private void CountTotal()
        {
            VoteSearch voteSearch = new VoteSearch();

            voteSearch.status    = this.status;
            voteSearch.IsCount   = true;
            voteSearch.PageIndex = this.pager.PageIndex;
            voteSearch.PageSize  = this.pager.PageSize;
            voteSearch.SortBy    = "VoteId";
            voteSearch.SortOrder = SortAction.Desc;
            voteSearch.status    = VoteStatus.In;
            DbQueryResult dbQueryResult = VoteHelper.Query(voteSearch);

            this.lblIn.Text      = ((dbQueryResult.Data != null) ? dbQueryResult.TotalRecords.ToString() : "0");
            voteSearch.status    = VoteStatus.End;
            dbQueryResult        = VoteHelper.Query(voteSearch);
            this.lblEnd.Text     = ((dbQueryResult.Data != null) ? dbQueryResult.TotalRecords.ToString() : "0");
            voteSearch.status    = VoteStatus.unBegin;
            dbQueryResult        = VoteHelper.Query(voteSearch);
            this.lblUnBegin.Text = ((dbQueryResult.Data != null) ? dbQueryResult.TotalRecords.ToString() : "0");
        }
Exemple #21
0
        protected void DelBtn_Click(object sender, System.EventArgs e)
        {
            string text = this.txt_Ids.Text;

            if (text.Length > 1)
            {
                text = text.Substring(1);
            }
            string[] array = text.Split(new char[]
            {
                ','
            });
            string[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                string s = array2[i];
                VoteHelper.Delete((long)int.Parse(s));
            }
            this.BindData();
            this.ShowMsg("批量删除成功!", true);
        }
        protected void lkStop_Click(object sender, EventArgs e)
        {
            string text = this.txt_Ids.Text;

            this.txt_Ids.Text = "";
            int i = 0;

            if (text.bInt(ref i))
            {
                VoteInfo vote = VoteHelper.GetVote((long)i);
                vote.EndDate = DateTime.Now;
                if (VoteHelper.Update(vote, false))
                {
                    this.ShowMsg("结束成功!", true);
                    this.BindData();
                }
                else
                {
                    this.ShowMsg("结束失败!", false);
                }
            }
        }
Exemple #23
0
        protected override void AttachChildControls()
        {
            VoteInfo vote = VoteHelper.GetVote(this.voteId);

            this.imgVoteItem      = (HiImage)this.FindControl("imgVoteItem");
            this.lVoteTitle       = (HiLiteral)this.FindControl("lVoteTitle");
            this.lVoteDescription = (HiLiteral)this.FindControl("lVoteDescription");
            this.lVoteCount       = (HiLiteral)this.FindControl("lVoteCount");
            this.rptVoteItem      = (VshopTemplatedRepeater)this.FindControl("rptVoteItem");
            this.lVoteDate        = (HiLiteral)this.FindControl("lVoteDate");
            this.lVoteType        = (HiLiteral)this.FindControl("lVoteType");
            if (vote != null)
            {
                this.htmlTitle             = vote.VoteName;
                this.lVoteTitle.Text       = vote.VoteName;
                this.imgVoteItem.ImageUrl  = vote.ImageUrl;
                this.lVoteDescription.Text = vote.Description;
                this.lVoteCount.Text       = vote.VoteAttends.ToString();
                this.lVoteDate.Text        = string.Format("{0:yyyy-MM-dd HH:mm:ss} 至 {1:yyyy-MM-dd  HH:mm:ss} ", vote.StartDate, vote.EndDate);
                if (vote.IsMultiCheck)
                {
                    this.lVoteType.Text           = "多选";
                    this.rptVoteItem.TemplateFile = "/Tags/Skin-Common-BeginVoteItemCheckBox.ascx";
                }
                else
                {
                    this.lVoteType.Text           = "单选";
                    this.rptVoteItem.TemplateFile = "/Tags/Skin-Common-BeginVoteItem.ascx";
                }
                this.rptVoteItem.DataSource = vote.VoteItems;
                this.rptVoteItem.DataBind();
            }
            else
            {
                base.GotoResourceNotFound("");
            }
            PageTitle.AddSiteNameTitle(this.htmlTitle);
        }
        public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target)
        {
            if (VoteHandler.voteActive)
            {
                yield break;
            }

            if (VoteHelper.TimeForEventVote())
            {
                MakeRandomVoteEvent(target);
                yield break;
            }
            if (thread != null)
            {
                thread = new Thread(new ThreadStart(ThreadProc));

                thread.Start();
            }
            else
            {
                if (singleIncident != null)
                {
                    thread.Join();
                    thread = null;
                    yield return(singleIncident);
                }

                if (makeIncidentOptions && incidentOptions != null)
                {
                    thread.Join();
                    thread = null;
                    VoteHandler.QueueVote(incidentOptions);
                }
                Thread.Sleep(0);
                yield break;
            }
            yield break;
        }
Exemple #25
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (base.Request.Params.AllKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref this.id))
     {
         this.vote = VoteHelper.GetVote((long)this.id);
         if (this.vote == null)
         {
             this.ShowMsg("没有这个投票调查!", false);
         }
         this.hidpic.Value   = this.vote.ImageUrl;
         this.fkContent.Text = this.vote.Description;
         this.calendarStartDate.SelectedDate = new DateTime?(this.vote.StartDate.Date);
         this.calendarEndDate.SelectedDate   = new DateTime?(this.vote.EndDate.Date);
         if ((this.vote.VoteItems != null) && (this.vote.VoteItems.Count > 0))
         {
             foreach (VoteItemInfo info in this.vote.VoteItems)
             {
                 this.items = this.items + info.VoteItemName + ",";
             }
         }
         this.items = this.items.TrimEnd(new char[] { ',' }).Replace(',', '\n');
     }
 }
        private void BindVoteForm(string _vote_id)
        {
            VoteHelper objHelp    = new VoteHelper();
            DataRow    objvoterow = objHelp.getVoteRow(_vote_id);

            if (objvoterow != null)
            {
                txtVote.Text      = objvoterow["Vote_Title"].ToString();
                txtStartDate.Text = Convert.ToDateTime(objvoterow["Vote_StartDate"]).ToString("dd/MM/yyyy");
                txtEndDate.Text   = Convert.ToDateTime(objvoterow["Vote_EndDate"]).ToString("dd/MM/yyyy");
                txtAvatar.Text    = objvoterow["Vote_Parent_Image"] != null ? objvoterow["Vote_Parent_Image"].ToString() : String.Empty;
                //if(objvoterow["Vote_Parent"]!=null)
                //    cboParent.SelectedValue = objvoterow["Vote_Parent"].ToString();
                //if(objvoterow["isShow"]!=null)
                //    chkIsShow.Checked =Convert.ToBoolean(objvoterow["isShow"]);
                if (objvoterow["Vote_InitContent"] != null)
                {
                    txtNote.Text = objvoterow["Vote_InitContent"].ToString();
                }

                cboCategory.SelectedValue = objvoterow["Cat_ID"] != DBNull.Value ? objvoterow["Cat_ID"].ToString() : "0";
            }
        }
Exemple #27
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     try
     {
         int      num  = int.Parse(context.Request["id"].ToString());
         string   str  = context.Request["name"].ToString();
         string   val  = context.Request["begin"].ToString();
         string   str3 = context.Request["end"].ToString();
         string   str4 = context.Request["memberlvl"].ToString();
         string   str5 = context.Request["defualtgroup"].ToString();
         string   str6 = context.Request["customgroup"].ToString();
         string   str7 = context.Request["img"].ToString();
         string   str8 = context.Request["des"].ToString();
         bool     flag = bool.Parse(context.Request["ismulti"].ToString());
         int      num2 = int.Parse(context.Request["maxcheck"].ToString());
         string   str9 = context.Request["items"].ToString();
         DateTime now  = DateTime.Now;
         DateTime i    = DateTime.Now;
         if (string.IsNullOrEmpty(str))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票标题不能为空\"}");
         }
         else if (str.Length > 60)
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票标题不能超过60个字符\"}");
         }
         else if (string.IsNullOrEmpty(str9))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票选项不能为空\"}");
         }
         else if (string.IsNullOrEmpty(str7))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"没有上传活动封面\"}");
         }
         else if (!val.bDate(ref now))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的开始时间\"}");
         }
         else if (!str3.bDate(ref i))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的结束时间\"}");
         }
         else if (i <= now)
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"结束时间要大于开始时间\"}");
         }
         else if (string.IsNullOrEmpty(str8))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"活动说明不能为空\"}");
         }
         else
         {
             VoteInfo vote = new VoteInfo();
             if (num != 0)
             {
                 vote = VoteHelper.GetVote((long)num);
                 if (vote == null)
                 {
                     context.Response.Write("{\"type\":\"error\",\"data\":\"没有找到这个调查\"}");
                     return;
                 }
             }
             List <VoteItemInfo> list = new List <VoteItemInfo>();
             if (!string.IsNullOrEmpty(str9))
             {
                 string[] strArray = str9.Split(new char[] { ',' });
                 if (strArray.Length > 0)
                 {
                     for (int j = 0; j < strArray.Length; j++)
                     {
                         VoteItemInfo item = new VoteItemInfo();
                         if (num > 0)
                         {
                             item.VoteId = num;
                         }
                         item.ItemCount    = 0;
                         item.VoteItemName = strArray[j];
                         list.Add(item);
                     }
                 }
             }
             vote.VoteName     = str;
             vote.EndDate      = i;
             vote.StartDate    = now;
             vote.MemberGrades = str4;
             vote.DefualtGroup = str5;
             vote.CustomGroup  = str6;
             vote.Description  = str8;
             vote.ImageUrl     = str7;
             vote.IsMultiCheck = flag;
             vote.MaxCheck     = num2;
             vote.VoteItems    = list;
             long voteId = 0L;
             if (num == 0)
             {
                 voteId = VoteHelper.Create(vote);
             }
             else
             {
                 voteId = vote.VoteId;
                 if (!VoteHelper.Update(vote, true))
                 {
                     voteId = 0L;
                 }
             }
             if (voteId > 0L)
             {
                 context.Response.Write("{\"type\":\"success\",\"data\":\"" + voteId.ToString() + "\"}");
             }
             else
             {
                 context.Response.Write("{\"type\":\"error\",\"data\":\"写数据库出错\"}");
             }
         }
     }
     catch (Exception exception)
     {
         context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}");
     }
 }
Exemple #28
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int result = 0;

            int.TryParse(context.Request.Params["act"], out result);
            string types = "0";

            if ((result > 0) && (result < 4))
            {
                types = result.ToString();
            }
            else if (result == 4)
            {
                types = "4,5";
            }
            DataTable activityTopics = ActivityHelper.GetActivityTopics(types);

            activityTopics.Columns.Add("hasImage");
            activityTopics.Columns.Add("NewMemberGrades");
            activityTopics.Columns.Add("Url");
            activityTopics.Columns.Add("Limit");
            activityTopics.Columns.Add("Discount");
            activityTopics.Columns.Add("Description");
            activityTopics.Columns.Add("Point");
            activityTopics.Columns.Add("CouponMoeny");
            activityTopics.Columns.Add("Product");
            foreach (DataRow row in activityTopics.Rows)
            {
                int    gameId = int.Parse(row["Id"].ToString());
                int    num3   = int.Parse(row["ActivityType"].ToString());
                string str2   = row["MemberGrades"].ToString();
                string str3   = row["DefualtGroup"].ToString();
                string str4   = row["CustomGroup"].ToString();
                if (((num3 == 2) || (num3 == 4)) || (num3 == 5))
                {
                    row["hasImage"] = "none";
                }
                else
                {
                    row["hasImage"] = "''";
                }
                if (((str2 == "0") || (str3 == "0")) || (str4 == "0"))
                {
                    row["NewMemberGrades"] = "全部会员";
                }
                else
                {
                    row["NewMemberGrades"] = "部分会员";
                }
                if (num3 == 1)
                {
                    row["Url"] = "/ExchangeList.aspx?id=" + gameId;
                }
                else
                {
                    switch (num3)
                    {
                    case 4:
                    {
                        row["Url"] = "/BeginVote.aspx?voteId=" + gameId;
                        VoteInfo vote = VoteHelper.GetVote((long)gameId);
                        if (vote != null)
                        {
                            row["Description"] = vote.Description;
                        }
                        break;
                    }

                    case 5:
                    {
                        GameInfo modelByGameId = GameHelper.GetModelByGameId(gameId);
                        if (modelByGameId != null)
                        {
                            row["Url"]         = modelByGameId.GameUrl;
                            row["Limit"]       = this.GetLimit(modelByGameId.LimitEveryDay, modelByGameId.MaximumDailyLimit);
                            row["Point"]       = modelByGameId.NeedPoint.ToString();
                            row["Description"] = modelByGameId.Description;
                        }
                        break;
                    }

                    case 3:
                    {
                        row["Url"] = "/VShop/CouponDetails.aspx?CouponId=" + gameId;
                        CouponInfo coupon = CouponHelper.GetCoupon(gameId);
                        if (coupon != null)
                        {
                            row["CouponMoeny"] = coupon.CouponValue.ToString();
                            if (coupon.ConditionValue > 0M)
                            {
                                row["Limit"] = "满" + coupon.ConditionValue.ToString() + "元可用";
                            }
                            else
                            {
                                row["Limit"] = "不限制";
                            }
                        }
                        break;
                    }

                    case 2:
                    {
                        row["Url"] = "";
                        ActivityInfo act = ActivityHelper.GetAct(gameId);
                        if (act != null)
                        {
                            row["Limit"] = "每人参与" + act.attendTime.ToString() + "次";
                            int       meetType = act.MeetType;
                            DataTable table2   = ActivityHelper.GetActivities_Detail(gameId);
                            string    str5     = string.Empty;
                            string    str6     = "";
                            if (act.attendType == 0)
                            {
                                foreach (DataRow row2 in table2.Rows)
                                {
                                    if (meetType == 1)
                                    {
                                        str6 = str6 + "满" + row2["MeetNumber"].ToString() + "件";
                                    }
                                    else
                                    {
                                        str6 = str6 + "满" + row2["MeetMoney"].ToString() + "元";
                                    }
                                    if (decimal.Parse(row2["ReductionMoney"].ToString()) != 0M)
                                    {
                                        str6 = str6 + ",减" + row2["ReductionMoney"].ToString() + "元";
                                    }
                                    if (bool.Parse(row2["bFreeShipping"].ToString()))
                                    {
                                        str6 = str6 + ",免邮";
                                    }
                                    if (int.Parse(row2["Integral"].ToString()) != 0)
                                    {
                                        str6 = str6 + ",送" + row2["Integral"].ToString() + "积分";
                                    }
                                    if (int.Parse(row2["CouponId"].ToString()) != 0)
                                    {
                                        str6 = str6 + ",送优惠券";
                                    }
                                }
                                str5 = str5 + str6;
                            }
                            else
                            {
                                str5 = "多级优惠(每层级优惠不累积叠加)<br/>";
                                int num5 = 0;
                                foreach (DataRow row3 in table2.Rows)
                                {
                                    num5++;
                                    str6 = str6 + "层级" + num5.ToString() + ":";
                                    if (meetType == 1)
                                    {
                                        str6 = str6 + "满" + row3["MeetNumber"].ToString() + "件";
                                    }
                                    else
                                    {
                                        str6 = str6 + "满" + row3["MeetMoney"].ToString() + "元";
                                    }
                                    if (decimal.Parse(row3["ReductionMoney"].ToString()) != 0M)
                                    {
                                        str6 = str6 + ",减" + row3["ReductionMoney"].ToString() + "元";
                                    }
                                    if (bool.Parse(row3["bFreeShipping"].ToString()))
                                    {
                                        str6 = str6 + ",免邮";
                                    }
                                    if (int.Parse(row3["Integral"].ToString()) != 0)
                                    {
                                        str6 = str6 + ",送" + row3["Integral"].ToString() + "积分";
                                    }
                                    if (int.Parse(row3["CouponId"].ToString()) != 0)
                                    {
                                        str6 = str6 + ",送优惠券";
                                    }
                                    str6 = str6 + "<br/>";
                                }
                                str5 = str5 + str6;
                            }
                            row["Discount"] = str5;
                            if (act.isAllProduct)
                            {
                                row["Product"] = "全部商品";
                            }
                            else
                            {
                                string str7 = string.Empty;
                                foreach (DataRow row4 in ActivityHelper.QueryProducts(gameId).Rows)
                                {
                                    if (row4["status"].ToString() == "0")
                                    {
                                        str7 = str7 + row4["ProductID"].ToString() + "_";
                                    }
                                }
                                if (!string.IsNullOrEmpty(str7))
                                {
                                    row["Url"] = "/ProductList.aspx?pIds=" + str7.TrimEnd(new char[] { '_' });
                                }
                                row["Product"] = "部分商品";
                            }
                        }
                        break;
                    }
                    }
                }
            }
            IsoDateTimeConverter converter = new IsoDateTimeConverter
            {
                DateTimeFormat = "yyyy-MM-dd HH:mm"
            };
            string s = JsonConvert.SerializeObject(activityTopics, Formatting.Indented, new JsonConverter[] { converter });

            context.Response.Write(s);
        }
 public DbQueryResult GetVotesTable(HttpContext context)
 {
     return(VoteHelper.Query(this.GetVoteSearch(context)));
 }
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int num = 0;

            int.TryParse(context.Request.Params["act"], out num);
            string types = "0";

            if (num > 0 && num < 4)
            {
                types = num.ToString();
            }
            else if (num == 4)
            {
                types = "4,5";
            }
            System.Data.DataTable activityTopics = ActivityHelper.GetActivityTopics(types);
            activityTopics.Columns.Add("hasImage");
            activityTopics.Columns.Add("NewMemberGrades");
            activityTopics.Columns.Add("Url");
            activityTopics.Columns.Add("Limit");
            activityTopics.Columns.Add("Discount");
            activityTopics.Columns.Add("Description");
            activityTopics.Columns.Add("Point");
            activityTopics.Columns.Add("CouponMoeny");
            activityTopics.Columns.Add("Product");
            foreach (System.Data.DataRow dataRow in activityTopics.Rows)
            {
                int    num2 = int.Parse(dataRow["Id"].ToString());
                int    num3 = int.Parse(dataRow["ActivityType"].ToString());
                string a    = dataRow["MemberGrades"].ToString();
                string a2   = dataRow["DefualtGroup"].ToString();
                string a3   = dataRow["CustomGroup"].ToString();
                if (num3 == 2 || num3 == 4 || num3 == 5)
                {
                    dataRow["hasImage"] = "none";
                }
                else
                {
                    dataRow["hasImage"] = "''";
                }
                if (a == "0" || a2 == "0" || a3 == "0")
                {
                    dataRow["NewMemberGrades"] = "全部会员";
                }
                else
                {
                    dataRow["NewMemberGrades"] = "部分会员";
                }
                if (num3 == 1)
                {
                    dataRow["Url"] = "/ExchangeList.aspx?id=" + num2;
                }
                else if (num3 == 2)
                {
                    dataRow["Url"] = "";
                    ActivityInfo act = ActivityHelper.GetAct(num2);
                    if (act != null)
                    {
                        dataRow["Limit"] = "每人参与" + act.attendTime.ToString() + "次";
                        int meetType = act.MeetType;
                        System.Data.DataTable activities_Detail = ActivityHelper.GetActivities_Detail(num2);
                        string text  = string.Empty;
                        string text2 = "";
                        if (act.attendType == 0)
                        {
                            foreach (System.Data.DataRow dataRow2 in activities_Detail.Rows)
                            {
                                if (meetType == 1)
                                {
                                    text2 = text2 + "满" + dataRow2["MeetNumber"].ToString() + "件";
                                }
                                else
                                {
                                    text2 = text2 + "满" + dataRow2["MeetMoney"].ToString() + "元";
                                }
                                if (decimal.Parse(dataRow2["ReductionMoney"].ToString()) != 0m)
                                {
                                    text2 = text2 + ",减" + dataRow2["ReductionMoney"].ToString() + "元";
                                }
                                if (bool.Parse(dataRow2["bFreeShipping"].ToString()))
                                {
                                    text2 += ",免邮";
                                }
                                if (int.Parse(dataRow2["Integral"].ToString()) != 0)
                                {
                                    text2 = text2 + ",送" + dataRow2["Integral"].ToString() + "积分";
                                }
                                if (int.Parse(dataRow2["CouponId"].ToString()) != 0)
                                {
                                    text2 += ",送优惠券";
                                }
                            }
                            text += text2;
                        }
                        else
                        {
                            text = "多级优惠(每层级优惠不累积叠加)<br/>";
                            int num4 = 0;
                            foreach (System.Data.DataRow dataRow3 in activities_Detail.Rows)
                            {
                                num4++;
                                text2 = text2 + "层级" + num4.ToString() + ":";
                                if (meetType == 1)
                                {
                                    text2 = text2 + "满" + dataRow3["MeetNumber"].ToString() + "件";
                                }
                                else
                                {
                                    text2 = text2 + "满" + dataRow3["MeetMoney"].ToString() + "元";
                                }
                                if (decimal.Parse(dataRow3["ReductionMoney"].ToString()) != 0m)
                                {
                                    text2 = text2 + ",减" + dataRow3["ReductionMoney"].ToString() + "元";
                                }
                                if (bool.Parse(dataRow3["bFreeShipping"].ToString()))
                                {
                                    text2 += ",免邮";
                                }
                                if (int.Parse(dataRow3["Integral"].ToString()) != 0)
                                {
                                    text2 = text2 + ",送" + dataRow3["Integral"].ToString() + "积分";
                                }
                                if (int.Parse(dataRow3["CouponId"].ToString()) != 0)
                                {
                                    text2 += ",送优惠券";
                                }
                                text2 += "<br/>";
                            }
                            text += text2;
                        }
                        dataRow["Discount"] = text;
                        if (act.isAllProduct)
                        {
                            dataRow["Product"] = "全部商品";
                        }
                        else
                        {
                            string text3 = string.Empty;
                            System.Data.DataTable dataTable = ActivityHelper.QueryProducts(num2);
                            foreach (System.Data.DataRow dataRow4 in dataTable.Rows)
                            {
                                if (dataRow4["status"].ToString() == "0")
                                {
                                    text3 = text3 + dataRow4["ProductID"].ToString() + "_";
                                }
                            }
                            if (!string.IsNullOrEmpty(text3))
                            {
                                dataRow["Url"] = "/ProductList.aspx?pIds=" + text3.TrimEnd(new char[]
                                {
                                    '_'
                                });
                            }
                            dataRow["Product"] = "部分商品";
                        }
                    }
                }
                else if (num3 == 3)
                {
                    dataRow["Url"] = "/VShop/CouponDetails.aspx?CouponId=" + num2;
                    CouponInfo coupon = CouponHelper.GetCoupon(num2);
                    if (coupon != null)
                    {
                        dataRow["CouponMoeny"] = coupon.CouponValue.ToString();
                        if (coupon.ConditionValue > 0m)
                        {
                            dataRow["Limit"] = "满" + coupon.ConditionValue.ToString() + "元可用";
                        }
                        else
                        {
                            dataRow["Limit"] = "不限制";
                        }
                    }
                }
                else if (num3 == 4)
                {
                    dataRow["Url"] = "/BeginVote.aspx?voteId=" + num2;
                    VoteInfo vote = VoteHelper.GetVote((long)num2);
                    if (vote != null)
                    {
                        dataRow["Description"] = vote.Description;
                    }
                }
                else if (num3 == 5)
                {
                    GameInfo modelByGameId = GameHelper.GetModelByGameId(num2);
                    if (modelByGameId != null)
                    {
                        dataRow["Url"]         = modelByGameId.GameUrl;
                        dataRow["Limit"]       = this.GetLimit(modelByGameId.LimitEveryDay, modelByGameId.MaximumDailyLimit);
                        dataRow["Point"]       = modelByGameId.NeedPoint.ToString();
                        dataRow["Description"] = modelByGameId.Description;
                    }
                }
            }
            string s = JsonConvert.SerializeObject(activityTopics, Formatting.Indented, new JsonConverter[]
            {
                new IsoDateTimeConverter
                {
                    DateTimeFormat = "yyyy-MM-dd HH:mm"
                }
            });

            context.Response.Write(s);
        }