using System; using System.Collections.Generic; using System.Linq; using System.Data.Entity; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.Entities; using System.Linq.Expressions; using EMIS.ViewModel; namespace EMIS.DataLogic.SystemSetting { public class ControlItemDAL { public ControlItemRepository ControlItemRepository { get; set; } public ControlItemDetailRepository ControlItemDetailRepository { get; set; } public DictionaryItemRepository DictionaryItemRepository { get; set; } public IQueryable GetControlItemList(Expression> exp) { var query = (from ci in ControlItemRepository.GetList(exp) join dcit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_ControlItemType).Name) on ci.ControlItemTypeID equals dcit.Value orderby dcit.OrderNo select ci).Include(x => x.Sys_ControlItemDetail); return query; } public IQueryable GetControlItemDetailList(Expression> exp) { var query = (from ci in ControlItemDetailRepository.GetList(exp) join dcit in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_ControlItemType).Name) on ci.Sys_ControlItem.ControlItemTypeID equals dcit.Value orderby dcit.OrderNo select ci).Include(x => x.Sys_ControlItem); return query; } } }