Exemplo n.º 1
0
        public static string GetSubDataList(string ScoreId, string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_KnowledgePoint bll        = new BLL_S_KnowledgePoint();
                DataTable            dt         = new DataTable();
                List <object>        listReturn = new List <object>();
                string strWhere = " where  Parent_Id='" + parentId + "'";
                string sql      = string.Format(@"select t.*,tk.S_TestQuestions_KP_Id,KPNameBasic from S_KnowledgePoint t
left join S_KnowledgePointBasic t1 on t1.S_KnowledgePointBasic_Id=t.S_KnowledgePointBasic_Id
left join [S_TestQuestions_KP] tk on tk.S_KnowledgePoint_Id=t.S_KnowledgePoint_Id and TestQuestions_Score_ID='{0}' " + strWhere + " order by KPCode", ScoreId);
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
                DataTable dtAll = bll.GetList("").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_KnowledgePoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["KPNameBasic"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString(),
                        IsLast      = dt.Rows[i]["IsLast"].ToString(),
                        parentIdStr = parentIdStr,
                        paddingLeft = 15 * (parentIdStr.Split('&').Length - 1),
                        hasChildren = drSub.Length,
                        TestQuestions_Knowledge_ID = dt.Rows[i]["S_TestQuestions_KP_Id"].ToString(),
                        IsChecked = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_KP_Id"].ToString()) ? "checked" : "",
                        ScoreId   = ScoreId,
                        tkid      = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_KP_Id"].ToString()) ? dt.Rows[i]["S_TestQuestions_KP_Id"].ToString() : Guid.NewGuid().ToString()
                    });
                }

                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
Exemplo n.º 2
0
        public static string GetSubDataList(string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_KnowledgePoint bll        = new BLL_S_KnowledgePoint();
                DataTable            dt         = new DataTable();
                List <object>        listReturn = new List <object>();
                string strWhere = " Parent_Id='" + parentId + "' ";
                dt = bll.GetListJoinDict(strWhere, "KPCode").Tables[0];
                DataTable dtAll = bll.GetList(" ").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_KnowledgePoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["KPNameBasic"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString(),
                        KPCode      = dt.Rows[i]["KPCode"].ToString(),
                        KPLevel     = dt.Rows[i]["KPLevel"].ToString(),
                        KPLevelName = dt.Rows[i]["KPLevelName"].ToString(),
                        IsLast      = dt.Rows[i]["IsLast"].ToString(),
                        parentIdStr = parentIdStr,
                        paddingLeft = 15 * (parentIdStr.Split('&').Length - 1),
                        hasChildren = drSub.Length
                    });
                }

                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            S_KnowledgePoint_Id = Request["S_KnowledgePoint_Id"].Filter();
            Model_S_KnowledgePoint model = new BLL_S_KnowledgePoint().GetModel(S_KnowledgePoint_Id);

            if (model != null)
            {
                S_KnowledgePointBasic_Id = model.S_KnowledgePointBasic_Id;
            }
            else
            {
                return;
            }
        }
Exemplo n.º 4
0
        public static string GetSubDataList(string ScoreId, string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_KnowledgePoint bll        = new BLL_S_KnowledgePoint();
                DataTable            dt         = new DataTable();
                List <object>        listReturn = new List <object>();
                string strWhere = " where  Parent_Id='" + parentId + "'";
                string sql      = string.Format(@"select t.*,tk.TestQuestions_Knowledge_ID,KPNameBasic from S_KnowledgePoint t
left join S_KnowledgePointBasic t1 on t1.S_KnowledgePointBasic_Id=t.S_KnowledgePointBasic_Id
left join [TestQuestions_Knowledge] tk on tk.S_KnowledgePoint_Id=t.S_KnowledgePoint_Id and TestQuestions_Score_ID='{0}' " + strWhere + " order by KPCode", ScoreId);
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
                DataTable     dtAll   = bll.GetList("").Tables[0];
                StringBuilder stbHtml = new StringBuilder();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                    stbHtml.Append("<tr>");
                    stbHtml.AppendFormat("<td onselectstart=\"return false\"");
                    stbHtml.AppendFormat("kpId=\"{0}\" pId=\"{1}\" hasChildren=\"{2}\" data-scoreid=\"{5}\" data-parentidstr=\"{3}\" data-toggle=\"0\" {4}>"
                                         , dt.Rows[i]["S_KnowledgePoint_Id"]
                                         , dt.Rows[i]["Parent_Id"]
                                         , drSub.Length
                                         , parentIdStr
                                         , drSub.Length > 0 ? "style=\"cursor:pointer;\"" : ""
                                         , ScoreId);
                    stbHtml.AppendFormat("<span style=\"padding-left:{0}px\"></span>", 15 * (parentIdStr.Split('&').Length - 1));
                    stbHtml.AppendFormat(dt.Rows[i]["IsLast"].ToString() == "1" ? "<input type=\"checkbox\" class='che' value=\"{0}\" {1} data-scoreid=\"{2}\" data-tkid=\"{3}\" data-attrname=\"{4}\">&nbsp;&nbsp;" : ""
                                         , dt.Rows[i]["S_KnowledgePoint_Id"]
                                         , !string.IsNullOrEmpty(dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString()) ? "checked" : ""
                                         , ScoreId
                                         , !string.IsNullOrEmpty(dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString()) ? dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString() : Guid.NewGuid().ToString()
                                         , !string.IsNullOrEmpty(dt.Rows[i]["KPName"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString());
                    stbHtml.AppendFormat("{0}{1}", drSub.Length > 0 ? string.Format("<i class=\"fa fa-plus-square-o\" onclick=\"loadSubData(this,'{0}');\" ></i>&nbsp;&nbsp;", dt.Rows[i]["S_KnowledgePoint_Id"]) : "", !string.IsNullOrEmpty(dt.Rows[i]["KPName"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString());
                    stbHtml.Append("</tr>");
                }
                return(stbHtml.ToString());
            }
            catch (Exception ex)
            {
                return("");
            }
        }
Exemplo n.º 5
0
        public static string GetDataList(string ScoreId, string GradeTerm, string Subject, string Resource_Version)
        {
            try
            {
                BLL_S_KnowledgePoint bll = new BLL_S_KnowledgePoint();
                DataTable            dt  = new DataTable();
                string strWhere          = " Parent_Id='0' ";
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.GradeTerm='" + GradeTerm.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.Subject='" + Subject.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.Resource_Version='" + Resource_Version.Filter() + "' ";
                }
                string sql = string.Format(@"select t.*,tk.TestQuestions_Knowledge_ID,KPNameBasic from S_KnowledgePoint t
left join S_KnowledgePointBasic t1 on t1.S_KnowledgePointBasic_Id=t.S_KnowledgePointBasic_Id
left join [TestQuestions_Knowledge] tk on tk.S_KnowledgePoint_Id=t.S_KnowledgePoint_Id and TestQuestions_Score_ID='{0}' where " + strWhere + " order by KPCode", ScoreId.Filter());
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
                DataTable     dtAll   = bll.GetList("").Tables[0];
                StringBuilder stbHtml = new StringBuilder();
                stbHtml.Append("<div class=\"panel\"><div class=\"panel-body\">");
                stbHtml.Append("<table class=\"table table-hover table-bordered\">");
                stbHtml.Append("<tbody id=\"tb1\">");
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                        stbHtml.Append("<tr>");
                        stbHtml.AppendFormat("<td onselectstart=\"return false\"");
                        stbHtml.AppendFormat("kpId=\"{0}\" pId=\"{1}\" hasChildren=\"{2}\" data-parentidstr=\"{3}\" data-toggle=\"0\" {4} data-scoreid=\"{5}\">"
                                             , dt.Rows[i]["S_KnowledgePoint_Id"]
                                             , dt.Rows[i]["Parent_Id"]
                                             , drSub.Length
                                             , ""
                                             , drSub.Length > 0 ? "style=\"cursor:pointer;\"" : ""
                                             , ScoreId);
                        stbHtml.AppendFormat(dt.Rows[i]["IsLast"].ToString() == "1" ? "<input type=\"checkbox\" class='che' value=\"{0}\" {1} data-scoreid=\"{2}\" data-tkid=\"{3}\" data-attrname=\"{4}\">" : ""
                                             , dt.Rows[i]["S_KnowledgePoint_Id"]
                                             , !string.IsNullOrEmpty(dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString()) ? "checked" : ""
                                             , ScoreId
                                             , !string.IsNullOrEmpty(dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString()) ? dt.Rows[i]["TestQuestions_Knowledge_ID"].ToString() : Guid.NewGuid().ToString()
                                             , !string.IsNullOrEmpty(dt.Rows[i]["KPName"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString());
                        stbHtml.AppendFormat("<span style=\"padding-left:{0}px\"></span>", "");
                        stbHtml.AppendFormat("{0}{1}", drSub.Length > 0 ? string.Format("<i class=\"fa fa-plus-square-o\" onclick=\"loadSubData(this,'{0}');\" ></i>&nbsp;&nbsp;", dt.Rows[i]["S_KnowledgePoint_Id"]) : "", !string.IsNullOrEmpty(dt.Rows[i]["KPName"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString());
                        stbHtml.Append("</tr>");
                    }
                }
                else
                {
                    stbHtml.Append("<tr><td class='text-center'>没有可匹配的知识点</td></tr>");
                }
                stbHtml.Append("</tbody></table></div></div>");
                return(stbHtml.ToString());
            }
            catch (Exception ex)
            {
                return("");
            }
        }
Exemplo n.º 6
0
        public static string GetDataList(string ScoreId, string GradeTerm, string Subject, string Resource_Version, string Book_Type)
        {
            try
            {
                BLL_S_KnowledgePoint bll        = new BLL_S_KnowledgePoint();
                DataTable            dt         = new DataTable();
                List <object>        listReturn = new List <object>();
                string strWhere = " Parent_Id='0' ";
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.GradeTerm='" + GradeTerm.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.Subject='" + Subject.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.Resource_Version='" + Resource_Version.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and t.Book_Type='" + Book_Type.Filter() + "' ";
                }

                string sql = string.Format(@"select t.*,tk.S_TestQuestions_KP_Id,KPNameBasic from S_KnowledgePoint t
left join S_KnowledgePointBasic t1 on t1.S_KnowledgePointBasic_Id=t.S_KnowledgePointBasic_Id
left join [S_TestQuestions_KP] tk on tk.S_KnowledgePoint_Id=t.S_KnowledgePoint_Id and TestQuestions_Score_ID='{0}' where " + strWhere + " order by KPCode", ScoreId.Filter());
                dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0];
                DataTable dtAll = bll.GetList("").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_KnowledgePoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString().Trim(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["KPNameBasic"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString(),
                        IsLast      = dt.Rows[i]["IsLast"].ToString(),
                        parentIdStr = "",
                        paddingLeft = "",
                        hasChildren = drSub.Length,
                        TestQuestions_Knowledge_ID = dt.Rows[i]["S_TestQuestions_KP_Id"].ToString(),
                        IsChecked = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_KP_Id"].ToString()) ? "checked" : "",
                        ScoreId   = ScoreId,
                        tkid      = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_KP_Id"].ToString()) ? dt.Rows[i]["S_TestQuestions_KP_Id"].ToString() : Guid.NewGuid().ToString()
                    });
                }

                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }
Exemplo n.º 7
0
        public static string GetDataList(string Name, string GradeTerm, string Subject, string Resource_Version, string Book_Type, int PageIndex, int PageSize)
        {
            try
            {
                BLL_S_KnowledgePoint bll        = new BLL_S_KnowledgePoint();
                DataTable            dt         = new DataTable();
                List <object>        listReturn = new List <object>();
                string strWhere = " Parent_Id='0' ";
                if (!string.IsNullOrEmpty(Name))
                {
                    strWhere += " and (KPName like '%" + Name.Filter() + "%' or KPCode like '%" + Name.Filter() + "%') ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and GradeTerm='" + GradeTerm.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(Subject))
                {
                    strWhere += " and Subject='" + Subject.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(Resource_Version))
                {
                    strWhere += " and Resource_Version='" + Resource_Version.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(Book_Type))
                {
                    strWhere += " and Book_Type='" + Book_Type.Filter() + "' ";
                }

                dt = bll.GetListByPageJoinDict(strWhere, "KPCode", ((PageIndex - 1) * PageSize + 1), (PageIndex * PageSize)).Tables[0];
                int       rCount = bll.GetRecordCount(strWhere);
                DataTable dtAll  = bll.GetList(" ").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow[] drSub = dtAll.Select("Parent_Id='" + dt.Rows[i]["S_KnowledgePoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_KnowledgePoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString().Trim(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["KPNameBasic"].ToString()) ? dt.Rows[i]["KPName"].ToString() : dt.Rows[i]["KPNameBasic"].ToString(),
                        KPCode      = dt.Rows[i]["KPCode"].ToString(),
                        KPLevel     = dt.Rows[i]["KPLevel"].ToString(),
                        KPLevelName = dt.Rows[i]["KPLevelName"].ToString(),
                        IsLast      = dt.Rows[i]["IsLast"].ToString(),
                        parentIdStr = "",
                        paddingLeft = "",
                        hasChildren = drSub.Length
                    });
                }

                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }