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(); }
public List <View_HR_Train_PlanCollectUser> GetUserInfoAll(Guid planCourseID, int courseID) { ITrainBasicInfo service = ServerModuleFactory.GetServerModule <ITrainBasicInfo>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; List <string> lstUser = service.GetCourse_User(courseID); List <View_HR_Train_PlanCollectUser> lstResult = new List <View_HR_Train_PlanCollectUser>(); foreach (string workID in lstUser) { var varData = from a in ctx.View_HR_PersonnelArchive where a.员工编号 == workID select a; if (varData.Count() == 1) { View_HR_Train_PlanCollectUser temp = new View_HR_Train_PlanCollectUser(); temp.部门 = varData.Single().部门; temp.岗位 = varData.Single().岗位; temp.工号 = workID; temp.汇总ID = planCourseID; temp.员工姓名 = varData.Single().员工姓名; lstResult.Add(temp); } } return(lstResult); }
public List <Guid> GetRandomQuestion(int courseID) { DepotManagementDataContext ctx = CommentParameter.DepotDataContext; var varData = from a in ctx.HR_Train_QuestionBank where a.CourseID == courseID orderby Guid.NewGuid() select a.ID; ITrainBasicInfo serviceBasic = Service_Peripheral_HR.ServerModuleFactory.GetServerModule <ITrainBasicInfo>(); HR_Train_Course courseInfo = serviceBasic.GetSingleCourseTableInfo(courseID); if (courseInfo == null) { throw new Exception("获取数据出错"); } int percentValue = courseInfo.ExamExtractionRate == null ? 0 : (int)courseInfo.ExamExtractionRate; int rowCount = varData.Count() * percentValue / 100; return(varData.Take(rowCount).ToList()); }