Esempio n. 1
0
        /// <summary>
        /// Iterates over all dimensions in this server
        /// and stores them in the dimensions List
        /// </summary>
        public void SetDimensions()
        {
            for (int i = 1; i <= GetNumberOfDimensions(); i++)
            {
                int hDim = TM1API.TM1ObjectListHandleByIndexGet(this.pool.handle, this.handle, TM1API.TM1ServerDimensions(), TM1API.TM1ValIndex(this.pool.handle, i));

                if (TM1API.IsError(user.handle, hDim))
                {
                    throw new Exception();
                }

                Dimension dim = new Dimension(this.pool, this, hDim);
                dimensions.Add(dim);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Iterates over all cubes on this server
        /// and stores them in the cubes List
        /// </summary>
        public void SetCubes()
        {
            for (int i = 1; i <= GetNumberOfCubes(); i++)
            {
                int hCube = TM1API.TM1ObjectListHandleByIndexGet(this.pool.handle, this.handle, TM1API.TM1ServerCubes(), TM1API.TM1ValIndex(this.pool.handle, i));

                if (TM1API.IsError(user.handle, hCube))
                {
                    throw new Exception();
                }

                Cube cube = new Cube(this.pool, this, hCube);
                cubes.Add(cube);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Connects the server to the database and sets the handle
        /// </summary>
        public int Connect()
        {
            this.handle = TM1API.TM1SystemServerConnect(pool.handle, vServerName, vClientName, vPassword);

            if (TM1API.IsError(this.user.handle, this.handle))
            {
                throw new ServerConnectionException();
            }

            /// if necessary cubes and dimensions can be stored ///
            SetDimensions();
            SetCubes();//
            /// ---------------------------------------------- ///

            return(this.handle);
        }
Esempio n. 4
0
        /// <summary>
        /// Searches the servers cubes list for the cube with the given name
        /// </summary>
        /// <param name="name">Cube name to search for</param>
        /// <returns>The first found cube with the given name</returns>
        public Cube GetCubeByName(string name)
        {
            Cube cube = this.cubes.Find(x => x.name.Equals(name));

            if (cube == null)
            {
                int hCube = TM1API.TM1ObjectListHandleByNameGet(this.pool.handle, this.handle, TM1API.TM1ServerCubes(), TM1API.TM1ValString(this.pool.handle, name, 100));

                if (TM1API.IsError(user.handle, hCube))
                {
                    throw new Cube.NoSuchCubeException();
                }

                cube = new Cube(this.pool, this, hCube);
            }

            return(cube);
        }
Esempio n. 5
0
        public void setElements()
        {
            int nOfElements = getNumberOfElements();

            for (int i = 1; i <= nOfElements; i++)
            {
                int hElement = TM1API.TM1ObjectListHandleByIndexGet(this.pool.handle, this.handle, TM1API.TM1DimensionElements(), TM1API.TM1ValIndex(this.pool.handle, i));

                if (TM1API.IsError(this.server.user.handle, hElement))
                {
                    throw new NoSuchElementException();
                }

                int    nameProp    = TM1API.TM1ObjectPropertyGet(pool.handle, hElement, TM1API.TM1ObjectName()); // WORKS!!!!!!
                string elementName = TM1API.intPtrToString(server.user.handle, nameProp);

                Element element = new Element(this.pool, this.server, hElement);
                elements.Add(element);
            }
        }
Esempio n. 6
0
 public static bool IsOK(Int32 handle)
 {
     return(!TM1API.IsError(hUser.handle, handle));
 }