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 EvaluationStudentSettingScoreDAL
{
public EvaluationStudentSettingScoreRepository EvaluationStudentSettingScoreRepository { 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 EvaluationStudentRepository EvaluationStudentRepository { get; set; }
public EvaluationStudentScoreRepository EvaluationStudentScoreRepository { get; set; }
///
/// 查询对应的学评评分信息EvaluationStudentSettingScoreView
///
///
///
public IQueryable GetEvaluationStudentSettingScoreViewQueryable(Expression> exp)
{
var query = from evstustsco in EvaluationStudentSettingScoreRepository.GetList(exp)
join evstust in EvaluationStudentSettingRepository.Entities
on evstustsco.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 dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join col in CollegeRepository.Entities
on edu.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
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 us in UserRepository.Entities
on sf.UserID equals us.UserID
select new EvaluationStudentSettingScoreView
{
EvaluationStudentSettingScoreID = evstustsco.EvaluationStudentSettingScoreID,
EvaluationStudentSettingID = evstustsco.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CollegeID = edu.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.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,
UserID = evstust.UserID,
StaffCode = us.LoginID,
StaffName = us.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
ParticipateCount = evstust.CF_Student.Count(),
NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
OpenState = evstust.OpenState.Value,
TotalScore = evstustsco.TotalScore,
Remark = evstustsco.Remark,
RecordStatus = evstustsco.RecordStatus,
CreateUserID = evstustsco.CreateUserID,
CreateTime = evstustsco.CreateTime,
ModifyUserID = evstustsco.ModifyUserID,
ModifyTime = evstustsco.ModifyTime
};
return query;
}
///
/// 查询对应的学评评分信息EvaluationStudentSettingScoreView
///
///
///
///
public IQueryable GetEvaluationStudentSettingScoreViewQueryable(Expression> expEvaluationStudentSettingScore, Expression> expEvaluationStudentSetting)
{
var query = from evstustsco in EvaluationStudentSettingScoreRepository.GetList(expEvaluationStudentSettingScore)
join evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
on evstustsco.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 dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join col in CollegeRepository.Entities
on edu.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
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 us in UserRepository.Entities
on sf.UserID equals us.UserID
select new EvaluationStudentSettingScoreView
{
EvaluationStudentSettingScoreID = evstustsco.EvaluationStudentSettingScoreID,
EvaluationStudentSettingID = evstustsco.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CollegeID = edu.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.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,
UserID = evstust.UserID,
StaffCode = us.LoginID,
StaffName = us.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
ParticipateCount = evstust.CF_Student.Count(),
NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
OpenState = evstust.OpenState.Value,
TotalScore = evstustsco.TotalScore,
Remark = evstustsco.Remark,
RecordStatus = evstustsco.RecordStatus,
CreateUserID = evstustsco.CreateUserID,
CreateTime = evstustsco.CreateTime,
ModifyUserID = evstustsco.ModifyUserID,
ModifyTime = evstustsco.ModifyTime
};
return query;
}
///
/// 查询对应的学评评分信息EvaluationStudentSettingScoreView
///
///
///
///
public IQueryable GetEvaluationStudentSettingScoreViewQueryable(Expression> expEvaluationStudentSettingScore, Expression> expEducationMission)
{
var query = from evstustsco in EvaluationStudentSettingScoreRepository.GetList(expEvaluationStudentSettingScore)
join evstust in EvaluationStudentSettingRepository.Entities
on evstustsco.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 dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join col in CollegeRepository.Entities
on edu.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
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 us in UserRepository.Entities
on sf.UserID equals us.UserID
select new EvaluationStudentSettingScoreView
{
EvaluationStudentSettingScoreID = evstustsco.EvaluationStudentSettingScoreID,
EvaluationStudentSettingID = evstustsco.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CollegeID = edu.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.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,
UserID = evstust.UserID,
StaffCode = us.LoginID,
StaffName = us.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
ParticipateCount = evstust.CF_Student.Count(),
NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
OpenState = evstust.OpenState.Value,
TotalScore = evstustsco.TotalScore,
Remark = evstustsco.Remark,
RecordStatus = evstustsco.RecordStatus,
CreateUserID = evstustsco.CreateUserID,
CreateTime = evstustsco.CreateTime,
ModifyUserID = evstustsco.ModifyUserID,
ModifyTime = evstustsco.ModifyTime
};
return query;
}
///
/// 查询对应的学评评分信息EvaluationStudentSettingScoreView
///
///
///
///
///
public IQueryable GetEvaluationStudentSettingScoreViewQueryable(Expression> expEvaluationStudentSetting, Expression> expEducationMission, Expression> expEducationMissionClass)
{
var query = from evstustsco in EvaluationStudentSettingScoreRepository.Entities
join evstust in EvaluationStudentSettingRepository.GetList(expEvaluationStudentSetting)
on evstustsco.EvaluationStudentSettingID equals evstust.EvaluationStudentSettingID
join educl in EducationMissionClassRepository.GetList(expEducationMissionClass)
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 dep in DepartmentRepository.Entities
on edu.DepartmentID equals dep.DepartmentID
join col in CollegeRepository.Entities
on edu.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cou in CoursematerialRepository.Entities
on educl.CoursematerialID equals cou.CoursematerialID
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 us in UserRepository.Entities
on sf.UserID equals us.UserID
select new EvaluationStudentSettingScoreView
{
EvaluationStudentSettingScoreID = evstustsco.EvaluationStudentSettingScoreID,
EvaluationStudentSettingID = evstustsco.EvaluationStudentSettingID,
EducationMissionClassID = evstust.EducationMissionClassID,
EducationMissionID = educl.EducationMissionID,
SchoolyearID = edu.SchoolyearID,
SchoolyearValue = sy.Value,
SchoolyearCode = sy.Code,
MissionName = edu.ClassName,
MissionClassName = educl.Name,
CollegeID = edu.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.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,
UserID = evstust.UserID,
StaffCode = us.LoginID,
StaffName = us.Name,
TitleID = sf.TitleID,
TeachingMethodID = evstust.TeachingMethodID,
ParticipateCount = evstust.CF_Student.Count(),
NoParticipateCount = evstust.CF_Student.Count() - evstust.EM_EvaluationStudent.Count(),
ValidityParticipateCount = evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count(),
ValidityParticipateRate = evstust.CF_Student.Count() == 0 ? 0 : Math.Round((decimal)((decimal?)evstust.EM_EvaluationStudent.Where(x => x.IsValidity == true).Count() * (decimal?)1.00 / (decimal?)evstust.CF_Student.Count() * (decimal?)100.0), 1),
OpenState = evstust.OpenState.Value,
TotalScore = evstustsco.TotalScore,
Remark = evstustsco.Remark,
RecordStatus = evstustsco.RecordStatus,
CreateUserID = evstustsco.CreateUserID,
CreateTime = evstustsco.CreateTime,
ModifyUserID = evstustsco.ModifyUserID,
ModifyTime = evstustsco.ModifyTime
};
return query;
}
}
}