using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.ViewModel.UniversityManage.AdministrativeOrgan;
using EMIS.ViewModel.EducationManage;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EducationManage
{
public class EducationMissionOpenControlDAL
{
public EducationMissionOpenControlRepository EducationMissionOpenControlRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public CampusRepository CampusRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的教学任务控制信息View
///
///
///
public IQueryable GetEducationMissionOpenControlViewQueryable(Expression> exp)
{
var query = from ec in EducationMissionOpenControlRepository.GetList(exp)
join cus in UserRepository.Entities
on ec.CreateUserID equals cus.UserID into tempcus
from eccus in tempcus.DefaultIfEmpty()
select new EducationMissionOpenControlView
{
EducationMissionOpenControlID = ec.EducationMissionOpenControlID,
CollegeID = ec.CollegeID,
CollegeNo = ec.CF_College.No,
CollegeName = ec.CF_College.Name,
UnitCategoryID = ec.CF_College.CF_CollegeProfile.UnitCategoryID,
CampusID = ec.CF_College.CampusID,
CampusNo = ec.CF_College.CF_Campus.No,
CampusName = ec.CF_College.CF_Campus.Name,
SchoolyearID = ec.SchoolyearID,
SchoolyearCode = ec.CF_Schoolyear.Code,
Value = ec.CF_Schoolyear.Value,
StartDate = ec.StartDate,
EndDate = ec.EndDate,
RecordStatus = ec.RecordStatus,
CreateUserID = ec.CreateUserID,
CreateUserName = eccus.Name,
CreateTime = ec.CreateTime,
ModifyUserID = ec.ModifyUserID,
ModifyTime = ec.ModifyTime
};
return query;
}
///
/// 查询教学控制中未新增的院系所信息CollegeView
///
///
///
///
public IQueryable GetCollegeViewNoAddQueryable(Expression> expCollege, Expression> expEduOpenControl)
{
var query = from col in CollegeRepository.GetList(expCollege)
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join ec in EducationMissionOpenControlRepository.GetList(expEduOpenControl)
on col.CollegeID equals ec.CollegeID into tempec
from colec in tempec.DefaultIfEmpty()
where colec.EducationMissionOpenControlID == null
select new CollegeView
{
CollegeID = col.CollegeID,
No = col.No,
Name = col.Name,
SimpleName = col.SimpleName,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
Officephone = col.CF_CollegeProfile.Officephone,
Remark = col.Remark,
RecordStatus = col.RecordStatus,
CreateUserID = col.CreateUserID,
CreateTime = col.CreateTime,
ModifyUserID = col.ModifyUserID,
ModifyTime = col.ModifyTime
};
return query;
}
}
}