using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using EMIS.Entities;
using EMIS.ViewModel;
using EMIS.ViewModel.EnrollManage.SpecialtyManage;
using EMIS.DataLogic.Repositories;
namespace EMIS.DataLogic.EnrollManage.SpecialtyManage
{
public class SpecialtyClassSettingDAL
{
public SpecialtyClassSettingRepository SpecialtyClassSettingRepository { get; set; }
public SpecialtyRepository SpecialtyRepository { get; set; }
public DictionaryItemRepository DictionaryItemRepository { get; set; }
///
/// 查询对应的专业分班信息View
///
///
///
public IQueryable GetSpecialtyClassSettingViewQueryable(Expression> exp)
{
var query = from spcs in SpecialtyClassSettingRepository.GetList(exp)
join sp in SpecialtyRepository.Entities
on spcs.SpecialtyID equals sp.SpecialtyID
join dicst in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on sp.StandardID equals dicst.Value into tempst
from standard in tempst.DefaultIfEmpty()
select new SpecialtyClassSettingView
{
SpecialtyClassSettingID = spcs.SpecialtyClassSettingID,
SpecialtyID = spcs.SpecialtyID,
StandardID = sp.StandardID,
StandardCode = standard.Code,
StandardName = standard.Name,
EducationID = sp.EducationID,
LearningformID = sp.LearningformID,
LearnSystem = sp.LearnSystem,
ScienceclassID = sp.ScienceclassID,
PropertyID = sp.PropertyID,
StandardTitle = sp.StandardTitle,
StandardLevel = sp.StandardLevel,
PlanRecruitStudentCount = spcs.PlanRecruitStudentCount ?? 0,
ClassArrangeStudentCount = spcs.ClassArrangeStudentCount ?? 0,
ClassMaxStudentCount = spcs.ClassMaxStudentCount ?? 0,
ClassNumber = spcs.ClassNumber ?? 1,
RecordStatus = spcs.RecordStatus,
CreateUserID = spcs.CreateUserID,
CreateTime = spcs.CreateTime,
ModifyUserID = spcs.ModifyUserID,
ModifyTime = spcs.ModifyTime,
};
return query;
}
///
/// 查询专业分班中未新增的专业信息SpecialtyView
///
///
///
///
public IQueryable GetSpecialtyViewNoAddQueryable(Expression> expSpecialty, Expression> expSpecialtyClassSetting)
{
var query = from sp in SpecialtyRepository.GetList(expSpecialty)
join stdic in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_Standard).Name)
on sp.StandardID equals stdic.Value into tempstdic
from standard in tempstdic.DefaultIfEmpty()
join sc in SpecialtyClassSettingRepository.GetList(expSpecialtyClassSetting)
on sp.SpecialtyID equals sc.SpecialtyID into tempsc
from spcs in tempsc.DefaultIfEmpty()
where spcs.SpecialtyClassSettingID == null
select new SpecialtyView
{
SpecialtyID = sp.SpecialtyID,
StandardID = sp.StandardID,
StandardCode = standard.Code,
StandardName = standard.Name,
EducationID = sp.EducationID,
LearningformID = sp.LearningformID,
LearnSystem = sp.LearnSystem,
ScienceclassID = sp.ScienceclassID,
PropertyID = sp.PropertyID,
StandardTitle = sp.StandardTitle,
StandardLevel = sp.StandardLevel,
RecordStatus = sp.RecordStatus,
Remark = sp.Remark,
CreateUserID = sp.CreateUserID,
CreateTime = sp.CreateTime,
ModifyUserID = sp.ModifyUserID,
ModifyTime = sp.ModifyTime,
};
return query;
}
}
}