예제 #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;
            }
        }