Esempio n. 1
0
        /// <summary>
        /// 根据课程ID获取章节列表
        /// </summary>
        /// <param name="courseid">课程ID</param>
        /// <returns></returns>
        public static List<Entity.LessonEntity> GetCourseLessons(string courseid)
        {
            DataTable dt = new CourseDAL().GetCourseLessons(courseid);

            List<Entity.LessonEntity> list = new List<Entity.LessonEntity>();
            foreach (DataRow dr in dt.Select("PID=''"))
            {
                LessonEntity model = new LessonEntity();
                model.FillData(dr);
                List<Entity.LessonEntity> clist = new List<Entity.LessonEntity>();
                foreach (DataRow cdr in dt.Select("PID='" + model.LessonID + "'"))
                {
                    LessonEntity cmodel = new LessonEntity();
                    cmodel.FillData(cdr);

                    clist.Add(cmodel);
                }
                model.ChildLessons = clist;
                list.Add(model);
            }

            return list;
        }