1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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; }
- /// <summary>
- /// 查询院系控制信息CollegePriorityView(排课优先级、开始日期、结束日期等)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<CollegePriorityView> GetCollegePriorityViewQueryable(Expression<Func<ES_CollegePriority, bool>> 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;
- }
- /// <summary>
- /// 查询院系控制中未新增的院系所信息CollegeView
- /// </summary>
- /// <param name="expCollege"></param>
- /// <param name="expCollegePriority"></param>
- /// <returns></returns>
- public IQueryable<CollegeView> GetCollegeViewNoAddQueryable(Expression<Func<CF_College, bool>> expCollege, Expression<Func<ES_CollegePriority, bool>> 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;
- }
- }
- }
|