/// <summary> /// 刷新分数 /// </summary> /// <param name="pLoggingSessionInfo"></param> public void RefreshCourseAvgScore(LoggingSessionInfo pLoggingSessionInfo, string pOnlineCourseId) { try { ItemCommentBLL commentBll = new ItemCommentBLL(pLoggingSessionInfo); int avgStar = commentBll.GetCourseAvgStar(pOnlineCourseId); MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(pLoggingSessionInfo); MLOnlineCourseEntity entity = courseBll.GetByID(pOnlineCourseId); if (entity != null) { entity.AverageStar = avgStar; courseBll.Update(entity); } } catch (Exception ex) { } }
public string GetOnlineCourseDetail(string pRequest) { var rd = new APIResponse <GetOnlineCourseDetailRD>(); var rdData = new GetOnlineCourseDetailRD(); var rp = pRequest.DeserializeJSONTo <APIRequest <GetOnlineCourseDetailRP> >(); if (rp.Parameters == null) { throw new ArgumentException(); } if (rp.Parameters != null) { rp.Parameters.Validate(); } var loggingSessionInfo = Default.GetBSLoggingSession(rp.CustomerID, rp.UserID); try { MLOnlineCourseBLL courseBll = new MLOnlineCourseBLL(loggingSessionInfo); //课程信息 DataTable dTbl = courseBll.SearchOnlineCourseDetail(rp.Parameters.OnlineCourseID); OnlineCourse entity = null; if (dTbl != null && dTbl.Rows.Count > 0) { entity = DataTableToObject.ConvertToObject <OnlineCourse>(dTbl.Rows[0]); } //课程附件列表 List <CourseWare> list = new List <CourseWare>(); MLCourseWareBLL wareBll = new MLCourseWareBLL(loggingSessionInfo); DataTable dTblWare = wareBll.GetCourseWare(rp.Parameters.OnlineCourseID); if (dTblWare != null && dTblWare.Rows.Count > 0) { list = DataTableToObject.ConvertToList <CourseWare>(dTblWare); } //构建CourseDetail对象 CourseDetail detail = new CourseDetail { OnlineCourse = entity, CourseWareList = list }; rdData.CourseDetail = detail; //添加访问次数 try { MLOnlineCourseEntity courseEntity = courseBll.GetByID(rp.Parameters.OnlineCourseID); if (courseEntity != null) { courseEntity.AccessCount++; courseBll.Update(courseEntity); } } catch (Exception ex) { } rd.ResultCode = 0; } catch (Exception ex) { rd.ResultCode = 103; rd.Message = ex.Message; } rd.Data = rdData; return(rd.ToJSON()); }