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 CampusDAL
{
public CampusRepository CampusRepository { get; set; }
public CampusProfileRepository CampusProfileRepository { get; set; }
public UserRepository UserRepository { get; set; }
///
/// 查询对应的校区信息View
///
///
///
public IQueryable GetCampusViewQueryable(Expression> expCampus)
{
var query = from a in CampusRepository.GetList(expCampus)
join c in UserRepository.Entities
on a.CF_CampusProfile.Generalsuper equals c.UserID
into gg
from gGeneralsuper in gg.DefaultIfEmpty()
join d in UserRepository.Entities
on a.CF_CampusProfile.Recruitstudents equals d.UserID
into gr
from gRecruitstudents in gr.DefaultIfEmpty()
join e in UserRepository.Entities
on a.CF_CampusProfile.Placesuper equals e.UserID
into gp
from gPlacesuper in gp.DefaultIfEmpty()
join f in UserRepository.Entities
on a.CF_CampusProfile.Teachingsuper equals f.UserID
into gt
from gTeachingsuper in gt.DefaultIfEmpty()
join g in UserRepository.Entities
on a.CF_CampusProfile.Studentcharge equals g.UserID
into gsc
from gStudentcharge in gsc.DefaultIfEmpty()
select new CampusView
{
CampusID = a.CampusID,
UniversityID = a.UniversityID,
No = a.No,
Name = a.Name,
SimpleName = a.SimpleName,
EnglishName = a.EnglishName,
UniversityCode = a.CF_University.Code,
UniversityName = a.CF_University.Name,
Generalsuper = a.CF_CampusProfile.Generalsuper,
GeneralsuperName = gGeneralsuper.Name,
Recruitstudents = a.CF_CampusProfile.Recruitstudents,
RecruitstudentsName = gRecruitstudents.Name,
Placesuper = a.CF_CampusProfile.Placesuper,
PlacesuperName = gPlacesuper.Name,
Teachingsuper = a.CF_CampusProfile.Teachingsuper,
TeachingsuperName = gTeachingsuper.Name,
Studentcharge = a.CF_CampusProfile.Studentcharge,
StudentchargeName = gStudentcharge.Name,
ZIPCode = a.CF_CampusProfile.ZIPCode,
Officephone = a.CF_CampusProfile.Officephone,
FAX = a.CF_CampusProfile.FAX,
Email = a.CF_CampusProfile.Email,
Evolution = a.CF_CampusProfile.Evolution,
Remark = a.Remark,
RecordStatus = a.RecordStatus,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime,
ModifyUserID = a.ModifyUserID,
ModifyTime = a.ModifyTime
};
return query;
}
}
}