Exemplo n.º 1
0
        public SerializedICubeAddress(ICubeAddress address)
        {
            if (address.Measure != null)
            {
                MeasureDisplayName = address.Measure.DisplayName;
                MeasureUniqueName  = address.Measure.UniqueName;
            }

            if (address.MeasureMode != null)
            {
                MeasureMode = address.MeasureMode.Caption;
            }

            if (address.LevelsCount > 0)
            {
                Levels  = new string[address.LevelsCount];
                Members = new string[address.LevelsCount];

                for (var i = 0; i < address.LevelsCount; i++)
                {
                    Levels[i]  = address.Levels(i).UniqueName;
                    Members[i] = address.Members(i).UniqueName;
                }
            }

            Tag = address.Tag;
        }
Exemplo n.º 2
0
        internal virtual bool GetCell(ICubeAddress Address, out object Value)
        {
            Value = null;
            if (fM.FGrid.DeferLayoutUpdate)
            {
                return(false);
            }
            var r          = new Dictionary <Level, Member>(Address.FLevelsAndMembers.Count);
            var levelcount = Address.LevelsCount;

            for (var i = 0; i < levelcount; i++)
            {
                var m = Address.Members(i);
                if (m.FMemberType == MemberType.mtCalculated && string.IsNullOrEmpty(((CalculatedMember)m).Expression))
                {
                    return(false);
                }
                r.Add(Address.Levels(i), m);
            }

            if (fM.FGrid.isCalculatedState)
            {
                CurrentMap.ClearRequestMap();
                CurrentMap.AddRequest(r);
                DoRetrieveData();
                CurrentMap.ClearRequestMap();
            }

            return(false);
        }
Exemplo n.º 3
0
 /// <summary>
 ///     Returns True, if a hierarchy passed as the parameter is determined for the
 ///     current cube cell.
 /// </summary>
 public bool IsHierarchyDetermined(Hierarchy Hierarchy)
 {
     for (var i = 0; i < fAddress.LevelsCount; i++)
     {
         if (Hierarchy == fAddress.Levels(i).Hierarchy)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
        internal override IEnumerable <Member> GetMembersList(ICubeAddress a, Members MembersList)
        {
            Dictionary <long, MembersListStorage> sd = null;

            if (fSortedData == null)
            {
                long cnt = 1;
                for (var i = 0; i < a.LevelsCount; i++)
                {
                    cnt *= a.Levels(i).CompleteMembersCount;
                }
                if (cnt <= 300)
                {
                    return(MembersList.ToArray());
                }
                fSortedData = new Dictionary <string, Dictionary <long, MembersListStorage> >();
            }

            CheckLineAlive();

            //return MembersList.ToArray();

            var sb = new StringBuilder();

            for (var i = 0; i < a.LevelsCount; i++)
            {
                var l = a.Levels(i);
                if (l != MembersList[0].Level)
                {
                    sb.Append(l.ID + "|");
                }
            }
            var lkey = sb.ToString();

            if (!fSortedData.TryGetValue(lkey, out sd))
            {
                sd = new Dictionary <long, MembersListStorage>();
                fSortedData.Add(lkey, sd);
            }

            var muls = new long[a.LevelsCount];

            long multiplier = 1;
            long sdkey      = 0;

            for (var i = 0; i < a.LevelsCount; i++)
            {
                var l = a.Levels(i);
                if (l != MembersList[0].Level)
                {
                    sdkey      += a.Members(i).ID *multiplier;
                    muls[i]     = multiplier;
                    multiplier *= l.CompleteMembersCount;
                }
                else
                {
                    muls[i] = -1;
                }
            }

            if (sd.Count == 0)
            {
                for (var i = 0; i < fIndexes.Length; i++)
                {
                    var  mm   = fM.DecodeLineIdx(fIndexes[i]);
                    long ckey = 0;
                    var  id   = -1;
                    for (var j = 0; j < a.LevelsCount; j++)
                    {
                        if (muls[j] > 0)
                        {
                            ckey += mm[j] * muls[j];
                        }
                        else
                        {
                            id = mm[j];
                        }
                    }
                    MembersListStorage ss;
                    if (!sd.TryGetValue(ckey, out ss))
                    {
                        ss = new MembersListStorage();
                        sd.Add(ckey, ss);
                    }
                    ss.ids.Add(id);
                }
            }

            MembersListStorage mms = null;

            if (!sd.TryGetValue(sdkey, out mms))
            {
                return(new List <Member>());
            }

            return(mms.GetList(MembersList[0].Level));
        }