12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.Entities;
- using System.Linq.Expressions;
- namespace EMIS.DataLogic.SystemDAL
- {
- public class MenuDAL
- {
- public RoleRepository RoleRepository { get; set; }
- public UserRepository UserRepository { get; set; }
- public MenuRepository MenuRepository { get; set; }
- public IQueryable<Sys_Menu> GetMenuByUser(
- Expression<Func<Sys_Menu, bool>> menuDefineExp,
- Expression<Func<Sys_User, bool>> userExp)
- {
- var userFunc = userExp;
- var menuDefineFunc = menuDefineExp;
- var iqResult = from m in (
- (from u in this.UserRepository.GetList(userExp)
- from r in u.Sys_Role
- from f in r.Sys_FunctionCode
- join m in MenuRepository.GetList(menuDefineExp) on f.FunctionCode equals m.FunctionCode
- select m
- ).Concat(
- MenuRepository.GetList(menuDefineExp).Where(x => x.FunctionCode == null)
- )
- )
- group m by m into g
- select g.Key;
- return iqResult;
- }
- }
- }
|