public void EnterExam(ExamMessage message) { ProjectThrough entity = new ProjectThrough(); //这些都需要加上非空判断 var examRecord = GetExamRecord(message.GUID); if (examRecord == null) { //需要依赖注入ILogger; return; } entity.ExamRecordId = examRecord.Id; entity.ExamItemItemCode = GetExamItem(message.ExamItem).ItemCode; entity.EnterTime = message.SendTime; entity.CreateTime = DateTime.Now; projectThroughRepository.AddEntity(entity); var parentCode = GetParentItemCode(message.ExamItem); if (parentCode > 0) { entity = GetProjectThroughs(examRecord.Id, (ExamItemEnum)parentCode); if (entity == null) { return; } entity.LeaveTime = message.SendTime; entity.ModifiedTime = DateTime.Now; //更新离开时间 projectThroughRepository.UpdateEntity(entity); } }
public void LeaveExam(ExamMessage message) { ProjectThrough entity = new ProjectThrough(); entity.ExamRecordId = GetExamRecord(message.GUID).Id; entity.ExamItemItemCode = GetExamItem(message.ExamItem).ItemCode; entity.LeaveTime = message.SendTime; entity.CreateTime = DateTime.Now; projectThroughRepository.AddEntity(entity); }