using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using EMIS.Entities;
using EMIS.ViewModel.UniversityManage.AdministrativeOrgan;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.UniversityManage.AdministrativeOrgan
{
public class UniversityDAL
{
public UniversityRepository UniversityRepository { get; set; }
public UniversityProfileRepository UniversityProfileRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询学校信息View
///
///
public IQueryable GetUniversityViewQueryable(Expression> expUniversity)
{
var query = from uy in UniversityRepository.GetList(expUniversity)
join pf in UniversityProfileRepository.Entities
on uy.UniversityID equals pf.UniversityID into temppf
from uypf in temppf.DefaultIfEmpty()
join pmus in UserRepository.Entities
on uypf.PartyManageID equals pmus.UserID into temppm
from uypm in temppm.DefaultIfEmpty()
select new UniversityView
{
UniversityID = uy.UniversityID,
Code = uy.Code,
Name = uy.Name,
SimpleName = uy.SimpleName,
EnglishName = uy.EnglishName,
ProvinceID = uypf.ProvinceID,
CityID = uypf.CityID,
DistrictID = uypf.DistrictID,
PropertyID = uypf.PropertyID,
SchoolTypeID = uypf.SchoolTypeID,
ManagerID = uypf.ManagerID,
FounderTypeID = uypf.FounderTypeID,
SchoolLevelID = uypf.SchoolLevelID,
HeadMasterName = uypf.HeadMasterName,
PartyManageID = uypf.PartyManageID,
PartyManageName = uypm.Name,
LegalPersonName = uypf.LegalPersonName,
BuildDate = uypf.BuildDate,
AnniversaryDate = uypf.AnniversaryDate,
SchoolBasis = uypf.SchoolBasis,
SchoolMotto = uypf.SchoolMotto,
SubjectCount = uypf.SubjectCount,
Is211University = uypf.Is211University ?? false,
IsKeyUniversity = uypf.IsKeyUniversity ?? false,
IsAdultCollege = uypf.IsAdultCollege ?? false,
IsPostCollege = uypf.IsPostCollege ?? false,
IsNetCollege = uypf.IsNetCollege ?? false,
Telephone = uypf.Telephone,
ZIPCode = uypf.ZIPCode,
Email = uypf.Email,
FAX = uypf.FAX,
PublicNum = uypf.PublicNum,
HomePage = uypf.HomePage,
Address = uypf.Address,
EnglishAddress = uypf.EnglishAddress,
HistoryEvolution = uypf.HistoryEvolution,
Remark = uy.Remark,
RecordStatus = uy.RecordStatus,
CreateUserID = uy.CreateUserID,
CreateTime = uy.CreateTime,
ModifyUserID = uy.ModifyUserID,
ModifyTime = uy.ModifyTime
};
return query;
}
}
}