using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Repositories;
using EMIS.Entities;
using Bowin.Common.Linq.Entity;
using EMIS.ViewModel;
using System.Linq.Expressions;
namespace EMIS.DataLogic.Common.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 a in UniversityRepository.GetList(expUniversity)
join us in UserRepository.Entities
on a.CF_UniversityProfile.PartyManageID equals us.UserID
into tempParty
from Party in tempParty.DefaultIfEmpty()
select new UniversityView
{
UniversityID = a.UniversityID,
Code = a.Code,
Name = a.Name,
SimpleName = a.SimpleName,
EnglishName = a.EnglishName,
ProvinceID = a.CF_UniversityProfile.ProvinceID,
CityID = a.CF_UniversityProfile.CityID,
DistrictID = a.CF_UniversityProfile.DistrictID,
PropertyID = a.CF_UniversityProfile.PropertyID,
SchoolTypeID = a.CF_UniversityProfile.SchoolTypeID,
ManagerID = a.CF_UniversityProfile.ManagerID,
FounderTypeID = a.CF_UniversityProfile.FounderTypeID,
SchoolLevelID = a.CF_UniversityProfile.SchoolLevelID,
HeadMasterName = a.CF_UniversityProfile.HeadMasterName,
PartyManageID = a.CF_UniversityProfile.PartyManageID,
PartyManageName = Party.Name,
LegalPersonName = a.CF_UniversityProfile.LegalPersonName,
BuildDate = a.CF_UniversityProfile.BuildDate,
AnniversaryDate = a.CF_UniversityProfile.AnniversaryDate,
SchoolBasis = a.CF_UniversityProfile.SchoolBasis,
SchoolMotto = a.CF_UniversityProfile.SchoolMotto,
SubjectCount = a.CF_UniversityProfile.SubjectCount,
Is211University = a.CF_UniversityProfile.Is211University ?? false,
IsKeyUniversity = a.CF_UniversityProfile.IsKeyUniversity ?? false,
IsAdultCollege = a.CF_UniversityProfile.IsAdultCollege ?? false,
IsPostCollege = a.CF_UniversityProfile.IsPostCollege ?? false,
IsNetCollege = a.CF_UniversityProfile.IsNetCollege ?? false,
Telephone = a.CF_UniversityProfile.Telephone,
ZIPCode = a.CF_UniversityProfile.ZIPCode,
Email = a.CF_UniversityProfile.Email,
FAX = a.CF_UniversityProfile.FAX,
PublicNum = a.CF_UniversityProfile.PublicNum,
HomePage = a.CF_UniversityProfile.HomePage,
Address = a.CF_UniversityProfile.Address,
EnglishAddress = a.CF_UniversityProfile.EnglishAddress,
HistoryEvolution = a.CF_UniversityProfile.HistoryEvolution,
Remark = a.Remark,
RecordStatus = a.RecordStatus,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime,
ModifyUserID = a.ModifyUserID,
ModifyTime = a.ModifyTime
};
return query;
}
}
}