コード例 #1
0
        /// <summary>
        /// 获取作业的所有试题信息
        /// </summary>
        /// <param name="courseId"></param>
        /// <param name="zyId"></param>
        /// <returns></returns>
        public static List <dto_Question> GetQdbZyQuestions(int courseId, int zyId)
        {
            List <dto_Question> tempresult = null;
            string key = RedisHelper.GetEasyZyRedisKey(CacheCatalog.QdbZyAllQuestions, zyId.ToString());

            using (var client = RedisHelper.Instance.GetRedisClient(CacheCatalog.QdbZyAllQuestions.ToString()))
            {
                if (client != null)
                {
                    tempresult = client.Get <List <dto_Question> >(key);
                    if (tempresult == null)
                    {
                        string s = GetQdbZyQuesJson(zyId);
                        if (string.IsNullOrEmpty(s))
                        {
                            return(null);
                        }
                        List <dto_ZyQuestion> zyql = JsonConvert.DeserializeObject <List <dto_ZyQuestion> >(s);
                        if (zyql != null)
                        {
                            tempresult = new List <dto_Question>();
                            zyql.Select(a => a.PQId).Distinct().ToList().ForEach(b =>
                            {
                                tempresult.Add(B_QuesRedis.GetQuestion(courseId, b));
                            });

                            client.Set(key, tempresult, ts);
                        }
                    }
                }
            }

            return(tempresult);
        }
コード例 #2
0
ファイル: B_QuesBase.cs プロジェクト: jiangzixuan/easyzy.com
        public static List <dto_ZTree> GetCatalogsTree(int bookId)
        {
            List <T_CatalogNodes> cataloglist = B_QuesRedis.GetCatalogs(bookId);
            List <dto_ZTree>      tree        = new List <dto_ZTree>();

            cataloglist.ForEach(p =>
            {
                dto_ZTree node = new dto_ZTree();
                node.id        = p.Id;
                node.pId       = p.ParentId;
                node.name      = p.Name;
                node.ntype     = p.Type;
                //node.iconSkin = "icon01";
                tree.Add(node);
            });
            return(tree);
        }
コード例 #3
0
ファイル: B_QuesBase.cs プロジェクト: jiangzixuan/easyzy.com
        public static List <dto_ZTree> GetKnowledgePointsTree(int courseId)
        {
            List <T_KnowledgePoints> kpl = B_QuesRedis.GetKnowledgePoints(courseId);

            if (kpl == null)
            {
                return(null);
            }
            List <dto_ZTree> tree            = new List <dto_ZTree>();
            List <int>       ExceptKPointIds = new List <int>();

            for (int i = 0; i < ExceptedKPoints.GetLength(0); i++)
            {
                if (ExceptedKPoints[i, 0] == courseId)
                {
                    ExceptKPointIds.Add(ExceptedKPoints[i, 1]);
                }
            }
            tree = GetAllKPTree(0, kpl, ExceptKPointIds.ToArray());

            return(tree);
        }