using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.ViewModel;
using EMIS.DataLogic.Repositories;
using EMIS.Entities;
using EMIS.ViewModel.EvaluationManage;
namespace EMIS.DataLogic.Common.EvaluationManage
{
public class EvaluationControlDAL
{
public EvaluationControlRepository evaluationControlRepository { get; set; }
public EvaluationSettingRepository EvaluationSettingRepository { get; set; }
public EvaluationEnterRepository EvaluationEnterRepository { get; set; }
public StudentRepository StudentRepository { get; set; }
public SchoolyearRepository schoolyearRepository { get; set; }
///
/// 读取评价控制信息
///
///
///
public IQueryable GetEvaluationControlQueryable(Expression> exp)
{
var query = from a in evaluationControlRepository.GetList(exp)
join b in schoolyearRepository.Entities on a.SchoolyearID equals b.SchoolyearID
select new EvaluationControlView
{
ControlID = a.EvaluationControlID,
SchoolyearID = a.SchoolyearID,
SchoolyearCode = b.Code,
IsResult = a.IsCourseScoreLock.Value,
Result = (a.IsCourseScoreLock.HasValue && a.IsCourseScoreLock == true) ? "是" : "否",
IsCourse = a.IsSelectCourseLock.Value,
Course = (a.IsSelectCourseLock.HasValue && a.IsSelectCourseLock == true) ? "是" : "否",
AllowNotEvaluationCount = a.NoNumber == null ? 0 : a.NoNumber,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime
};
return query;
}
///获取学生没评的课程教师信息
public IQueryable GetStudentNotEvaluationList(Expression> studentExp, Expression> evaluationSettingExp)
{
var query = (from es in EvaluationSettingRepository.GetList(evaluationSettingExp)
from ess in es.CF_Student
join s in StudentRepository.GetList(studentExp) on ess.UserID equals s.UserID
join ee in EvaluationEnterRepository.Entities
on new { es.EducationMissionClassID, StudentUserID = (Guid?)ess.UserID }
equals new { ee.EducationMissionClassID, ee.StudentUserID }
into dee
from eee in dee.DefaultIfEmpty()
where eee.EducationMissionClassID == null && es.OpenStatus == (int)CF_YesOrNoStatus.Yes
select es
);
return query;
}
}
}