using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.Entities; using EMIS.ViewModel; namespace EMIS.DataLogic.SystemDAL { public class ContextMenuDAL { public RoleRepository RoleRepository { get; set; } public UserRepository UserRepository { get; set; } public ContextMenuRepository ContextMenuRepository { get; set; } /// /// 根据对应的条件查询相应页面的权限信息 /// /// /// /// /// /// public IQueryable GetContextMenuListByUserAndRoleID(string menuNo, string formClass, Guid userID, Guid? roleID) { var query = from cm in ContextMenuRepository.GetList(x => x.RecordStatus >= (int)SYS_STATUS.USABLE) from tr in cm.Sys_FunctionCode.Sys_Role.Where(x => x.RecordStatus >= (int)SYS_STATUS.USABLE).DefaultIfEmpty() from ur in tr.Sys_User.DefaultIfEmpty() where (cm.FunctionCode == null || !cm.IsNeedPrivilege || (((ur != null) ? ur.UserID : Guid.Empty) == userID && (roleID == null || tr.RoleID == roleID))) && cm.MenuNo == menuNo && cm.FormClass == formClass select cm; return query.Distinct(); } } }