123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.StudentManage.StudentStatistics;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- namespace EMIS.DataLogic.StudentManage.StudentStatistics
- {
- public class InSchoolSettingDAL
- {
- public InSchoolSettingRepository InSchoolSettingRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- /// <summary>
- /// 查询对应的在校状态设定信息View(对应的字典表信息左连设定表)
- /// </summary>
- /// <param name="expDictionaryItem"></param>
- /// <param name="expInSchoolSetting"></param>
- /// <returns></returns>
- public IQueryable<InSchoolSettingView> GetInSchoolSettingViewQueryable(Expression<Func<Sys_DictionaryItem, bool>> expDictionaryItem,
- Expression<Func<CF_InSchoolSetting, bool>> expInSchoolSetting)
- {
- var query = from dicit in DictionaryItemRepository.GetList(expDictionaryItem)
- join set in InSchoolSettingRepository.GetList(expInSchoolSetting)
- on dicit.Value equals set.InSchoolStatusID into tempit
- from itset in tempit.DefaultIfEmpty()
- join usc in UserRepository.Entities
- on itset.CreateUserID equals usc.UserID into tempusc
- from uscu in tempusc.DefaultIfEmpty()
- join usm in UserRepository.Entities
- on itset.ModifyUserID equals usm.UserID into tempusm
- from usmu in tempusm.DefaultIfEmpty()
- select new InSchoolSettingView
- {
- InSchoolSettingID = itset.InSchoolSettingID == null ? Guid.Empty : itset.InSchoolSettingID,
- InSchoolStatusID = dicit.Value,
- InSchoolStatusName = dicit.Name,
- IsSelected = itset.IsSelected == null ? false : itset.IsSelected,
- IsDisplay = dicit.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
- RecordStatus = itset.RecordStatus,
- CreateUserID = itset.CreateUserID,
- CreateUserName = uscu.Name,
- CreateTime = itset.CreateTime,
- ModifyUserID = itset.ModifyUserID,
- ModifyUserName = usmu.Name,
- ModifyTime = itset.ModifyTime
- };
- return query;
- }
- /// <summary>
- /// 查询对应的在校状态设定信息View(设定表与对应的字典表信息内联)
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<InSchoolSettingView> GetInSchoolSettingViewQueryable(Expression<Func<CF_InSchoolSetting, bool>> exp)
- {
- var query = from set in InSchoolSettingRepository.GetList(exp)
- join dicit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_InschoolStatus).Name)
- on set.InSchoolStatusID equals dicit.Value
- join usc in UserRepository.Entities
- on set.CreateUserID equals usc.UserID into tempusc
- from uscu in tempusc.DefaultIfEmpty()
- join usm in UserRepository.Entities
- on set.ModifyUserID equals usm.UserID into tempusm
- from usmu in tempusm.DefaultIfEmpty()
- select new InSchoolSettingView
- {
- InSchoolSettingID = set.InSchoolSettingID,
- InSchoolStatusID = dicit.Value,
- InSchoolStatusName = dicit.Name,
- IsSelected = set.IsSelected == null ? false : set.IsSelected,
- IsDisplay = dicit.RecordStatus > (int)SYS_STATUS.UNUSABLE ? true : false,
- RecordStatus = set.RecordStatus,
- CreateUserID = set.CreateUserID,
- CreateUserName = uscu.Name,
- CreateTime = set.CreateTime,
- ModifyUserID = set.ModifyUserID,
- ModifyUserName = usmu.Name,
- ModifyTime = set.ModifyTime
- };
- return query;
- }
- }
- }
|