/// <summary> /// 添加一条数据记录到 Member_ClassContentTimeRecord 表,作为学习日志 /// </summary> /// <param name="ClassId"></param> /// <param name="TrainingId"></param> /// <param name="UnitContent"></param> /// <returns></returns> private int InsertClassContentTimeRecord(int ClassId, int TrainingId, int UnitContent) { var TimeRecordBll = new Member_ClassContentTimeRecordBLL(); var Model_TimeRecord = new Member_ClassContentTimeRecord(); Model_TimeRecord.ClassId = ClassId; Model_TimeRecord.TrainingId = TrainingId; Model_TimeRecord.AccountId = Code.SiteCache.Instance.LoginInfo.UserId; ; Model_TimeRecord.UnitContent = UnitContent; Model_TimeRecord.StartTime = DateTime.Now; Model_TimeRecord.EndTime = null; Model_TimeRecord.Delflag = false; Model_TimeRecord.CreateDate = DateTime.Now; TimeRecordBll.AddRecord(Model_TimeRecord); return Model_TimeRecord.Id; }
/// <summary> /// 刷新活动时间记录 /// </summary> /// <param name="ClassId"></param> /// <param name="TrainingId"></param> /// <param name="UnitContent"></param> /// <returns></returns> public ActionResult RefashTimeRecord(int ClassId, int TrainingId, int UnitContent, int RecordId) { int iUnitId = 0, iUnitType = 0, iAccountId = 0; double dblContentTimeLength = 0; var TimeRecordBll = new Member_ClassContentTimeRecordBLL(); var UnitContentBll = new Course_UnitContentBLL(); var Model_UnitContent = UnitContentBll.GetModel(UnitContent, string.Empty); if (Model_UnitContent == null) return View(); iAccountId = Code.SiteCache.Instance.LoginInfo.UserId; iUnitId = Model_UnitContent.UnitId == null ? 0 : Model_UnitContent.UnitId.Value; iUnitType = Model_UnitContent.UnitType; dblContentTimeLength = Model_UnitContent.TimeLength == null ? 0 : Model_UnitContent.TimeLength.Value; var Model_TimeRecord = TimeRecordBll.GetModel(RecordId, string.Empty); if (Model_TimeRecord != null) { Model_TimeRecord.EndTime = DateTime.Now; TimeRecordBll.Update(Model_TimeRecord); var startDateTime = Model_TimeRecord.StartTime.Value.AddMinutes(dblContentTimeLength); var dtCompare = DateTime.Compare(Model_TimeRecord.EndTime.Value, startDateTime); if (dtCompare >= 0)//若结束时间 >= 开始时间 + 活动限时,即完成该活动 { //更新活动进度 this.UpdateOverallProgress(iUnitId, ClassId, TrainingId, iAccountId, UnitContent); //若活动是阅读或者视频[1文本,2影音教材,3讨论,4作业,5测试,6结业考试] if (iUnitType == 1 || iUnitType == 2) { this.ScoreSet(1, UnitContent, ClassId, TrainingId);//设置分数 } } } return View(); }