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