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 GetMenuByUser( Expression> menuDefineExp, Expression> 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; } } }