using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.ScoreManage;
namespace EMIS.ExtensionLogic.DataLogic.GraduationManage
{
public class GraduationPreliminaryDAL : EMIS.DataLogic.GraduationManage.GraduationManage.GraduationPreliminaryDAL
{
///
/// 查询对应的毕业预审学生最终成绩信息StudentScoreView(根据相应的学生信息、毕业学期并且匹配执行计划)
/// 注:学生最终成绩以执行计划为准(左连),未修习成绩默认为0分
/// 注:匹配规则(以学生信息、课程信息为准,广中医个性化配置)
///
///
///
///
public override IQueryable GetGraPreStuFinScoreExecutablePlanViewQueryable(Expression> expStudent,
Expression> expSchoolyear)
{
var graPreStudentList = from gpstu in this.GetGraPreStudentQueryable(expStudent, expSchoolyear)
select gpstu;
var graPreStuFinScoreList = from finsco in FinallyScoreRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE)
join stu in graPreStudentList
on finsco.UserID equals stu.UserID
select new
{
FinallyScoreID = finsco.FinallyScoreID,
SchoolyearID = finsco.SchoolyearID,
UserID = finsco.UserID,
CoursematerialID = finsco.CoursematerialID,
CourseTypeID = finsco.CourseTypeID,
SchoolyearNumID = finsco.SchoolyearNumID,
StarttermID = finsco.StarttermID,
ResultTypeID = finsco.ResultTypeID,
CreateUserID = finsco.CreateUserID,
Credit = finsco.Credit,
TotalHours = finsco.TotalHours,
ExamsCategoryID = finsco.ExamsCategoryID,
ExamsStateID = finsco.ExamsStateID,
TotalScore = finsco.TotalScore,
ScoreCredit = finsco.ScoreCredit,
GradePoint = finsco.GradePoint,
CreateTime = finsco.CreateTime
};
var query = from stuep in this.GetGraPreStudentExecutablePlanViewQueryable(expStudent, expSchoolyear)
join finsco in graPreStuFinScoreList
on
new { UserID = stuep.UserID, CoursematerialID = stuep.CoursematerialID }
equals
new { UserID = finsco.UserID.Value, CoursematerialID = finsco.CoursematerialID }
into tempepfinsco
from epfinsco in tempepfinsco.DefaultIfEmpty()
select new StudentScoreView
{
SchoolyearID = stuep.SchoolyearID,
SchoolyearCode = stuep.SchoolyearCode,
UserID = stuep.UserID,
CoursematerialID = stuep.CoursematerialID,
CourseCode = stuep.CourseCode,
CourseName = stuep.CourseName,
CourseTypeID = stuep.CourseTypeID,
SchoolyearNumID = stuep.SchoolyearNumID,
StarttermID = stuep.StarttermID,
ResultTypeID = stuep.ResultTypeID,
Credit = stuep.Credit,
//TotalHours = stuep.Totalhours,(执行计划总学时类型不对,暂时不处理)
ExamsCategoryID = epfinsco.ExamsCategoryID,
ExamsStateID = epfinsco.ExamsStateID,
TotalScore = epfinsco.TotalScore ?? 0,
ScoreCredit = epfinsco.ScoreCredit ?? 0
};
return query;
}
}
}