using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.SystemView; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.DataLogic.SystemDAL { public class FunctionDAL { public FunctionCodeRepository FunctionCodeRepository { get; set; } public RoleRepository RoleRepository { get; set; } public IQueryable GetAllFunctionCodeView() { var q = (from fc in FunctionCodeRepository.Entities select new FunctionCodeView { FunctionCode = fc.FunctionCode, FunctionName = fc.FunctionName, ParentFunctionCode = fc.ParentFunctionCode, OrderNo = fc.OrderNo } ).Distinct(); return q; } public IQueryable GetSelectedFunctionCodeViewByRole(Expression> exp) { var q = (from r in RoleRepository.GetList(exp) from fc in r.Sys_FunctionCode select new FunctionCodeView { FunctionCode = fc.FunctionCode, FunctionName = fc.FunctionName, ParentFunctionCode = fc.ParentFunctionCode, OrderNo = fc.OrderNo } ).Distinct(); return q; } } }