Ejemplo 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;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据课程ID获取章节列表
        /// </summary>
        /// <param name="courseid">课程ID</param>
        /// <param name="pid">上级章节ID</param>
        /// <returns></returns>
        public static List<Entity.LessonEntity> GetCourseLessons(string courseid, string pid)
        {
            DataTable dt = new CourseDAL().GetCourseLessons(courseid, pid);

            List<Entity.LessonEntity> list = new List<Entity.LessonEntity>();
            foreach (DataRow dr in dt.Rows)
            {
                LessonEntity model = new LessonEntity();
                model.FillData(dr);
                list.Add(model);
            }

            return list;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 根据ID获取章节实体
 /// </summary>
 /// <param name="lessonid">章节ID</param>
 /// <returns></returns>
 public static Entity.LessonEntity GetCourseLessonByID(string lessonid)
 {
     Entity.LessonEntity model = new LessonEntity();
     DataTable dt = new DAL.CourseDAL().GetCourseLessonByID(lessonid);
     if (dt.Rows.Count > 0)
     {
         model.FillData(dt.Rows[0]);
     }
     return model;
 }