private string UserPoll(HttpContext context) { JsonObject obj2 = new JsonObject(); int num = Convert.ToInt32(context.Request.Form["UID"]); string str = context.Request.Form["Option"]; string str2 = context.Request.Form["FID"]; if (context.Request.Cookies["vote" + str2] != null) { HttpCookie cookie = context.Request.Cookies["vote" + str2]; if ((cookie.Values["voteid"].ToString() != "") || (cookie.Values["voteid"].ToString() != null)) { obj2.Put("STATUS", "FAILED"); } } Maticsoft.BLL.Poll.UserPoll poll = new Maticsoft.BLL.Poll.UserPoll(); string[] strArray = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); Maticsoft.Model.Poll.UserPoll model = null; for (int i = 0; i < strArray.Length; i++) { string[] strArray2 = strArray[i].Split(new char[0x5f], StringSplitOptions.RemoveEmptyEntries); model.CreatTime = new DateTime?(DateTime.Now); model.TopicID = new int?(int.Parse(strArray2[0])); model.UserID = num; model.UserIP = context.Request.UserHostAddress; model.OptionID = new int?(int.Parse(strArray2[1])); poll.Add(model); } obj2.Put("STATUS", "SUCCESS"); return obj2.ToString(); }
public ActionResult SubmitPoll(FormCollection fm) { string str = fm["TopicIDjson"]; if (base.Request.Cookies["votetopic"] != null) { return base.Content("isnotnull"); } if (string.IsNullOrWhiteSpace(str)) { return base.Content("false"); } Maticsoft.BLL.Poll.PollUsers users = new Maticsoft.BLL.Poll.PollUsers(); Maticsoft.Model.Poll.PollUsers model = new Maticsoft.Model.Poll.PollUsers(); int num = users.Add(model); if (num < 0) { return base.Content("false"); } Maticsoft.Model.Poll.UserPoll poll = new Maticsoft.Model.Poll.UserPoll(); Maticsoft.BLL.Poll.UserPoll poll2 = new Maticsoft.BLL.Poll.UserPoll(); poll.UserIP = base.Request.UserHostAddress; poll.UserID = num; foreach (JsonObject obj2 in JsonConvert.Import<JsonArray>(str)) { int num2 = Globals.SafeInt(obj2["topicid"].ToString(), 0); string text = obj2["topicvlaue"].ToString(); int num3 = Globals.SafeInt(obj2["type"].ToString(), -1); poll.TopicID = new int?(num2); switch (num3) { case 0: { poll.OptionID = new int?(Globals.SafeInt(text, -1)); poll2.Add(poll); continue; } case 1: { poll.OptionIDList = text; if (!string.IsNullOrWhiteSpace(text)) { poll2.Add2(poll); } continue; } case 2: { continue; } } } HttpCookie cookie = new HttpCookie("votetopic"); cookie.Values.Add("voteid", "votetopic"); cookie.Expires = DateTime.Now.AddHours(240.0); base.Response.Cookies.Add(cookie); return base.Content("true"); }
public void SubmitPoll(FormCollection collection) { JsonObject obj2 = new JsonObject(); if (base.Request.Cookies["vote" + collection["FID"]] != null) { obj2.Accumulate("STATUS", "805"); obj2.Accumulate("DATA", "您已经投过票,请不要重复投票!"); } else { Maticsoft.Model.Poll.UserPoll model = new Maticsoft.Model.Poll.UserPoll(); Maticsoft.BLL.Poll.UserPoll poll2 = new Maticsoft.BLL.Poll.UserPoll(); model.UserID = Globals.SafeInt(collection["UID"], 0); model.UserIP = base.Request.UserHostAddress; string str = collection["Option"]; if (!string.IsNullOrWhiteSpace(str)) { string[] strArray = str.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); int num = 0; foreach (string str2 in strArray) { string[] strArray2 = str2.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); model.TopicID = new int?(Globals.SafeInt(strArray2[0], -1)); model.OptionID = new int?(Globals.SafeInt(strArray2[1], -1)); poll2.Add(model); num++; } if (num == strArray.Length) { HttpCookie cookie = new HttpCookie("vote" + collection["FID"]); cookie.Values.Add("voteid", collection["FID"]); cookie.Expires = DateTime.Now.AddHours(240.0); base.Response.Cookies.Add(cookie); obj2.Accumulate("STATUS", "800"); } else { obj2.Accumulate("STATUS", "804"); } } else { obj2.Accumulate("STATUS", "804"); } } base.Response.Write(obj2.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if ((!this.Page.IsPostBack && (base.Request.Params["fid"] != null)) && (base.Request.Params["fid"].Trim() != "")) { string str = base.Request.Params["fid"]; int formID = Convert.ToInt32(str); Maticsoft.Model.Poll.Forms model = new Maticsoft.BLL.Poll.Forms().GetModel(formID); this.lblFormName.Text = model.Name; this.lblFormID.Text = model.FormID.ToString(); Maticsoft.BLL.Poll.UserPoll poll = new Maticsoft.BLL.Poll.UserPoll(); this.polluser = poll.GetUserByForm(0).ToString(); this.formuser = poll.GetUserByForm(formID).ToString(); this.BindData(formID); } }