Esempio n. 1
0
        /// <summary>
        /// Gets the elements of the collection and all its children as flat collection.
        /// </summary>
        /// <returns>All elements and their children store in this collection.</returns>
        public OlapElements FlatHierarchy()
        {
            OlapElements flatElements = null;

            Load();

            if (_elementsLevel == OlapElementsLevel.OlapElementsLevelAll)
            {
                flatElements = new OlapElements(_dimension, null, OlapElementsLevel.OlapElementsLevelFlat);
                flatElements.IgnorePermissionsForChildren = true;
                flatElements.Initialized = true;
                flatElements.Invalid     = false;
                for (int i = 0; i < Collection.Count; i++)
                {
                    OlapElement element = Collection[i];
                    flatElements.Collection.Add(element);
                }
            }
            else
            {
                flatElements = new OlapElements(_dimension, _element, OlapElementsLevel.OlapElementsLevelFlat);
                flatElements.IgnorePermissionsForChildren = true;
                flatElements.Initialized = true;
                flatElements.Invalid     = false;
                for (int i = 0; i < Collection.Count; i++)
                {
                    OlapElement element = Collection[i];
                    flatElements.Collection.Add(element);
                    MakeFlat(element, flatElements);
                }
            }
            return(flatElements);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates a flat representation of the hierarchy starting with the specifed element.
 /// </summary>
 /// <param name="element">The element to make flat.</param>
 /// <param name="collection">The collection that will store the flat elements.</param>
 private void MakeFlat(OlapElement element, OlapElements collection)
 {
     for (int i = 0; i < element.AllChildren.Count; i++)
     {
         collection.Collection.Add(element.Children[i]);
         MakeFlat(element.AllChildren[i], collection);
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Creates a flat representation of the hierarchy starting with the specifed element.
 /// </summary>
 /// <param name="element">The element to make flat.</param>
 /// <param name="collection">The collection that will store the flat elements.</param>
 /// <param name="type">An element type to specifiy which elements to get.</param>
 private void MakeFlat(OlapElement element, OlapElements collection, OlapElementType type)
 {
     for (int i = 0; i < element.AllChildren.Count; i++)
     {
         OlapElement element1 = element.AllChildren[i];
         if (element1.ElementInformation.ElementType == type)
         {
             collection.Collection.Add(element1);
         }
         MakeFlat(element1, collection, type);
     }
 }
Esempio n. 4
0
 /// <summary>
 /// Creates a new instance of the OlapDimension class.
 /// </summary>
 /// <param name="server">The Olap server that owns this dimension.</param>
 /// <param name="name">The name of the dimension.</param>
 public OlapDimension(OlapServer server, string name)
 {
     _attributeTable1Cache = new System.Collections.Generic.Dictionary <string, object>(0);
     _attributeTable2Cache = new System.Collections.Generic.Dictionary <string, object>(0);
     _attributeTable3Cache = new System.Collections.Generic.Dictionary <string, object>(0);
     _cacheAttributeValues = true;
     _server  = server;
     _name    = name;
     _subsets = null;
     _dimensionInformation = null;
     _elements             = null;
     _attributeTables      = null;
     _hierarchyElements    = null;
     _upperName            = null;
 }
Esempio n. 5
0
        /// <summary>
        /// Gets the elements of the collection and all its children as flat collection.
        /// </summary>
        /// <param name="type">An element type to specifiy which elements to get.</param>
        /// <returns>All elements and their children store in this collection that have
        /// the specified type.</returns>
        public OlapElements FlatHierarchy(OlapElementType type)
        {
            OlapElements flatElements = null;

            Load();

            // if this collection includes all elements, making it flat means put all elements
            // into the result and filter by type in addition.
            if (_elementsLevel == OlapElementsLevel.OlapElementsLevelAll)
            {
                flatElements = new OlapElements(_dimension, null, OlapElementsLevel.OlapElementsLevelFlat);
                flatElements.IgnorePermissionsForChildren = true;
                flatElements.Initialized = true;
                flatElements.Invalid     = false;
                for (int i = 0; i < Collection.Count; i++)
                {
                    OlapElement element = Collection[i];
                    if (type == element.ElementInformation.ElementType)
                    {
                        flatElements.Collection.Add(element);
                    }
                }
            }
            else
            {
                flatElements = new OlapElements(_dimension, _element, OlapElementsLevel.OlapElementsLevelFlat);
                flatElements.IgnorePermissionsForChildren = true;
                flatElements.Initialized = true;
                flatElements.Invalid     = false;
                for (int i = 0; i < Collection.Count; i++)
                {
                    OlapElement element = Collection[i];
                    if (element.ElementInformation.ElementType == type)
                    {
                        flatElements.Collection.Add(element);
                    }
                    MakeFlat(element, flatElements, type);
                }
            }

            OlapElements result = null;

            result = new OlapElements(_dimension, null, OlapElementsLevel.OlapElementsLevelFlat);
            result.IgnorePermissionsForChildren = true;
            result.Initialized = true;
            result.Invalid     = false;

            for (int i = 0; i < flatElements.Count; i++)
            {
                if (flatElements[i].CanAccess)
                {
                    OlapElement element = flatElements[i];
                    if (!result.Collection.Contains(element))
                    {
                        result.Collection.Add(element);
                    }
                }
            }

            return(result);
        }