public MemToVisAggr(string name, Hierarchy HostHier, Member Measure , Hierarchy VisAggrHierarchy, VisualAggregate.AggregateFunction AggregateFunction)
            : base(name, HostHier)
        {
            if(HostHier.UniqueName!="[Measures]")
                throw new Exception("Cannot create on non-measures hierarchy");

            //DataMember measure=this.Hierarchy.AddDataMember(Measure);
            VisualAggregate vAggr=new VisualAggregate(null, VisAggrHierarchy, AggregateFunction);
            //vAggr=(VisualAggregate)VisAggrHierarchy.AddDataMember(vAggr);

            _mdxParameters.Add(Measure, false);
            _mdxParameters.Add(vAggr, false);
            Initialize(name, true);
        }
        public MemToVisAggr(string name, Hierarchy HostHier, Member Measure, Hierarchy VisAggrHierarchy, VisualAggregate.AggregateFunction AggregateFunction) : base(name, HostHier)
        {
            if (HostHier.UniqueName != "[Measures]")
            {
                throw new Exception("Cannot create on non-measures hierarchy");
            }

            //DataMember measure=this.Hierarchy.AddDataMember(Measure);
            VisualAggregate vAggr = new VisualAggregate(null, VisAggrHierarchy, AggregateFunction);

            //vAggr=(VisualAggregate)VisAggrHierarchy.AddDataMember(vAggr);

            this.MdxParameters.Add(Measure, true);
            this.MdxParameters.Add(vAggr, false);
            Initialize(name, true);
        }
 public VisualAggregate GetVisualAggregate(VisualAggregate.AggregateFunction aggr)
 {
     foreach(CalculatedMember cmem in this)
     {
         VisualAggregate vamem=cmem as VisualAggregate;
         if(vamem!=null && vamem.Aggregation==aggr)
             return vamem;
     }
     return null;
 }
        public void AddVisualAggr(string HierUN , string Aggr)
        {
            VisualAggregate.AggregateFunction aggr=(VisualAggregate.AggregateFunction)System.Enum.Parse(typeof(VisualAggregate.AggregateFunction) , Aggr , true);
            Hierarchy hier=_report.Schema.Hierarchies[HierUN];

            VisualAggregate mem=new VisualAggregate(null, hier, aggr);
            hier.AddMember(mem, true);
        }
 private bool HasAggragate(Hierarchy hier , VisualAggregate.AggregateFunction aggr)
 {
     foreach(DataMember mem in hier.CalculatedMembers)
     {
         VisualAggregate aggrMem=mem as VisualAggregate;
         if(aggrMem!=null && aggrMem.Aggregation==aggr)
             return true;
     }
     return false;
 }