using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage.EvaluationResult;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EvaluationManage.EvaluationResult
{
public class EvaluationStaffScoreDAL
{
public EvaluationStaffScoreRepository EvaluationStaffScoreRepository { get; set; }
public EvaluationStaffScoreDetailRepository EvaluationStaffScoreDetailRepository { get; set; }
public EvaluationStudentScoreRepository EvaluationStudentScoreRepository { get; set; }
public EvaluationCollegeScoreRepository EvaluationCollegeScoreRepository { get; set; }
public SchoolyearRepository SchoolyearRepository { get; set; }
public StaffRepository StaffRepository { get; set; }
public CoursematerialRepository CoursematerialRepository { get; set; }
public DepartmentRepository DepartmentRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public CampusRepository CampusRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的教师评分信息EvaluationStaffScoreView
///
///
///
public IQueryable GetEvaluationStaffScoreViewQueryable(Expression> exp)
{
var query = from evsfsco in EvaluationStaffScoreRepository.GetList(exp)
join sy in SchoolyearRepository.Entities
on evsfsco.SchoolyearID equals sy.SchoolyearID
join sf in StaffRepository.Entities
on evsfsco.UserID equals sf.UserID
join cou in CoursematerialRepository.Entities
on evsfsco.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on evsfsco.DepartmentID equals dep.DepartmentID
join col in CollegeRepository.Entities
on dep.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join us in UserRepository.Entities
on sf.UserID equals us.UserID
from stusco in evsfsco.EM_EvaluationStaffScoreDetail.Where(x => x.EvaluationScoreTypeID == (int)EMIS.ViewModel.EM_EvaluationScoreType.StudentScore).DefaultIfEmpty()
from colsco in evsfsco.EM_EvaluationStaffScoreDetail.Where(x => x.EvaluationScoreTypeID == (int)EMIS.ViewModel.EM_EvaluationScoreType.CollegeScore).DefaultIfEmpty()
select new EvaluationStaffScoreView
{
EvaluationStaffScoreID = evsfsco.EvaluationStaffScoreID,
SchoolyearID = evsfsco.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
UserID = evsfsco.UserID,
StaffCode = us.LoginID,
StaffName = us.Name,
SexID = sf.SexID,
TeacherTypeID = sf.TeacherTypeID,
IncumbencyState = sf.IncumbencyState,
TitleID = sf.TitleID,
CoursematerialID = evsfsco.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
DepartmentID = evsfsco.DepartmentID,
DepartmentNo = dep.No,
DepartmentName = dep.Name,
CollegeID = dep.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
StudentScore = stusco.Score,
CollegeScore = colsco.Score,
TotalScore = evsfsco.TotalScore,
Remark = evsfsco.Remark,
RecordStatus = evsfsco.RecordStatus,
CreateUserID = evsfsco.CreateUserID,
CreateTime = evsfsco.CreateTime,
ModifyUserID = evsfsco.ModifyUserID,
ModifyTime = evsfsco.ModifyTime
};
return query;
}
}
}