Example #1
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');
     }
 }
Example #2
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     string[] allKeys = base.Request.Params.AllKeys;
     if (allKeys.Contains("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 System.DateTime?(this.vote.StartDate.Date);
         this.calendarEndDate.SelectedDate   = new System.DateTime?(this.vote.EndDate.Date);
         System.Web.UI.WebControls.HiddenField hiddenField  = this.SetMemberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField;
         System.Web.UI.WebControls.HiddenField hiddenField2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField;
         System.Web.UI.WebControls.HiddenField hiddenField3 = this.SetMemberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField;
         this.SetMemberRange.Grade        = this.vote.MemberGrades;
         this.SetMemberRange.DefualtGroup = this.vote.DefualtGroup;
         this.SetMemberRange.CustomGroup  = this.vote.CustomGroup;
         hiddenField.Value  = this.vote.MemberGrades;
         hiddenField2.Value = this.vote.DefualtGroup;
         hiddenField3.Value = this.vote.CustomGroup;
         if (this.vote.VoteItems != null && this.vote.VoteItems.Count > 0)
         {
             foreach (VoteItemInfo current in this.vote.VoteItems)
             {
                 this.items = this.items + current.VoteItemName + ",";
             }
         }
         this.items = this.items.TrimEnd(new char[]
         {
             ','
         }).Replace(',', '\n');
     }
 }
Example #3
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 + "\"}");
     }
 }
Example #4
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 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);
        }
Example #6
0
 public void ProcessRequest(System.Web.HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     try
     {
         int             num          = int.Parse(context.Request["id"].ToString());
         string          text         = context.Request["name"].ToString();
         string          val          = context.Request["begin"].ToString();
         string          val2         = context.Request["end"].ToString();
         string          memberGrades = context.Request["memberlvl"].ToString();
         string          defualtGroup = context.Request["defualtgroup"].ToString();
         string          customGroup  = context.Request["customgroup"].ToString();
         string          text2        = context.Request["img"].ToString();
         string          text3        = context.Request["des"].ToString();
         bool            isMultiCheck = bool.Parse(context.Request["ismulti"].ToString());
         int             maxCheck     = int.Parse(context.Request["maxcheck"].ToString());
         string          text4        = context.Request["items"].ToString();
         System.DateTime now          = System.DateTime.Now;
         System.DateTime now2         = System.DateTime.Now;
         if (string.IsNullOrEmpty(text))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票标题不能为空\"}");
         }
         else if (text.Length > 60)
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票标题不能超过60个字符\"}");
         }
         else if (string.IsNullOrEmpty(text4))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"投票选项不能为空\"}");
         }
         else if (string.IsNullOrEmpty(text2))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"没有上传活动封面\"}");
         }
         else if (!val.bDate(ref now))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的开始时间\"}");
         }
         else if (!val2.bDate(ref now2))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"请输入正确的结束时间\"}");
         }
         else if (now2 <= now)
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"结束时间要大于开始时间\"}");
         }
         else if (string.IsNullOrEmpty(text3))
         {
             context.Response.Write("{\"type\":\"error\",\"data\":\"活动说明不能为空\"}");
         }
         else
         {
             VoteInfo voteInfo = new VoteInfo();
             if (num != 0)
             {
                 voteInfo = VoteHelper.GetVote((long)num);
                 if (voteInfo == null)
                 {
                     context.Response.Write("{\"type\":\"error\",\"data\":\"没有找到这个调查\"}");
                     return;
                 }
             }
             System.Collections.Generic.List <VoteItemInfo> list = new System.Collections.Generic.List <VoteItemInfo>();
             if (!string.IsNullOrEmpty(text4))
             {
                 string[] array = text4.Split(new char[]
                 {
                     ','
                 });
                 if (array.Length > 0)
                 {
                     for (int i = 0; i < array.Length; i++)
                     {
                         VoteItemInfo voteItemInfo = new VoteItemInfo();
                         if (num > 0)
                         {
                             voteItemInfo.VoteId = (long)num;
                         }
                         voteItemInfo.ItemCount    = 0;
                         voteItemInfo.VoteItemName = array[i];
                         list.Add(voteItemInfo);
                     }
                 }
             }
             voteInfo.VoteName     = text;
             voteInfo.EndDate      = now2;
             voteInfo.StartDate    = now;
             voteInfo.MemberGrades = memberGrades;
             voteInfo.DefualtGroup = defualtGroup;
             voteInfo.CustomGroup  = customGroup;
             voteInfo.Description  = text3;
             voteInfo.ImageUrl     = text2;
             voteInfo.IsMultiCheck = isMultiCheck;
             voteInfo.MaxCheck     = maxCheck;
             voteInfo.VoteItems    = list;
             long num2;
             if (num == 0)
             {
                 num2 = VoteHelper.Create(voteInfo);
             }
             else
             {
                 num2 = voteInfo.VoteId;
                 if (!VoteHelper.Update(voteInfo, true))
                 {
                     num2 = 0L;
                 }
             }
             if (num2 > 0L)
             {
                 context.Response.Write("{\"type\":\"success\",\"data\":\"" + num2.ToString() + "\"}");
             }
             else
             {
                 context.Response.Write("{\"type\":\"error\",\"data\":\"写数据库出错\"}");
             }
         }
     }
     catch (System.Exception ex)
     {
         context.Response.Write("{\"type\":\"error\",\"data\":\"" + ex.Message + "\"}");
     }
 }