123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- 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; }
- /// <summary>
- /// 查询对应的专业分班信息View
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<SpecialtyClassSettingView> GetSpecialtyClassSettingViewQueryable(Expression<Func<CF_SpecialtyClassSetting, bool>> 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;
- }
- /// <summary>
- /// 查询专业分班中未新增的专业信息SpecialtyView
- /// </summary>
- /// <param name="expSpecialty"></param>
- /// <param name="expSpecialtyClassSetting"></param>
- /// <returns></returns>
- public IQueryable<SpecialtyView> GetSpecialtyViewNoAddQueryable(Expression<Func<CF_Specialty, bool>> expSpecialty, Expression<Func<CF_SpecialtyClassSetting, bool>> 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;
- }
- }
- }
|