Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList = QusetionProvider.SelectAll();
        string action = GetstringKey("action");

        if (action != "save")
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                int          _iD       = Convert.ToInt32(this.Request["iD"]);
                QuestionType condition = new QuestionType();
                condition.ID = _iD;
                news         = TableOperate <QuestionType> .GetRowData(condition);

                m_nowChild = Convert.ToString(news.Child).ToLower();
                iD.Value   = Convert.ToString(news.ID);
            }
            DataBind();
        }
        else
        {
            Result       result         = new Result();
            string       logbrief       = "";
            QuestionType newChannelNews = new QuestionType();
            newChannelNews.ID = 0;
            newChannelNews.AutoForm(this.Page);
            string title = newChannelNews.Name;
            int    _iD;
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                _iD = Convert.ToInt32(this.Request["iD"]);
                QusetionProvider.Update(newChannelNews);
                result.msg = "编辑成功,等待返回列表";
            }
            else
            {
                newChannelNews.AddTime = DateTime.Now;
                newChannelNews.AddID   = AdminMethod.AdminID;
                _iD        = QusetionProvider.Insert(newChannelNews);
                result.msg = "添加成功,等待返回列表";
            }

            if (_iD > 0)
            {
                result.isOk = true;
                Lognet.AddLogin(logbrief);
            }
            else
            {
                result.msg = "操作失败";
            }
            Response.ContentType = "text/json";
            Response.Write(new JavaScriptSerializer().Serialize(result));
            Response.End();
        }
        DataBind();
    }
Exemplo n.º 3
0
    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;
    }
Exemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
//        [{
//	"text": "父节点 1",
//	"nodes": [{
//		"text": "子节点 1",
//		"nodes": [{
//			"text": "孙子节点 1"

//        }, {
//			"text": "孙子节点 2"
//		}]
//	}, {
//		"text": "子节点 2"
//	}]
//}, {
//	"text": "父节点 2"
//}, {
//	"text": "父节点 3"
//}, {
//	"text": "父节点 4"
//}, {
//	"text": "父节点 5"
//}]
        channelList = QusetionProvider.SelectAll();
        string arrstr = "";

        for (int i = 0; i < channelList.Count; i++)
        {
            arrstr += channelList[i].ID + ",";
        }
        string[] arry     = arrstr.TrimEnd(',').Split(',');
        string   TreeJson = "[";
        string   JsonData = "";

        for (int i = 0; i < channelList.Count; i++)
        {
            if (channelList[i].Depth == 0)
            {
                JsonData += "{";
                JsonData += "\"text\":\"" + channelList[i].Name + "\"";
                JsonData += ",\"id\":\"" + channelList[i].ID + "\"";
                JsonData += ",\"itemid\":\"" + i + "\"";
                if (channelList[i].Child)
                {
                    JsonData += GetChild(channelList[i].ID);
                }
                JsonData += "},";
            }
            else
            {
                if (!((IList)arry).Contains(channelList[i].ParentID + ""))
                {
                    JsonData += "{";
                    JsonData += "\"text\":\"" + channelList[i].Name + "\"";
                    JsonData += ",\"id\":\"" + channelList[i].ID + "\"";
                    JsonData += "},";
                }
            }
        }
        JsonData  = JsonData.TrimEnd(',');
        TreeJson += JsonData + "]";
        Response.Write(TreeJson);
    }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        m_ExhibitionList = QusetionProvider.SelectAll();
        string action = GetstringKey("action");

        if (action != "save")
        {
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                int          _iD       = Convert.ToInt32(this.Request["iD"]);
                QuestionBank condition = new QuestionBank();
                condition.ID = _iD;
                news         = TableOperate <QuestionBank> .GetRowData(condition);

                iD.Value = Convert.ToString(news.ID);
            }
            DataBind();
        }
        else
        {
            Result       result         = new Result();
            string       logbrief       = "";
            QuestionBank newChannelNews = new QuestionBank();
            newChannelNews.ID = 0;
            newChannelNews.AutoForm(this.Page);

            string Title = newChannelNews.Title;
            int    _iD;
            if (!string.IsNullOrEmpty(this.Request["iD"]))
            {
                _iD = Convert.ToInt32(this.Request["iD"]);
                TableOperate <QuestionBank> .Update(newChannelNews);

                result.msg = "编辑成功,等待返回列表";
                logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了题库【" + Title + "】";
            }
            else
            {
                newChannelNews.AddTime      = DateTime.Now;
                newChannelNews.AddID        = AdminMethod.AdminID;
                newChannelNews.ExhibitionID = AdminMethod.ExhibitionID;

                newChannelNews.OrderID = CloudSQL.GetNowTime();
                _iD = TableOperate <QuestionBank> .InsertReturnID(newChannelNews);

                result.msg = "添加成功,等待返回列表";
                logbrief   = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了题库【" + Title + "】";
            }

            if (_iD > 0)
            {
                result.isOk = true;
                Lognet.AddLogin(logbrief);
            }
            else
            {
                result.msg = "操作失败";
            }
            Response.ContentType = "text/json";
            Response.Write(new JavaScriptSerializer().Serialize(result));
            Response.End();
        }
        DataBind();
    }