/// <summary> /// 我的课程讲师端学员端列表(加入考试成绩) /// </summary> /// <param name="totalCount"></param> /// <param name="CourseId"></param> /// <param name="TeacherId"></param> /// <param name="startIndex"></param> /// <param name="pageLength"></param> /// <returns></returns> public List <Cl_CourseOrder> GetTeacherOnLineTest(out int totalCount, int CourseId, int TeacherId, int startIndex = 0, int pageLength = int.MaxValue) { //return _courseOrderDB.GetTeacherOnLineTest(out totalCount, CourseId, TeacherId, startIndex, pageLength); var list = _courseOrderDB.GetTeacherOnLineTest(out totalCount, CourseId, TeacherId, startIndex, pageLength); for (int i = 0; i < list.Count; i++) { tbExamSendStudent exam = _ExamDB.GetExamSendStudentBySQL2005(list[i].CourseId.Value, list[i].UserId, list[i].CoPaperID, list[i].PaperId); var exampaper = _paperDB.GetExampaper(list[i].PaperId); list[i].LevelScoreStr = Convert.ToInt32(list[i].LevelScore * 0.01 * (exampaper == null ? 0 : exampaper.ExampaperScore)); if (exam != null) { list[i].tbExamstudentId = exam._id; list[i].DoExamStatus = exam.DoExamStatus; //list[i].GetexamScore = (exam.StudentAnswerList.Sum(pa => pa.GetScore) / exampaper.ExampaperScore) * 100; list[i].GetexamScore = exam.StudentAnswerList.Sum(pa => pa.GetScore); list[i].ExamTestTimes = exam.TestTimes; //记录考试次数,考了几次 } else { list[i].GetexamScore = 0; list[i].tbExamstudentId = 0; } } return(list); }
public List <Co_CourseShow> GetMyExamList(out int totalCount, int UserId = 0, string TrainGrade = "", int DeptId = 0, string where = " 1 = 1 ", int startIndex = 0, int pageLength = int.MaxValue) { var list = attendceDb.GetMyExamList(out totalCount, UserId, TrainGrade, DeptId, where, startIndex, pageLength); //totalCount = list.Count > 0 ? list[0].totalcount : 0; for (int i = 0; i < list.Count; i++) { tbExamSendStudent exam = _ExamDB.GetExamSendStudentBySQL2005(list[i].Id, UserId, list[i].CoPaperID, list[i].PaperId); var exampaper = _paperDB.GetExampaper(list[i].PaperId); list[i].LevelScoreStr = Convert.ToInt32(list[i].LevelScore * 0.01 * (exampaper == null?0:exampaper.ExampaperScore)); list[i].ExampaperScore = exampaper == null ? 0 : exampaper.ExampaperScore; //var CoCoursePaper = ICoCoursePaperBL.GetCo_CourseMainPaper( //((double)examUser.StudentAnswerList.Sum(p => p.GetScore) / (double)exampaper.ExampaperScore) * 100 if (exam != null) { //var exampaper = _paperDB.GetExampaper(exam.ExamPaperID); //根据得分和试卷总分算出百分比 //double sum = 8 / 11; //list[i].GetexamScore = (exam.StudentAnswerList.Sum(pa => pa.GetScore) / exampaper.ExampaperScore) * 100; list[i].GetexamScore = exam.StudentAnswerList.Sum(pa => pa.GetScore); list[i].ExamTestTimes = exam.TestTimes; //记录考试次数,考了几次 //tbExampaper paper = _paperDB.GetExampaper(list[i].PaperId); //list[i].ExamScore = paper.ExampaperScore; } else { list[i].GetexamScore = 0; //list[i].ExamScore } } return(list); }