protected void Page_Load(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.Request["seviceID"])) { return; } if (string.IsNullOrEmpty(this.Request["sn"])) { return; } int SeviceID = Convert.ToInt32(this.Request["seviceID"]); string sn = RequestString.NoHTML(Convert.ToString(this.Request["sn"])); if (!SysConfig.IsTrueSn(SeviceID, sn)) { string error = "{\"state\":\"false\", \"msg\":\"加密错误\"}"; Response.Write(error); return; } else { string act = Convert.ToString(Request["act"]); int rootID = 0; if (!string.IsNullOrEmpty(this.Request["rootID"])) { rootID = Convert.ToInt32(Request["rootID"]); } int typeid = 0; if (!string.IsNullOrEmpty(this.Request["typeid"])) { typeid = Convert.ToInt32(Request["typeid"]); } List <QuestionType> Typelist = QusetionProvider.SelectByRootID(rootID); string json = "{\"Typelist\":["; for (int i = 0; i < Typelist.Count; i++) { json += "{\"ID\":" + Typelist[i].ID + ", \"Name\":\"" + Typelist[i].Name + "\", \"ParentID\":\"" + Typelist[i].ParentID + "\", \"Depth\":\"" + Typelist[i].Depth + "\", \"RootID\":\"" + Typelist[i].RootID + "\"},"; } json = json.Trim(','); json += "],"; View_Question condition = new View_Question(); condition.ExhibitionID = SeviceID; if (typeid != 0) { condition.TypeID = typeid; } View_Question value = new View_Question(); List <View_Question> list = TableOperate <View_Question> .Select(value, condition, 0, "order by OrderID asc"); json += "\"list\":["; for (int i = 0; i < list.Count; i++) { json += "{\"ID\":" + list[i].ID + ", \"Title\":\"" + list[i].Title + "\", \"Files\":\"UploadFiles/" + list[i].Files + "\", \"Brief\":\"" + list[i].Brief + "\", \"TypeID\":\"" + list[i].TypeID + "\",\"OptionList\":" + GetOption(list[i]) + "},"; } json = json.Trim(','); json += "]}"; Response.Write(json); } }
protected string GetOption(View_Question answer) { string jsonstr = "["; string[] answeArry = answer.Answer.Split(','); string[] trueArry = answer.TrueList.Split(','); for (int i = 0; i < answeArry.Length; i++) { jsonstr += "{\"answer\":\"" + answeArry[i] + "\", \"istrue\":\"" + trueArry[i] + "\"},"; } jsonstr = jsonstr.Trim(','); jsonstr += "]"; return(jsonstr); }
protected void Page_Load(object sender, EventArgs e) { m_ExhibitionList = QusetionProvider.SelectAll(); View_Question condition = new View_Question(); View_Question value = new View_Question(); string title = GetstringKey("name"); PCID = GetIntKey("pcid"); if (title != "") { condition.Title = "%" + title + "%"; condition.AddAttach("Title", "like"); } if (PCID != 0) { condition.TypeID = PCID; } condition.ExhibitionID = AdminMethod.ExhibitionID; m_tableManageList = TableOperate <View_Question> .SelectByPage(value, condition, "order by OrderID asc", PageSize, PageIndex, ref Count); DataBind(); name.Value = title; }
protected void Page_Load(object sender, EventArgs e) { string action = GetstringKey("action"); string ID = Request["ID"]; View_Question condition = new View_Question(); View_Question v = new View_Question(); if (string.IsNullOrEmpty(ID)) { Response.Write(""); return; } condition.ID = Convert.ToInt32(ID); View_Question myView = TableOperate <View_Question> .GetRowData(v, condition); if (myView.ID == 0) { Response.Write(""); return; } View_Question condition2 = new View_Question(); View_Question V2 = new View_Question(); condition2.AddConditon(" and ID<>'" + condition.ID + "'"); condition2.TypeID = myView.TypeID; string strOrder = string.Empty; condition2.OrderID = myView.OrderID; if (action == "up") { //向上,现在是时间越早越在上面 condition2.AddAttach("OrderID", "<"); strOrder = " order by OrderID DESC"; //时间从大到小 } else { condition2.AddAttach("OrderID", ">"); strOrder = " order by OrderID ASC"; } List <View_Question> desOrderMdl = TableOperate <View_Question> .Select(V2, condition2, 1, strOrder); if (desOrderMdl.Count != 1) { Response.Write(""); return; } View_Question conditionU = new View_Question(); conditionU.ID = myView.ID; conditionU.OrderID = desOrderMdl[0].OrderID; TableOperate <View_Question> .Update(conditionU); View_Question conditionU2 = new View_Question(); conditionU2.ID = desOrderMdl[0].ID; conditionU2.OrderID = myView.OrderID; TableOperate <View_Question> .Update(conditionU2); Response.StatusCode = 200; Response.Write(conditionU2.ID); }