using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage.StudentEvaluation;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EvaluationManage.StudentEvaluation
{
public class EvaluationStudentDAL
{
public EvaluationStudentRepository EvaluationStudentRepository { get; set; }
public StudentRepository StudentRepository { get; set; }
public ClassmajorRepository ClassmajorRepository { get; set; }
public GrademajorRepository GrademajorRepository { get; set; }
public FacultymajorRepository FacultymajorRepository { get; set; }
public EvaluationStudentSettingRepository EvaluationStudentSettingRepository { get; set; }
public EducationMissionRepository EducationMissionRepository { get; set; }
public EducationMissionClassRepository EducationMissionClassRepository { get; set; }
public SchoolyearRepository SchoolyearRepository { get; set; }
public DepartmentRepository DepartmentRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public CampusRepository CampusRepository { get; set; }
public CoursematerialRepository CoursematerialRepository { get; set; }
public EvaluationTableRepository EvaluationTableRepository { get; set; }
public EvaluationParticipateTypeRepository EvaluationParticipateTypeRepository { get; set; }
public EvaluationIntTypeRepository EvaluationIntTypeRepository { get; set; }
public StaffRepository StaffRepository { get; set; }
public UserRepository UserRepository { get; set; }
public EvaluationStudentSettingScoreRepository EvaluationStudentSettingScoreRepository { get; set; }
public EvaluationStudentDetailRepository EvaluationStudentDetailRepository { get; set; }
public EvaluationTargetRepository EvaluationTargetRepository { get; set; }
public EvaluationProjectRepository EvaluationProjectRepository { get; set; }
public EvaluationStudentScoreRepository EvaluationStudentScoreRepository { get; set; }
///
/// 查询对应的学评学生信息EvaluationStudentView
///
///
///
public IQueryable GetEvaluationStudentViewQueryable(Expression> exp)
{
var query = from evstu in EvaluationStudentRepository.GetList(exp)
join evstust in EvaluationStudentSettingRepository.Entities
on evstu.EvaluationStudentSettingID equals evstust.EvaluationStudentSettingID
join educl in EducationMissionClassRepository.Entities
on evstust.EducationMissionClassID equals educl.EducationMissionClassID
join edu in EducationMissionRepository.Entities
on educl.EducationMissionID equals edu.EducationMissionID
join sy in SchoolyearRepository.Entities
on edu.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join evtb in EvaluationTableRepository.Entities
on evstust.EvaluationTableID equals evtb.EvaluationTableID
join evpt in EvaluationParticipateTypeRepository.Entities
on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
join evtp in EvaluationIntTypeRepository.Entities
on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
join sf in StaffRepository.Entities
on evstust.UserID equals sf.UserID
join stu in StudentRepository.Entities
on evstu.UserID equals stu.UserID
join cl in ClassmajorRepository.Entities
on stu.ClassmajorID equals cl.ClassmajorID
join gr in GrademajorRepository.Entities
on cl.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join sfus in UserRepository.Entities
on sf.UserID equals sfus.UserID
join stuus in UserRepository.Entities
on stu.UserID equals stuus.UserID
select new EvaluationStudentView
{
EvaluationStudentID = evstu.EvaluationStudentID,
UserID = evstu.UserID,
StudentNo = stuus.LoginID,
Name = stuus.Name,
SexID = stu.SexID,
BirthDate = stu.BirthDate,
NationID = stu.NationID,
PoliticsID = stu.PoliticsID,
InSchoolStatusID = stu.InSchoolStatusID,
StudentStatus = stu.StudentStatus,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
ClassmajorID = stu.ClassmajorID,
ClassmajorNo = cl.No,
ClassmajorName = cl.Name,
ClassNum = cl.ClassNum,
GradeID = gr.GradeID,
GrademajorID = cl.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
EvaluationStudentSettingID = evstu.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CoursematerialID = educl.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = educl.CourseStructureID,
CourseCategoryID = educl.CourseCategoryID,
CourseTypeID = educl.CourseTypeID,
CourseQualityID = educl.CourseQualityID,
Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
DepartmentID = edu.DepartmentID,
DepartmentNo = dep.No,
DepartmentName = dep.Name,
HandleModeID = educl.HandleModeID,
TeachingModeID = educl.TeachingModeID,
MissionClassStatus = educl.RecordStatus,
EvaluationTableID = evstust.EvaluationTableID,
EvaluationTableCode = evtb.Code,
EvaluationTableName = evtb.Name,
EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
ParticipateTypeID = evpt.ParticipateTypeID,
EvaluationTypeID = evtb.EvaluationIntTypeID,
EvaluationTypeCode = evtp.Code,
EvaluationTypeName = evtp.Name,
StaffUserID = evstust.UserID,
StaffCode = sfus.LoginID,
StaffName = sfus.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
OpenState = evstust.OpenState.Value,
Number = evpt.Number ?? 0,
Numbered = evstu.Numbered ?? 0,
IsValidity = evstu.IsValidity.Value,
TotalScore = evstu.TotalScore,
Advice = evstu.Advice,
Remark = evstu.Remark,
RecordStatus = evstu.RecordStatus,
CreateUserID = evstu.CreateUserID,
CreateTime = evstu.CreateTime,
ModifyUserID = evstu.ModifyUserID,
ModifyTime = evstu.ModifyTime
};
return query;
}
///
/// 查询对应的学评学生信息EvaluationStudentView(统计对应的学评项目数)
///
///
///
///
///
public IQueryable GetEvaluationStudentViewQueryable(Expression> expEvaluationStudent,
Expression> expEducationMission, Expression> expStudent)
{
var query = from evstu in EvaluationStudentRepository.GetList(expEvaluationStudent)
join evstust in EvaluationStudentSettingRepository.Entities
on evstu.EvaluationStudentSettingID equals evstust.EvaluationStudentSettingID
join educl in EducationMissionClassRepository.Entities
on evstust.EducationMissionClassID equals educl.EducationMissionClassID
join edu in EducationMissionRepository.GetList(expEducationMission)
on educl.EducationMissionID equals edu.EducationMissionID
join sy in SchoolyearRepository.Entities
on edu.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join evtb in EvaluationTableRepository.Entities
on evstust.EvaluationTableID equals evtb.EvaluationTableID
join evpt in EvaluationParticipateTypeRepository.Entities
on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
join evtp in EvaluationIntTypeRepository.Entities
on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
join sf in StaffRepository.Entities
on evstust.UserID equals sf.UserID
join stu in StudentRepository.GetList(expStudent)
on evstu.UserID equals stu.UserID
join cl in ClassmajorRepository.Entities
on stu.ClassmajorID equals cl.ClassmajorID
join gr in GrademajorRepository.Entities
on cl.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join sfus in UserRepository.Entities
on sf.UserID equals sfus.UserID
join stuus in UserRepository.Entities
on stu.UserID equals stuus.UserID
select new EvaluationStudentView
{
EvaluationStudentID = evstu.EvaluationStudentID,
UserID = evstu.UserID,
StudentNo = stuus.LoginID,
Name = stuus.Name,
SexID = stu.SexID,
BirthDate = stu.BirthDate,
NationID = stu.NationID,
PoliticsID = stu.PoliticsID,
InSchoolStatusID = stu.InSchoolStatusID,
StudentStatus = stu.StudentStatus,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
ClassmajorID = stu.ClassmajorID,
ClassmajorNo = cl.No,
ClassmajorName = cl.Name,
ClassNum = cl.ClassNum,
GradeID = gr.GradeID,
GrademajorID = cl.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
EvaluationStudentSettingID = evstu.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CoursematerialID = educl.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = educl.CourseStructureID,
CourseCategoryID = educl.CourseCategoryID,
CourseTypeID = educl.CourseTypeID,
CourseQualityID = educl.CourseQualityID,
Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
DepartmentID = edu.DepartmentID,
DepartmentNo = dep.No,
DepartmentName = dep.Name,
HandleModeID = educl.HandleModeID,
TeachingModeID = educl.TeachingModeID,
MissionClassStatus = educl.RecordStatus,
EvaluationTableID = evstust.EvaluationTableID,
EvaluationTableCode = evtb.Code,
EvaluationTableName = evtb.Name,
EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
ParticipateTypeID = evpt.ParticipateTypeID,
EvaluationTypeID = evtb.EvaluationIntTypeID,
EvaluationTypeCode = evtp.Code,
EvaluationTypeName = evtp.Name,
StaffUserID = evstust.UserID,
StaffCode = sfus.LoginID,
StaffName = sfus.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
OpenState = evstust.OpenState.Value,
Number = evpt.Number ?? 0,
Numbered = evstu.Numbered ?? 0,
IsValidity = evstu.IsValidity.Value,
ProjectCount = evstu.EM_EvaluationStudentDetail.Count(),
TotalScore = evstu.TotalScore,
Advice = evstu.Advice,
Remark = evstu.Remark,
RecordStatus = evstu.RecordStatus,
CreateUserID = evstu.CreateUserID,
CreateTime = evstu.CreateTime,
ModifyUserID = evstu.ModifyUserID,
ModifyTime = evstu.ModifyTime
};
return query;
}
///
/// 查询对应的学生评价信息EvaluationStudentView
///
///
///
///
public IQueryable GetStudentEvaluationEnterViewQueryable(Expression> expStudent, Expression> expEvaluationStudentSetting)
{
var query = from evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
from stu in evstust.CF_Student.AsQueryable().Where(expStudent)
join educl in EducationMissionClassRepository.Entities
on evstust.EducationMissionClassID equals educl.EducationMissionClassID
join edu in EducationMissionRepository.Entities
on educl.EducationMissionID equals edu.EducationMissionID
join sy in SchoolyearRepository.Entities
on edu.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
from dep in DepartmentRepository.Entities.Where(x => x.DepartmentID == edu.DepartmentID)
join evtb in EvaluationTableRepository.Entities
on evstust.EvaluationTableID equals evtb.EvaluationTableID
join evpt in EvaluationParticipateTypeRepository.Entities
on evtb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
join evtp in EvaluationIntTypeRepository.Entities
on evtb.EvaluationIntTypeID equals evtp.EvaluationIntTypeID
join sf in StaffRepository.Entities
on evstust.UserID equals sf.UserID
from cl in ClassmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID)
from gr in GrademajorRepository.Entities.Where(x => x.GrademajorID == cl.GrademajorID)
from fa in FacultymajorRepository.Entities.Where(x => x.FacultymajorID == gr.FacultymajorID)
from col in CollegeRepository.Entities.Where(x => x.CollegeID == fa.CollegeID)
from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID)
from sfus in UserRepository.Entities.Where(x => x.UserID == sf.UserID)
from evstu in evstust.EM_EvaluationStudent.Where(x => x.UserID == stu.UserID).DefaultIfEmpty()
select new EvaluationStudentView
{
EvaluationStudentID = evstu.EvaluationStudentID == null ? Guid.Empty : evstu.EvaluationStudentID,
EvaluationStudentSettingID = evstust.EvaluationStudentSettingID,
UserID = stu.UserID,
SexID = stu.SexID,
InSchoolStatusID = stu.InSchoolStatusID,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
ClassmajorID = stu.ClassmajorID,
GradeID = gr.GradeID,
GrademajorID = cl.GrademajorID,
FacultymajorID = gr.FacultymajorID,
CollegeID = fa.CollegeID,
CampusID = col.CampusID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CoursematerialID = educl.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = educl.CourseStructureID,
CourseCategoryID = educl.CourseCategoryID,
CourseTypeID = educl.CourseTypeID,
CourseQualityID = educl.CourseQualityID,
Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
DepartmentID = edu.DepartmentID,
DepartmentNo = dep.No,
DepartmentName = dep.Name,
HandleModeID = educl.HandleModeID,
TeachingModeID = educl.TeachingModeID,
MissionClassStatus = educl.RecordStatus,
EvaluationTableID = evstust.EvaluationTableID,
EvaluationTableCode = evtb.Code,
EvaluationTableName = evtb.Name,
EvaluationTableWeight = evtb.Weight,
EvaluationParticipateTypeID = evtb.EvaluationParticipateTypeID,
ParticipateTypeID = evpt.ParticipateTypeID,
EvaluationTypeID = evtb.EvaluationIntTypeID,
EvaluationTypeCode = evtp.Code,
EvaluationTypeName = evtp.Name,
StaffUserID = evstust.UserID,
StaffCode = sfus.LoginID,
StaffName = sfus.Name,
TitleID = sf.TitleID,
StaffPhotoUrl = sf.PhotoUrl,
TeachingMethodID = evstust.TeachingMethodID,
OpenState = evstust.OpenState.Value,
Number = evpt.Number ?? 0,
StartTime = evpt.StartTime,
EndTime = evpt.EndTime,
Numbered = evstu.EvaluationStudentID == null ? 0 : evstu.Numbered ?? 0,
TotalScore = evstu.EvaluationStudentID == null ? 0 : evstu.TotalScore ?? 0,
Advice = evstu.EvaluationStudentID == null ? null : evstu.Advice
};
return query;
}
///
/// 查询对应的学评学生评分明细信息EvaluationStudentDetailView
///
///
///
public IQueryable GetEvaluationStudentDetailViewQueryable(Expression> exp)
{
var query = from evstudl in EvaluationStudentDetailRepository.GetList(exp)
join evstu in EvaluationStudentRepository.Entities
on evstudl.EvaluationStudentID equals evstu.EvaluationStudentID
join evstudlpr in EvaluationProjectRepository.Entities
on evstudl.EvaluationProjectID equals evstudlpr.EvaluationProjectID
join evstudltg in EvaluationTargetRepository.Entities
on evstudlpr.EvaluationTargetID equals evstudltg.EvaluationTargetID
join evstudltb in EvaluationTableRepository.Entities
on evstudltg.EvaluationTableID equals evstudltb.EvaluationTableID
join evpt in EvaluationParticipateTypeRepository.Entities
on evstudltb.EvaluationParticipateTypeID equals evpt.EvaluationParticipateTypeID
join evstudltp in EvaluationIntTypeRepository.Entities
on evstudltb.EvaluationIntTypeID equals evstudltp.EvaluationIntTypeID
join stu in StudentRepository.Entities
on evstu.UserID equals stu.UserID
join evstust in EvaluationStudentSettingRepository.Entities
on evstu.EvaluationStudentSettingID equals evstust.EvaluationStudentSettingID
join educl in EducationMissionClassRepository.Entities
on evstust.EducationMissionClassID equals educl.EducationMissionClassID
join edu in EducationMissionRepository.Entities
on educl.EducationMissionID equals edu.EducationMissionID
join sy in SchoolyearRepository.Entities
on edu.SchoolyearID equals sy.SchoolyearID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
join dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join sf in StaffRepository.Entities
on evstust.UserID equals sf.UserID
join cl in ClassmajorRepository.Entities
on stu.ClassmajorID equals cl.ClassmajorID
join gr in GrademajorRepository.Entities
on cl.GrademajorID equals gr.GrademajorID
join fa in FacultymajorRepository.Entities
on gr.FacultymajorID equals fa.FacultymajorID
join col in CollegeRepository.Entities
on fa.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join sfus in UserRepository.Entities
on sf.UserID equals sfus.UserID
join stuus in UserRepository.Entities
on stu.UserID equals stuus.UserID
select new EvaluationStudentDetailView
{
EvaluationStudentDetailID = evstudl.EvaluationStudentDetailID,
EvaluationStudentID = evstudl.EvaluationStudentID,
UserID = evstu.UserID,
StudentNo = stuus.LoginID,
Name = stuus.Name,
SexID = stu.SexID,
BirthDate = stu.BirthDate,
NationID = stu.NationID,
PoliticsID = stu.PoliticsID,
InSchoolStatusID = stu.InSchoolStatusID,
StudentStatus = stu.StudentStatus,
StandardID = fa.StandardID,
EducationID = fa.EducationID,
LearningformID = fa.LearningformID,
LearnSystem = fa.LearnSystem,
ClassmajorID = stu.ClassmajorID,
ClassmajorNo = cl.No,
ClassmajorName = cl.Name,
ClassNum = cl.ClassNum,
GradeID = gr.GradeID,
GrademajorID = cl.GrademajorID,
GrademajorCode = gr.Code,
GrademajorName = gr.Name,
FacultymajorID = gr.FacultymajorID,
FacultymajorCode = fa.Code,
FacultymajorName = fa.Name,
CollegeID = fa.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
EvaluationStudentSettingID = evstu.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CoursematerialID = educl.CoursematerialID,
CourseCode = cou.CourseCode,
CourseName = cou.CourseName,
CourseStructureID = educl.CourseStructureID,
CourseCategoryID = educl.CourseCategoryID,
CourseTypeID = educl.CourseTypeID,
CourseQualityID = educl.CourseQualityID,
Credit = educl.EM_EducationMissionClassTeachingSetting.Credit ?? 0,
DepartmentID = edu.DepartmentID,
DepartmentNo = dep.No,
DepartmentName = dep.Name,
HandleModeID = educl.HandleModeID,
TeachingModeID = educl.TeachingModeID,
MissionClassStatus = educl.RecordStatus,
StaffUserID = evstust.UserID,
StaffCode = sfus.LoginID,
StaffName = sfus.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
EvaluationProjectID = evstudl.EvaluationProjectID,
EvaluationProjectOrderNo = evstudlpr.OrderNo,
EvaluationProjectCode = evstudlpr.Code,
EvaluationProjectName = evstudlpr.Name,
EvaluationTargetID = evstudlpr.EvaluationTargetID,
EvaluationTargetOrderNo = evstudltg.OrderNo,
EvaluationTargetCode = evstudltg.Code,
EvaluationTargetName = evstudltg.Name,
EvaluationTableID = evstudltg.EvaluationTableID,
EvaluationTableCode = evstudltb.Code,
EvaluationTableName = evstudltb.Name,
EvaluationParticipateTypeID = evstudltb.EvaluationParticipateTypeID,
ParticipateTypeID = evpt.ParticipateTypeID,
EvaluationTypeID = evstudltb.EvaluationIntTypeID,
EvaluationTypeCode = evstudltp.Code,
EvaluationTypeName = evstudltp.Name,
Score = evstudl.Score,
Remark = evstudl.Remark,
RecordStatus = evstudl.RecordStatus,
CreateUserID = evstudl.CreateUserID,
CreateTime = evstudl.CreateTime,
ModifyUserID = evstudl.ModifyUserID,
ModifyTime = evstudl.ModifyTime
};
return query;
}
}
}