public void RecordExamHistory(ref HR_Train_ExamHistory history) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; ITrainBasicInfo serviceBasic = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <ITrainBasicInfo>(); HR_Train_Course courseInfo = serviceBasic.GetSingleCourseTableInfo((int)history.CourseID); if (courseInfo == null) { throw new Exception("获取数据失败"); } if (courseInfo.ExamPassRate == null) { history.IsPass = true; } else { history.IsPass = history.ExamScore >= courseInfo.ExamPassRate; } history.ExamDate = ServerTime.Time; history.WorkID = BasicInfo.LoginID; ctx.HR_Train_ExamHistory.InsertOnSubmit(history); ctx.SubmitChanges(); }
void RecordExamInfo() { try { HR_Train_ExamHistory history = new HR_Train_ExamHistory(); history.CourseID = Convert.ToInt32(treeView1.SelectedNode.Tag); history.ExamScore = Math.Round(MarkingAnswer(), 2); _ServiceLearn.RecordExamHistory(ref history); MessageDialog.ShowPromptMessage("您的考试分数为【" + history.ExamScore.ToString() + "】," + ((bool)history.IsPass ? "【通过】" : "【未通过】")); plExam.Controls.Clear(); plExam.Controls.Add(this.btnBeginExam); } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }