Beispiel #1
0
        /// <summary>
        ///     根据条件查询问题列表并且分页
        /// </summary>
        /// <param name="content">题目</param>
        /// <param name="type">类型</param>
        /// <param name="level">难度</param>
        /// <param name="key">知识点</param>
        /// <param name="pageSize">每页显示的条数</param>
        /// <param name="pageIndex">页数</param>
        /// <returns></returns>
        public List <tbQuestion> GetListByQuery(ref int totalcount, int sortID, string content, string keyName,
                                                int pageSize, int pageIndex, int type, int level)
        {
            var listkey  = new List <int>();
            var sotrlist = new List <int>();

            if (!string.IsNullOrEmpty(keyName))
            {
                List <tbKnowledgeKey> keyList =
                    kdb.GetAllList <tbKnowledgeKey>(false).Where(p => p.KeyName.Contains(keyName)).ToList();
                listkey = keyList.Select(p => p._id).ToList();
                if (listkey.Count == 0)
                {
                    return(new List <tbQuestion>());
                }
            }
            if (sortID != 0)
            {
                sotrlist.Add(sortID);
                List <tbQuestionSort> list = sortdb.GetAllQuestionSortList();
                GetSortByFatherID(list, sortID, ref sotrlist);
            }

            return(Qdb.GetListByQuery(ref totalcount, sotrlist, content, listkey, pageSize, pageIndex, type, level));
        }
Beispiel #2
0
 /// <summary>
 ///     获取所有的知识点
 /// </summary>
 /// <param name="totalCount">总条数</param>
 /// <param name="keyName">关键字</param>
 /// <param name="pageSize">没有显示条数</param>
 /// <param name="pageIndex">页数</param>
 /// <returns></returns>
 public List <tbKnowledgeKey> GetAllKnowledgeKeys(ref int totalCount, string keyName = "", int pageSize = 20,
                                                  int pageIndex = 1)
 {
     return(Kkdb.GetAllList <tbKnowledgeKey>(ref totalCount, Query.Matches("KeyName", keyName.FuzzyQuery()),
                                             new SortByDocument("_id", -1), pageIndex, pageSize));
 }