1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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.StudentManage.StudentChange;
- using EMIS.DataLogic.Repositories;
- namespace EMIS.DataLogic.StudentManage.StudentChange
- {
- public class ChangeTypeSettingDAL
- {
- public DifferentDynamicTypeInOutSettingRepository ChangeTypeInOutSettingRepository { get; set; }
- public DictionaryItemRepository DictionaryItemRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- /// <summary>
- /// 查询对应的异动类型设定信息View(对应的字典表信息左连设定表)
- /// </summary>
- /// <param name="expDictionaryItem"></param>
- /// <param name="expChangeTypeInOutSetting"></param>
- /// <returns></returns>
- public IQueryable<ChangeTypeSettingView> GetChangeTypeSettingViewQueryable(Expression<Func<Sys_DictionaryItem, bool>> expDictionaryItem,
- Expression<Func<CF_DifferentDynamicTypeInOutSetting, bool>> expChangeTypeInOutSetting)
- {
- var query = from dicit in DictionaryItemRepository.GetList(expDictionaryItem)
- join set in ChangeTypeInOutSettingRepository.GetList(expChangeTypeInOutSetting)
- on dicit.Value equals set.ChangeTypeID 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 ChangeTypeSettingView
- {
- ChangeTypeInOutSettingID = itset.ChangeTypeInOutSettingID == null ? Guid.Empty : itset.ChangeTypeInOutSettingID,
- ChangeTypeID = dicit.Value,
- ChangeTypeName = dicit.Name,
- IsIn = itset.IsIn == null ? false : itset.IsIn,
- IsOut = itset.IsOut == null ? false : itset.IsOut,
- 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<ChangeTypeSettingView> GetChangeTypeSettingViewQueryable(Expression<Func<CF_DifferentDynamicTypeInOutSetting, bool>> exp)
- {
- var query = from set in ChangeTypeInOutSettingRepository.GetList(exp)
- join dicit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(CF_ChangeType).Name)
- on set.ChangeTypeID 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 ChangeTypeSettingView
- {
- ChangeTypeInOutSettingID = set.ChangeTypeInOutSettingID,
- ChangeTypeID = dicit.Value,
- ChangeTypeName = dicit.Name,
- IsIn = set.IsIn == null ? false : set.IsIn,
- IsOut = set.IsOut == null ? false : set.IsOut,
- 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;
- }
- }
- }
|