/// <summary> /// 获取指定章节的活动信息(课程预览和学习) /// </summary> /// <param name="id"></param> /// <returns></returns> public List<Course_ActivityInfo> GetLearnActivityInfo(int id) { string sql = @"select id,title,content,unittype,timelength,display from [dbo].[Course_UnitContent] where unitid=@Id and Display = 1 and Delflag=0 order by Sort"; SqlParameter[] cmdParams = new SqlParameter[]{ new SqlParameter("@Id", SqlDbType.Int, 4) { Value = id } }; List<Course_ActivityInfo> list = new List<Course_ActivityInfo>(); using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql, cmdParams)) { while (reader.Read()) { Course_ActivityInfo model = new Course_ActivityInfo(); model.Id = Convert.ToInt32(reader["id"]); model.Title = reader["title"].ToString(); model.Content = reader["content"].ToString(); model.UnitType = Convert.ToInt32(reader["unittype"]); model.TimeLength = Convert.ToInt32(reader["timelength"]); model.Display = Convert.ToBoolean(reader["display"]); list.Add(model); } } return list; }
/// <summary> /// 获取指定章节的活动信息(课程详细) /// </summary> /// <param name="id"></param> /// <returns></returns> public List<Course_ActivityInfo> GetActivityInfo(int id) { string sql = @"select distinct A.id as id,title,Sort,content,unittype,timelength,display,B.Status as status from [dbo].[Course_UnitContent] as A left join dbo.[Member_ClassUnitContentSchedule] as B on B.UnitContent = A.Id and B.Delflag = 0 where unitid=@Id and A.Delflag=0 order by Sort"; SqlParameter[] cmdParams = new SqlParameter[]{ new SqlParameter("@Id", SqlDbType.Int, 4) { Value = id } }; List<Course_ActivityInfo> list = new List<Course_ActivityInfo>(); using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql, cmdParams)) { while (reader.Read()) { Course_ActivityInfo model = new Course_ActivityInfo(); model.Id = Convert.ToInt32(reader["id"]); model.Title = reader["title"].ToString(); model.Content = reader["content"].ToString(); model.UnitType = Convert.ToInt32(reader["unittype"]); model.TimeLength = Convert.ToInt32(reader["timelength"]); model.Display = Convert.ToBoolean(reader["display"]); if (!string.IsNullOrEmpty(reader["Status"].ToString())) { model.Status = Convert.ToBoolean(reader["Status"]); } list.Add(model); } } return list; }
/// <summary> /// 获取指定课程ID的结业考试(课程预览和学习) /// </summary> /// <param name="id"></param> /// <returns></returns> public List<Course_ActivityInfo> GetExamLearnInfo(int id) { string sql = @"select distinct C.id as id,C.title as title,C.TimeLength as TimeLength,C.TestCnt as TestCnt,C.display as display from dbo.[Traning_Detail] as A,[dbo].[Course_UnitDetail] as B,[dbo].[Course_UnitContent] as C where C.unitid = B.id and B.trainingid = A.id and C.Display = 1 and C.Delflag = 0 and B.Delflag = 0 and A.Delflag = 0 and A.Id = @Id and C.UnitType = 6 order by C.id"; SqlParameter[] cmdParams = new SqlParameter[]{ new SqlParameter("@Id", SqlDbType.Int, 4) { Value = id } }; List<Course_ActivityInfo> list = new List<Course_ActivityInfo>(); using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql, cmdParams)) { while (reader.Read()) { Course_ActivityInfo model = new Course_ActivityInfo(); model.Id = Convert.ToInt32(reader["id"]); model.Title = reader["title"].ToString(); model.TimeLength = Convert.ToInt32(reader["TimeLength"]); model.TestCnt = Convert.ToInt32(reader["TestCnt"]); model.Display = Convert.ToBoolean(reader["display"]); list.Add(model); } } return list; }