/// <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); }
/// <summary> /// 我的年度培训目标 /// </summary> /// <param name="userid"></param> /// <param name="bentime"></param> /// <param name="endtime"></param> /// <param name="totalcount"></param> /// <param name="startIndex"></param> /// <param name="startLength"></param> /// <param name="Order"></param> /// <param name="where"></param> /// <returns></returns> public List <Co_CourseShow> GetMyCourse(int userid, int year, int way, out int totalcount, int startIndex = 0, int startLength = int.MaxValue, string Order = "asc", string where = "1=1") { var list = new List <Co_CourseShow>(); list = way == 1 ? _userDB.GetMyCourse(userid, year, startIndex, startLength, Order, where) : _userDB.GetMyVidioCourse(userid, year, startIndex, startLength, Order, where); totalcount = list.Count > 0 ? list[0].totalcount : 0; for (int i = 0; i < list.Count; i++) { if (list[i].CoPaperID > 0 && list[i].PaperId > 0) { tbExamSendStudent exam = new tbExamSendStudent(); if (list[i].Way == 2) { exam = _ExamDB.GetExamSendStudentBySQL2008(list[i].Id, userid, list[i].CoPaperID, list[i].PaperId, 2); } else { exam = _ExamDB.GetExamSendStudentBySQL2008(list[i].Id, userid, list[i].CoPaperID, list[i].PaperId, 1); } list[i].GetexamScore = exam == null?0:exam.StudentAnswerList.Sum(pa => pa.GetScore); tbExampaper paper = _paperDB.GetExampaper(list[i].PaperId); list[i].ExamScore = paper.ExampaperScore; } else { list[i].GetexamScore = 0; list[i].ExamScore = 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); }
/// <summary> /// 根据ID获取单个实体 /// </summary> /// <returns></returns> public tbExampaper GetExampaper(int id) { return(EDB.GetExampaper(id)); }