public List <ActionInfo> GetActionsByMenuRoleFid(Guid menuFid) { List <MenuActionInfo> list = dal.GetList("and [VALID_FLAG] = 1 and [MENU_FID] = '" + menuFid + "'", string.Empty); if (list.Count == 0) { return(new List <ActionInfo>()); } List <ActionInfo> actionList = new ActionDAL().GetList("and [VALID_FLAG] = 1 " + "and [FID] in ('" + string.Join("','", list.Select(d => d.ActionFid.GetValueOrDefault()).ToArray()) + "')" , string.Empty); foreach (var actionInfo in actionList) { var info = list.SingleOrDefault(d => d.ActionFid == actionInfo.Fid); if (info == null) { continue; } actionInfo.DisplayOrder = info.ActionOrder.GetValueOrDefault(); actionInfo.ClientJs = info.ClientJs; actionInfo.Fid = info.Fid; } return(actionList.OrderBy(d => d.DisplayOrder).ToList()); }
public List <ActionInfo> GetActionsByMenuRoleFid(Guid menuFid, Guid roleFid) { List <MenuActionInfo> list = dal.GetList("and [MENU_FID] = '" + menuFid + "'", string.Empty); if (list.Count == 0) { return(new List <ActionInfo>()); } List <Guid> notNeedAuthFids = list.Where(d => !d.NeedAuth.GetValueOrDefault()).Select(d => d.ActionFid.GetValueOrDefault()).ToList(); ///权限 List <Guid> sourceFids = new RoleAuthDAL().GetAuthSourceFidsByRoleFidAuthTypeInSourceFids(roleFid , 2 , "'" + string.Join("','", list.Select(d => d.Fid.GetValueOrDefault()).ToArray()) + "'"); string actionFidCondition = string.Empty; if (sourceFids.Count > 0) { List <Guid> actionFids = list.Where(d => sourceFids.Contains(d.Fid.GetValueOrDefault())).Select(d => d.ActionFid.GetValueOrDefault()).ToList(); if (actionFids.Count > 0) { actionFidCondition += ",'" + string.Join("','", actionFids.ToArray()) + "'"; } } if (notNeedAuthFids.Count > 0) { actionFidCondition += ",'" + string.Join("','", notNeedAuthFids.ToArray()) + "'"; } if (string.IsNullOrEmpty(actionFidCondition)) { return(new List <ActionInfo>()); } List <ActionInfo> actionList = new ActionDAL().GetList("and [FID] in (" + actionFidCondition.Substring(1) + ")" , string.Empty); foreach (var actionInfo in actionList) { var info = list.SingleOrDefault(d => d.ActionFid == actionInfo.Fid); if (info == null) { continue; } actionInfo.DisplayOrder = info.ActionOrder.GetValueOrDefault(); actionInfo.ClientJs = info.ClientJs; actionInfo.Fid = info.Fid; } return(actionList.OrderBy(d => d.DisplayOrder).ToList()); }