123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.DataLogic.Common.AdministrativeOrgan
- {
- public class CollegeDAL
- {
- public CollegeRepository CollegeRepository { get; set; }
- public CollegeProfileRepository CollegeProfileRepository { get; set; }
- public CampusRepository CampusRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public StaffRepository StaffRepository { get; set; }
- /// <summary>
- /// 查询对应的院系所信息CollegeView
- /// </summary>
- /// <returns></returns>
- public IQueryable<CollegeView> GetCollegeViewQueryable()
- {
- var query = from col in CollegeRepository.Entities
- from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID).DefaultIfEmpty()
- join e in UserRepository.Entities
- on col.CF_CollegeProfile.PoliticalManager equals e.UserID
- into gpm
- from gPoliticalManager in gpm.DefaultIfEmpty()
- join f in UserRepository.Entities
- on col.CF_CollegeProfile.AdministrativeManager equals f.UserID
- into gam
- from gAdministrativeManager in gam.DefaultIfEmpty()
- select new CollegeView
- {
- CollegeID = col.CollegeID,
- No = col.No,
- Name = col.Name,
- SimpleName = col.SimpleName,
- EnglishName = col.EnglishName,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- PoliticalManager = col.CF_CollegeProfile.PoliticalManager,
- PoliticalManagerName = gPoliticalManager.Name,
- AdministrativeManager = col.CF_CollegeProfile.AdministrativeManager,
- AdministrativeManagerName = gAdministrativeManager.Name,
- UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
- CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
- CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
- RunByCategoryID = col.CF_CollegeProfile.RunByCategoryID,
- FoundDate = col.CF_CollegeProfile.FoundDate,
- 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;
- }
- /// <summary>
- /// 查询对应的院系所信息CollegeView
- /// </summary>
- /// <param name="expCollege"></param>
- /// <returns></returns>
- public IQueryable<CollegeView> GetCollegeViewQueryable(Expression<Func<CF_College, bool>> expCollege)
- {
- var query = from col in CollegeRepository.GetList(expCollege)
- from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID).DefaultIfEmpty()
- join e in UserRepository.Entities
- on col.CF_CollegeProfile.PoliticalManager equals e.UserID
- into gpm
- from gPoliticalManager in gpm.DefaultIfEmpty()
- join f in UserRepository.Entities
- on col.CF_CollegeProfile.AdministrativeManager equals f.UserID
- into gam
- from gAdministrativeManager in gam.DefaultIfEmpty()
- select new CollegeView
- {
- CollegeID = col.CollegeID,
- No = col.No,
- Name = col.Name,
- SimpleName = col.SimpleName,
- EnglishName = col.EnglishName,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- PoliticalManager = col.CF_CollegeProfile.PoliticalManager,
- PoliticalManagerName = gPoliticalManager.Name,
- AdministrativeManager = col.CF_CollegeProfile.AdministrativeManager,
- AdministrativeManagerName = gAdministrativeManager.Name,
- UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
- CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
- CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
- RunByCategoryID = col.CF_CollegeProfile.RunByCategoryID,
- FoundDate = col.CF_CollegeProfile.FoundDate,
- 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;
- }
- /// <summary>
- /// 查询对应的院系所信息CollegeView(只显示院、系、部类别的院系所)
- /// </summary>
- /// <param name="expCollege"></param>
- /// <returns></returns>
- public IQueryable<CollegeView> GetOnlyCollegeViewQueryable(Expression<Func<CF_College, bool>> expCollege)
- {
- var query = from col in CollegeRepository.GetList(expCollege)
- from cam in CampusRepository.Entities.Where(x => x.CampusID == col.CampusID).DefaultIfEmpty()
- where col.CF_CollegeProfile.UnitCategoryID == (int)CF_UnitCategory.College
- select new CollegeView
- {
- CollegeID = col.CollegeID,
- No = col.No,
- Name = col.Name,
- SimpleName = col.SimpleName,
- EnglishName = col.EnglishName,
- CampusID = col.CampusID,
- CampusNo = cam.No,
- CampusName = cam.Name,
- UnitCategoryID = col.CF_CollegeProfile.UnitCategoryID,
- CollegeTypeID = col.CF_CollegeProfile.CollegeTypeID,
- CollegeCategoryID = col.CF_CollegeProfile.CollegeCategoryID,
- RunByCategoryID = col.CF_CollegeProfile.RunByCategoryID,
- FoundDate = col.CF_CollegeProfile.FoundDate,
- 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;
-
- }
- }
- }
|