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.SchedulingManage;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.SchedulingManage.SchedulingSettings
{
public class CollegePriorityDAL
{
public CollegePriorityRepository CollegePriorityRepository { get; set; }
public CollegeRepository CollegeRepository { get; set; }
public CampusRepository CampusRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询院系控制信息CollegePriorityView(排课优先级、开始日期、结束日期等)
///
///
///
public IQueryable GetCollegePriorityViewQueryable(Expression> exp)
{
var query = from cp in CollegePriorityRepository.GetList(exp)
join col in CollegeRepository.Entities
on cp.CollegeID equals col.CollegeID
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cus in UserRepository.Entities
on cp.CreateUserID equals cus.UserID into tempcus
from cpcus in tempcus.DefaultIfEmpty()
select new CollegePriorityView
{
CollegePriorityID = cp.CollegePriorityID,
CollegeID = cp.CollegeID,
CollegeNo = col.No,
CollegeName = col.Name,
UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
CampusID = col.CampusID,
CampusNo = cam.No,
CampusName = cam.Name,
Priority = cp.Priority,
StartDate = cp.StartDate,
EndDate = cp.EndDate,
RecordStatus = cp.RecordStatus,
CreateUserID = cp.CreateUserID,
CreateUserName = cpcus.Name,
CreateTime = cp.CreateTime,
ModifyUserID = cp.ModifyUserID,
ModifyTime = cp.ModifyTime
};
return query;
}
///
/// 查询院系控制中未新增的院系所信息CollegeView
///
///
///
///
public IQueryable GetCollegeViewNoAddQueryable(Expression> expCollege, Expression> expCollegePriority)
{
var query = from col in CollegeRepository.GetList(expCollege)
join cam in CampusRepository.Entities
on col.CampusID equals cam.CampusID
join cp in CollegePriorityRepository.GetList(expCollegePriority)
on col.CollegeID equals cp.CollegeID into tempcp
from colcp in tempcp.DefaultIfEmpty()
where colcp.CollegePriorityID == 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;
}
}
}