using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EMIS.DataLogic.Repositories;
using EMIS.ViewModel.Specialtymanage;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.ViewModel;
namespace EMIS.DataLogic.Common.Specialtymanage
{
public class SpecialtyDAL
{
public SpecialtyRepository SpecialtyRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
///
/// 查询对应的专业信息View
///
///
///
public IQueryable GetSpecialtyViewQueryable(Expression> expSpecialty)
{
var query = from a in SpecialtyRepository.GetList(expSpecialty)
join b in DictionaryItemRepository.GetList(x => x.DictionaryCode == DictionaryItem.CF_Standard.ToString())
on a.StandardID equals b.Value into temp
from standard in temp.DefaultIfEmpty()
select new SpecialtyView
{
SpecialtyID = a.SpecialtyID,
StandardID = a.StandardID,
StandardCode = standard.Code,
StandardName = standard.Name,
EducationID = a.EducationID,
LearningformID = a.LearningformID,
LearnSystem = a.LearnSystem,
ScienceclassID = a.ScienceclassID,
PropertyID = a.PropertyID,
StandardTitle = a.StandardTitle,
StandardLevel = a.StandardLevel,
RecordStatus = a.RecordStatus,
Remark = a.Remark,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime,
ModifyUserID = a.ModifyUserID,
ModifyTime = a.ModifyTime,
};
return query;
}
///
/// 查询专业信息中学制信息(去重)
///
///
///
public IQueryable GetLearnSystemQueryable(Expression> exp)
{
var query = from a in SpecialtyRepository.GetList(exp)
select new SpecialtyView
{
LearnSystem = a.LearnSystem
};
return query.Distinct();
}
}
}