Ejemplo n.º 1
0
        public Member ReplaceMember(Member toReplace, Member replaceWith)
        {
            if (toReplace == null || replaceWith == null)
            {
                throw new ArgumentNullException();
            }
            if (toReplace == replaceWith)
            {
                return(toReplace);
            }

            CalculatedMember calcToReplace = toReplace as CalculatedMember;
            int existIndex = (calcToReplace != null ? this.CalculatedMembers.IndexOf(calcToReplace.UniqueName) : this.DataMembers.IndexOf(toReplace.UniqueName));

            // this might be one of nested members
            if (existIndex < 0)
            {
                // this might be one of nested members
                if (calcToReplace != null)
                {
                    return(this.CalculatedMembers.ReplaceParameterMember(calcToReplace, replaceWith));
                }

                return(null);
            }

            if (calcToReplace != null)
            {
                this.CalculatedMembers.RemoveAt(existIndex);
            }
            else
            {
                this.DataMembers.RemoveAt(existIndex);
            }

            try
            {
                this.AddMember(replaceWith, false);                 //add new member
            }
            catch (Exception exc)
            {
                // rollback in case of error
                if (existIndex >= 0)
                {
                    if (calcToReplace != null)
                    {
                        this.CalculatedMembers.Insert(existIndex, calcToReplace, false);
                    }
                    else
                    {
                        this.DataMembers.Insert(existIndex, toReplace, false);
                    }
                }

                throw exc;
            }

            return(replaceWith);
        }
Ejemplo n.º 2
0
 internal SchemaMember(Hierarchy hier, CalculatedMember ParentCalcMember) : base(hier)
 {
     this._uniqueName = ParentCalcMember.UniqueName;
     this._name       = ParentCalcMember.Name;
     this._childCount = ParentCalcMember.ChildCount;
     this._levelDepth = ParentCalcMember.LevelDepth;
     //this._isVisible=SrcMem.IsVisible;
 }
        public void Insert(int Index, CalculatedMember Member, bool replaceExisting)
        {
            if (Member.Hierarchy != this.Hierarchy)
            {
                throw new ArgumentException("Hierarchy mismatch");
            }

            base.Insert(Index, Member, replaceExisting);
        }
Ejemplo n.º 4
0
        public void RemoveMember(Member mem)
        {
            CalculatedMember cmem = mem as CalculatedMember;

            if (cmem != null)
            {
                this.CalculatedMembers.Remove(cmem.UniqueName);
            }
            else
            {
                this.DataMembers.Remove(mem.UniqueName);
            }
        }
Ejemplo n.º 5
0
        public void AddMember(Member mem, bool replaceExisting)
        {
            CalculatedMember cmem = mem as CalculatedMember;

            if (cmem != null)
            {
                this.CalculatedMembers.Add(cmem, replaceExisting);
            }
            else
            {
                this.DataMembers.Add(mem, replaceExisting);
            }
        }
        private void AddParameterInput(CalculatedMember cmem)
        {
            HtmlTableRow row=new HtmlTableRow();
            this.paramsTable.Rows.Add(row);

            FilteredByNameSet filtLevSet=cmem as FilteredByNameSet;
            if(filtLevSet!=null)
            {
                HtmlTableCell cell=new HtmlTableCell();
                row.Cells.Add(cell);

                CalculatedMemberControls.FilteredByNameSetControl control=(CalculatedMemberControls.FilteredByNameSetControl)Page.LoadControl(Request.ApplicationPath + "/OlapReport/CalculatedMemberControls/FilteredByNameSetControl.ascx");
                control._filtByNameSet=filtLevSet;
                cell.Controls.Add(control);
            }
        }
        public ArrayList GetPromptMembers()
        {
            ArrayList list = new ArrayList();

            if (this.Prompt)
            {
                list.Add(this);
            }

            foreach (Object obj in this._mdxParameters)
            {
                CalculatedMember cmem = obj as CalculatedMember;
                if (cmem != null)
                {
                    list.AddRange(cmem.GetPromptMembers());
                }
            }

            return(list);
        }
        public Member ReplaceParameterMember(Member toReplace, Member replaceWith)
        {
            for (int i = 0; i < _mdxParameters.Count; i++)
            {
                Object obj = _mdxParameters[i];
                if (toReplace == obj)
                {
                    return((Member)_mdxParameters.ReplaceAtIndex(i, replaceWith));
                }

                // --
                CalculatedMember cmem = obj as CalculatedMember;
                if (cmem != null)
                {
                    Member ret = cmem.ReplaceParameterMember(toReplace, replaceWith);
                    if (ret != null)
                    {
                        return(ret);
                    }
                }
            }

            return(null);
        }
        public void Insert(int Index, CalculatedMember Member, bool replaceExisting)
        {
            if(Member.Hierarchy!=this.Hierarchy)
                throw new ArgumentException("Hierarchy mismatch");

            base.Insert (Index, Member, replaceExisting);
        }
 public void Add(CalculatedMember Member, bool replaceExisting)
 {
     base.Add(Member, true);
 }
 public void Add(CalculatedMember Member, bool replaceExisting)
 {
     base.Add(Member, true);
 }