Exemplo n.º 1
0
        public TList <T> FindIndex(TDictionary <string, T> cacheData, string indexKey, Predicate <T> match, params object[] keyValues)
        {
            var            resultList  = new TList <T>();
            TList <string> keyCodeList = new TList <string>();
            SchemaTable    schemaTable;

            if (!EntitySchemaSet.TryGet <T>(out schemaTable))
            {
                return(resultList);
            }
            _indexDictionary.FindIndex(indexKey, keyValues, keyCode =>
            {
                if (cacheData != null && cacheData.ContainsKey(keyCode))
                {
                    T t = cacheData[keyCode];
                    //检查不匹配的删除
                    string entityVal = string.Empty;
                    string[] propertys;
                    if (schemaTable.IndexList.TryGetValue(indexKey, out propertys))
                    {
                        entityVal = EntityData.GetKeyCode(GetIndexValues(propertys, t));
                    }
                    string tempVal = EntityData.GetKeyCode(keyValues);
                    if (entityVal.Equals(tempVal))
                    {
                        resultList.Add(t);
                    }
                    else
                    {
                        keyCodeList.Add(keyCode);
                    }
                }
            });
            foreach (string keyCode in keyCodeList)
            {
                _indexDictionary.RemoveIndex(indexKey, keyValues, keyCode);
            }
            if (match != null)
            {
                return(resultList.FindAll(match));
            }
            return(resultList);
        }
Exemplo n.º 2
0
        public static TList <GE.MyLearning.BL.Menus> GetMenusByUserID(string userid)
        {
            string whereClause = "ParentMenuID is not null and ParentMenuID<>'' and ParentMenuID<>'0' and PermissionID in (   select PermissionID   from RolePermission as a inner join UserRole as b on a.RoleID=b.RoleID   where userid=" + CommonClass.sqlString(userid) + " ) and status=" + ConfigInfo.Instance().VertualUniversityStyle.ToString();
            string orderBy     = "ParentMenuID,ShowOrder";
            int    count       = -1;
            TList <GE.MyLearning.BL.Menus> menus = DataRepository.MenusProvider.GetPaged(whereClause, orderBy, 0, 0x7fffffff, out count);

            whereClause = "(ParentMenuID is null or ParentMenuID='' or ParentMenuID='0') and status=" + ConfigInfo.Instance().VertualUniversityStyle.ToString();
            orderBy     = "ShowOrder";
            TList <GE.MyLearning.BL.Menus> groups = DataRepository.MenusProvider.GetPaged(whereClause, orderBy, 0, 0x7fffffff, out count);

            for (int i = 0; i < groups.Count; i++)
            {
                if (menus.FindAll(MenusColumn.ParentMenuId, groups[i].MenuId).Count > 0)
                {
                    menus.Add(groups[i]);
                }
            }
            if (ConfigInfo.Instance().VertualUniversityStyle.ToString() == "0")
            {
                DataRepository.UserRoleProvider.GetPaged(string.Format("(UserID='{0}') and (RoleID='000000003' or RoleID='000000004')", userid), null, 0, 0x7fffffff, out count);
                if (count != 0)
                {
                    return(menus);
                }
                DataRepository.UserInfoProvider.GetPaged(string.Format("OHR_HR_Rep='{0}'", userid), null, 0, 0x7fffffff, out count);
                if (count == 0)
                {
                    return(menus);
                }
                groups = DataRepository.MenusProvider.GetPaged("PermissionID='MgtInstitute03'", null, 0, 0x7fffffff, out count);
                foreach (GE.MyLearning.BL.Menus menu in groups)
                {
                    menus.Add(menu);
                }
            }
            return(menus);
        }