123456789101112131415161718192021222324252627282930313233343536373839404142 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMISOnline.DataLogic.Repositories;
- using EMISOnline.Entities;
- using System.Linq.Expressions;
- namespace EMISOnline.DataLogic.SystemDAL
- {
- public class MenuDAL
- {
- public RoleRepository RoleRepository { get; set; }
- public User_Sys_RoleRepository User_Sys_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)
- join ur in User_Sys_RoleRepository.Entities on u.UserID equals ur.UserID
- join r in RoleRepository.Entities on ur.RoleID equals r.RoleID
- from f in r.Sys_FunctionCode
- join m in MenuRepository.GetList(menuDefineExp) on f.FunctionCode equals m.FunctionCode
- select m
- ).Concat(
- MenuRepository.GetList(menuDefineExp)
- )
- )
- group m by m into g
- select g.Key;
- return iqResult;
- }
- }
- }
|