123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.ViewModel.Students;
- using EMIS.ViewModel;
- namespace EMIS.ExtensionLogic.DataLogic.StudentSystem.MyGrade
- {
- public class CourseGradeDAL : EMIS.DataLogic.StudentSystem.MyGrade.CourseGradeDAL
- {
- public override IList<CourseGradeView> GetStudentCourseGrade(Guid UserID)
- {
- List<int?> examsStateList = examsStateSettingRepository.GetList(x => x.IsNormal == true).Select(x => x.ExamsStateID).ToList();
- var query = from fina in ScoreRepository.Entities
- join student in StudentRepository.Entities
- on fina.UserID equals student.UserID
- join courseColour in CourseTypeSelectCourseTypeRepository.Entities
- on fina.CourseTypeID equals courseColour.CourseTypeID
- into colour
- from cc in colour.DefaultIfEmpty()
- join isClub in ClubCourseRepository.Entities
- on fina.EM_Coursematerial.CoursematerialID equals isClub.CoursematerialID
- into club
- from clu in club.DefaultIfEmpty()
- join ed in DictionaryItemRepository.GetList(x => x.DictionaryCode == "CF_ExamsState")
- on fina.ExamsStateID equals ed.Value
- into ged
- from f in ged.DefaultIfEmpty()
- join d in DictionaryItemRepository.GetList(x => x.DictionaryCode == "CF_ResultType")
- on fina.ResultTypeID equals d.Value
- join rd in ResultTypeDetailRepository.GetList(x => true)
- on d.Value equals rd.ResultTypeID
- into ResultTypeDetail
- from Result in ResultTypeDetail.DefaultIfEmpty()
- where ((Result.ResultTypeDetailID != null &&
- (
- (fina.TotalScore <= Result.MaxScore && Result.MinScore <= fina.TotalScore && (Result.MaxScoreOperator == "<=" && Result.MinScoreOperator == "<="))
- || (fina.TotalScore <= Result.MaxScore && Result.MinScore < fina.TotalScore && (Result.MaxScoreOperator == "<=" && Result.MinScoreOperator == "<"))
- || (fina.TotalScore < Result.MaxScore && Result.MinScore < fina.TotalScore && (Result.MaxScoreOperator == "<" && Result.MinScoreOperator == "<"))
- || (fina.TotalScore < Result.MaxScore && Result.MinScore <= fina.TotalScore && (Result.MaxScoreOperator == "<" && Result.MinScoreOperator == "<="))
- )
- )
- || (Result.ResultTypeDetailID == null))
- && (fina.UserID == UserID)
- orderby new { fina.StarttermID, fina.CourseTypeID, fina.EM_Coursematerial.CourseName }
- select new CourseGradeView()
- {
- Club = clu.ClubCourseID,
- CourseTypeColour = cc.CourseTypeColour,
- UserID = fina.UserID,
- CourseName = fina.EM_Coursematerial.CourseName,
- TotalScore = fina.TotalScore,
- //暂时按此种逻辑处理。。后续优化(廖兵良)
- //已经优化--20180517李晓林
- TotalScoreStr = fina.TotalScore < 60 ? "重修":(examsStateList.Any(w => w.Value == fina.ExamsStateID) ? (Result.Name ?? ((double)Math.Round(fina.TotalScore.Value, 1)).ToString()) : f.Name),
- ScoreCredit = fina.ScoreCredit,
- CoursematerialID = fina.CoursematerialID,
- SchoolyearNumID = fina.SchoolyearNumID,
- SchoolyearID = fina.SchoolyearID,
- PlanningGraduateDate = student.PlanningGraduateDate,
- StarttermID = fina.StarttermID
- };
- return query.ToList();
- }
- /// <summary>
- /// 获取已提交成绩
- /// </summary>
- /// <param name="CoursematerialID"></param>
- /// <param name="SchoolyearID"></param>
- /// <param name="UserID"></param>
- public override IList<SubmitedScoreView> GetSubmitedScoreList(Guid? CoursematerialID, int? StartTermID, Guid? UserID)
- {
- int examsState = (int)CF_ExamsState.NormalExams;
- var query = from submited in SubmitedScoreRepository.Entities
- join coursetype in DictionaryItemRepository.Entities
- on new { CourseTypeID = submited.CourseTypeID, DictionaryCode = typeof(CF_CourseType).Name }
- equals new { CourseTypeID = coursetype.Value, coursetype.DictionaryCode }
- into courseTypedata
- from courseTypetb in courseTypedata.DefaultIfEmpty()
- join examscategory in DictionaryItemRepository.Entities
- on new { CourseTypeID = submited.ExamsCategoryID, DictionaryCode = typeof(CF_ExamsCategory).Name }
- equals new { CourseTypeID = examscategory.Value, examscategory.DictionaryCode }
- into examsCategorydata
- from examsCategorytb in examsCategorydata.DefaultIfEmpty()
- join examsstate in DictionaryItemRepository.Entities
- on new { CourseTypeID = submited.ExamsStateID, DictionaryCode = typeof(CF_ExamsState).Name }
- equals new { CourseTypeID = examsstate.Value, examsstate.DictionaryCode }
- into examsStatedata
- from examsStatetb in examsStatedata.DefaultIfEmpty()
- join opera in UserRepository.Entities on submited.CreatorUserID equals opera.UserID
- join d in DictionaryItemRepository.GetList(x => x.DictionaryCode == "CF_ResultType") on submited.ResultTypeID equals d.Value
- join rd in ResultTypeDetailRepository.GetList(x => true) on d.Value equals rd.ResultTypeID
- into ResultTypeDetail
- from Result in ResultTypeDetail.DefaultIfEmpty()
- where (
- (Result.ResultTypeDetailID != null &&
- (
- (submited.TotalScore <= Result.MaxScore && Result.MinScore <= submited.TotalScore && (Result.MaxScoreOperator == "<=" && Result.MinScoreOperator == "<="))
- || (submited.TotalScore <= Result.MaxScore && Result.MinScore < submited.TotalScore && (Result.MaxScoreOperator == "<=" && Result.MinScoreOperator == "<"))
- || (submited.TotalScore < Result.MaxScore && Result.MinScore < submited.TotalScore && (Result.MaxScoreOperator == "<" && Result.MinScoreOperator == "<"))
- || (submited.TotalScore < Result.MaxScore && Result.MinScore <= submited.TotalScore && (Result.MaxScoreOperator == "<" && Result.MinScoreOperator == "<="))
- )
- )
- || (Result.ResultTypeDetailID == null)
- )
- && submited.CoursematerialID == CoursematerialID && submited.StarttermID == StartTermID && submited.UserID == UserID
- select new SubmitedScoreView
- {
- SubmitedScoreID = submited.SubmitedScoreID,
- UserID = submited.UserID,
- LoginID = submited.CF_Student.Sys_User.LoginID,
- UserName = submited.CF_Student.Sys_User.Name,
- SchoolyearID = submited.SchoolyearID,
- SchoolyearCode = submited.CF_Schoolyear.Code,
- Schoolyear = submited.CF_Schoolyear.Years,
- CourseName = submited.EM_Coursematerial.CourseName,
- CourseCode = submited.EM_Coursematerial.CourseCode,
- TotalScore = submited.TotalScore,
- //暂时按此种逻辑处理。。后续优化(廖兵良)
- TotalScoreStr = submited.TotalScore < 60 ? "重修" : ((submited.ExamsStateID == examsState || submited.ExamsStateID == 10) ? (Result.Name ?? ((double)Math.Round(submited.TotalScore.Value, 1)).ToString()) : examsStatetb.Name),
- ScoreCredit = submited.ScoreCredit,
- CoursetypeName = courseTypetb.Name,
- CreateTime = submited.CreateTime,
- OperaUser = opera.Name,
- ExamsCategoryName = examsCategorytb.Name,
- ExamsStateName = examsStatetb.Name,
- CoursematerialID = submited.CoursematerialID,
- StarttermID = submited.StarttermID,
- Remarks = submited.Remark,
- StudentScoreRemark = submited.Remark,
- };
- return query.ToList();
- }
- }
- }
|