Exemple #1
0
        /// <summary>
        /// Loads the subset collection.
        /// </summary>
        private void Load()
        {
            if (Invalid)
            {
                IsInitialized = false;
            }

            if (!IsInitialized)
            {
                Collection = new System.Collections.Generic.List <OlapSubset>(0);
                System.Collections.ArrayList subsets = NativeOlapApi.DimensionSubsets(_dimension.Server.Store.ClientSlot, _dimension.Server.ServerHandle, _dimension.Name, _dimension.Server.LastErrorInternal);
                if (subsets != null)
                {
                    for (int i = 0; i < subsets.Count; i++)
                    {
                        OlapSubsetTypes      type;
                        OlapSubsetDefinition subsetDef = (OlapSubsetDefinition)subsets[i];

                        if ((subsetDef.Type & 0x01) == 0x01)
                        {
                            type = OlapSubsetTypes.OlapSubsetTypesPublic;
                        }
                        else if ((subsetDef.Type & 0x02) == 0x02)
                        {
                            type = OlapSubsetTypes.OlapSubsetTypesPrivate;
                        }
                        else
                        {
                            throw new OlapException("Found unexpected subset type: " + subsetDef.Type);
                        }

                        Collection.Add(new OlapSubset(_dimension, subsetDef.RefName, subsetDef.LongName, subsetDef.CreatedByUser, type, subsetDef.SaveResultSet));
                    }
                }
                else
                {
                    if (_dimension.Server.LastErrorInternal.Value != 0)
                    {
                        throw new OlapException("Receiving the subset collection failed!", _dimension.Server.LastErrorInternal.Value);
                    }
                }
                Invalid       = false;
                IsInitialized = true;
            }
        }
Exemple #2
0
        /// <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;
            }
        }