/// <summary> /// Loads the elements collection. /// </summary> protected void Load() { if (Invalid) { IsInitialized = false; } if (!IsInitialized) { Collection = new System.Collections.Generic.List <OlapElement>(0); System.Collections.Specialized.StringCollection elementNames = null; if (_subset != null) { OlapSubsetDefinition subsetDef = new OlapSubsetDefinition(); subsetDef.LongName = _subset.LongName; subsetDef.RefName = _subset.ReferenceName; elementNames = NativeOlapApi.DimensionSubsetElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, subsetDef, _dimension.Server.LastErrorInternal); } else if (_element != null) { switch (_elementsLevel) { case OlapElementsLevel.OlapElementsLevelParents: elementNames = NativeOlapApi.DimensionElementParents(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal); break; case OlapElementsLevel.OlapElementsLevelChildren: if (!_ignorePermissionsForChildren) { elementNames = NativeOlapApi.DimensionElementChildren(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal); } else { System.Collections.Generic.Dictionary <string, bool> allElementNames = NativeOlapApi.DimensionElementAllChildren(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _element.Name, _dimension.Server.LastErrorInternal); if (allElementNames != null) { System.Collections.Generic.Dictionary <string, bool> .Enumerator enumNames = allElementNames.GetEnumerator(); while (enumNames.MoveNext()) { System.Collections.Generic.KeyValuePair <string, bool> de = enumNames.Current; OlapElement newElement = new OlapElement(_dimension, de.Key); if (de.Value) { newElement.CanAccess = true; } else { newElement.CanAccess = false; } Collection.Add(newElement); } } else { if (_dimension.Server.LastErrorInternal.Value != 0) { throw new OlapException("Receiving the element collection failed!", _dimension.Server.LastErrorInternal.Value); } } Invalid = false; IsInitialized = true; return; } break; case OlapElementsLevel.OlapElementsLevelTopLevel: elementNames = NativeOlapApi.DimensionTopLevelElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal); break; } } else { switch (_elementsLevel) { case OlapElementsLevel.OlapElementsLevelTopLevel: elementNames = NativeOlapApi.DimensionTopLevelElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal); break; case OlapElementsLevel.OlapElementsLevelAll: elementNames = NativeOlapApi.DimensionElements(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal); break; } } if (elementNames != null) { for (int i = 0; i < elementNames.Count; i++) { OlapElement newElement = new OlapElement(_dimension, elementNames[i]); newElement.CanAccess = true; Collection.Add(newElement); } } else { if (_dimension.Server.LastErrorInternal.Value != 0) { throw new OlapException("Receiving the element collection failed!", _dimension.Server.LastErrorInternal.Value); } } Invalid = false; IsInitialized = true; } }