コード例 #1
0
        public static string GetSubDataList(string ScoreId, string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_TestingPoint bll        = new BLL_S_TestingPoint();
                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_TP_Id,TPNameBasic from S_TestingPoint t
left join S_TestingPointBasic t1 on t1.S_TestingPointBasic_Id=t.S_TestingPointBasic_Id
left join [S_TestQuestions_TP] tk on tk.S_TestingPoint_Id=t.S_TestingPoint_Id and TestQuestions_Score_ID='{0}' " + strWhere + " order by TPCode", 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_TestingPoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_TestingPoint_Id          = dt.Rows[i]["S_TestingPoint_Id"].ToString(),
                        Parent_Id                  = dt.Rows[i]["Parent_Id"].ToString(),
                        TPName                     = string.IsNullOrEmpty(dt.Rows[i]["TPNameBasic"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].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_TP_Id"].ToString(),
                        IsChecked                  = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_TP_Id"].ToString()) ? "checked" : "",
                        ScoreId                    = ScoreId,
                        tkid = !string.IsNullOrEmpty(dt.Rows[i]["S_TestQuestions_TP_Id"].ToString()) ? dt.Rows[i]["S_TestQuestions_TP_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()
                }));
            }
        }
コード例 #2
0
        public static string GetSubDataList(string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_TestingPoint bll        = new BLL_S_TestingPoint();
                DataTable          dt         = new DataTable();
                List <object>      listReturn = new List <object>();
                string             strWhere   = " Parent_Id='" + parentId + "' ";
                dt = bll.GetListJoinDict(strWhere, "TPCode").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_TestingPoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_TestingPoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["TPNameBasic"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].ToString(),
                        KPCode      = dt.Rows[i]["TPCode"].ToString(),
                        KPLevel     = dt.Rows[i]["TPLevel"].ToString(),
                        KPLevelName = dt.Rows[i]["TPLevelName"].ToString(),
                        parentIdStr = parentIdStr,
                        paddingLeft = 15 * (parentIdStr.Split('&').Length - 1),
                        hasChildren = drSub.Length,
                        IsLast      = dt.Rows[i]["IsLast"].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()
                }));
            }
        }
コード例 #3
0
        public static string GetSubDataList1(string ScoreId, string parentId, string parentIdStr)
        {
            try
            {
                BLL_S_TestingPoint bll        = new BLL_S_TestingPoint();
                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,TPNameBasic from S_TestingPoint t
left join S_TestingPointBasic t1 on t1.S_TestingPointBasic_Id=t.S_TestingPointBasic_Id
left join [TestQuestions_Knowledge] tk on tk.S_KnowledgePoint_Id=t.S_TestingPoint_Id and TestQuestions_Score_ID='{0}' " + strWhere + " order by TPCode", 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_TestingPoint_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_TestingPoint_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_TestingPoint_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]["TPName"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].ToString());
                    stbHtml.AppendFormat("{0}{1}", drSub.Length > 0 ? string.Format("<i class=\"fa fa-plus-square-o\" onclick=\"loadSubData1(this,'{0}');\" ></i>&nbsp;&nbsp;", dt.Rows[i]["S_TestingPoint_Id"]) : "", !string.IsNullOrEmpty(dt.Rows[i]["TPName"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].ToString());
                    stbHtml.Append("</tr>");
                }
                return(stbHtml.ToString());
            }
            catch (Exception ex)
            {
                return("");
            }
        }
コード例 #4
0
        public static string GetDataList1(string ScoreId, string GradeTerm, string Subject)
        {
            try
            {
                BLL_S_TestingPoint bll      = new BLL_S_TestingPoint();
                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() + "' ";
                }
                string sql = string.Format(@"select t.*,tk.TestQuestions_Knowledge_ID,TPNameBasic from S_TestingPoint t
left join S_TestingPointBasic t1 on t1.S_TestingPointBasic_Id=t.S_TestingPointBasic_Id
left join [TestQuestions_Knowledge] tk on tk.S_KnowledgePoint_Id=t.S_TestingPoint_Id and TestQuestions_Score_ID='{0}' where " + strWhere + " order by TPCode", 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_TestingPoint_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_TestingPoint_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_TestingPoint_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]["TPName"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].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=\"loadSubData1(this,'{0}');\" ></i>&nbsp;&nbsp;", dt.Rows[i]["S_TestingPoint_Id"]) : "", !string.IsNullOrEmpty(dt.Rows[i]["TPName"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].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("");
            }
        }
コード例 #5
0
        public static string GetDataList(string Name, string GradeTerm, string Subject, string Syllabus, string Test_Category, int PageIndex, int PageSize)
        {
            try
            {
                BLL_S_TestingPoint bll        = new BLL_S_TestingPoint();
                DataTable          dt         = new DataTable();
                List <object>      listReturn = new List <object>();
                string             strWhere   = " Parent_Id='0' ";//考点
                if (!string.IsNullOrEmpty(Name))
                {
                    strWhere += " and (TPName like '%" + Name.Filter() + "%' or TPCode like '%" + Name.Filter() + "%') ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and GradeTerm='" + GradeTerm.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and Subject='" + Subject.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and Syllabus='" + Syllabus.Filter() + "' ";
                }
                if (!string.IsNullOrEmpty(GradeTerm))
                {
                    strWhere += " and Test_Category='" + Test_Category.Filter() + "' ";
                }

                dt = bll.GetListByPageJoinDict(strWhere, "TPCode", ((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_TestingPoint_Id"].ToString() + "'");
                    listReturn.Add(new
                    {
                        S_KnowledgePoint_Id = dt.Rows[i]["S_TestingPoint_Id"].ToString(),
                        Parent_Id           = dt.Rows[i]["Parent_Id"].ToString().Trim(),
                        KPName      = string.IsNullOrEmpty(dt.Rows[i]["TPNameBasic"].ToString()) ? dt.Rows[i]["TPName"].ToString() : dt.Rows[i]["TPNameBasic"].ToString(),
                        KPCode      = dt.Rows[i]["TPCode"].ToString(),
                        KPLevel     = dt.Rows[i]["TPLevel"].ToString(),
                        KPLevelName = dt.Rows[i]["TPLevelName"].ToString(),
                        parentIdStr = "",
                        paddingLeft = "",
                        hasChildren = drSub.Length,
                        IsLast      = dt.Rows[i]["IsLast"].ToString(),
                    });
                }

                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()
                }));
            }
        }