public void DrillAction(PossibleDrillActions Mode)
        {
            DebugLogging.WriteLine("MemberCell.DrillAction({0})", Mode);

            if ((Mode & PossibleDrillActions) != Mode)
            {
                var S = "";
                if (Mode == PossibleDrillActions.esCollapsed)
                {
                    S = RadarUtils.GetResStr("rsDrillAction0");
                }
                if (Mode == PossibleDrillActions.esParentChild)
                {
                    S = RadarUtils.GetResStr("rsDrillAction1");
                }
                if (Mode == PossibleDrillActions.esNextLevel)
                {
                    S = RadarUtils.GetResStr("rsDrillAction2");
                }
                if (Mode == PossibleDrillActions.esNextHierarchy)
                {
                    S = RadarUtils.GetResStr("rsDrillAction3");
                }

                throw new Exception(
                          string.Format(RadarUtils.GetResStr("rsInadmissibleDrillAction"), S, Value));
            }

            CellSet.DrillAction_Inner(Mode, RealMember);
        }
Exemplo n.º 2
0
 internal override void StartMergeSeries(int estimatedCount)
 {
     DebugLogging.WriteLine("MdLine.StartMergeSeries(estimatedCount={0})", estimatedCount);
     CheckLineAlive();
     fNewIndexes = new long[estimatedCount];
     fNewData    = new LineData[estimatedCount];
     fCounter    = 0;
 }
Exemplo n.º 3
0
        internal MdLine(MetaLine AMetaLine, string ID, string MeasureID, MeasureShowMode Mode, int HierID)
            : base(AMetaLine, ID, MeasureID, Mode, HierID)
        {
            DebugLogging.WriteLine("MdLine.ctor(ID={0} of MetaLine.ID={1})", ID, AMetaLine.ID);

            fData    = new LineData[0];
            fIndexes = new long[0];
        }
        internal virtual void LoadTo(OlapControl aGrid)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.LoadTo");

            if (!aGrid.Active)
            {
                return;
            }

            aGrid.FEmptyDataString      = EmptyDataString;
            aGrid.FCurrencyFormatString = CurrencyFormatString;


            aGrid.BeginUpdate();

            Clear(aGrid);

            if (AxesLayout != null)
            {
                aGrid.FLayout.fMeasureLayout              = AxesLayout.MeasureLayout;
                aGrid.FLayout.fMeasurePosition            = AxesLayout.MeasurePosition;
                aGrid.FLayout.fHideMeasureIfPossible      = AxesLayout.HideMeasureIfPossible;
                aGrid.FLayout.fHideMeasureModesIfPossible = AxesLayout.HideMeasureModesIfPossible;

                aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection;
                aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn;
            }

            var assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList();

            LoadMeasuresXandY(aGrid, assignedMeasures);
            LoadHierarchies(aGrid, assignedMeasures);

            aGrid.FCellSet.Rebuild();

            LoadMeasures(aGrid);

            assignedMeasures = aGrid.Measures.Where(item => item.Visible).ToList();

            aGrid.FCellSet.Rebuild();

            if (AxesLayout != null)
            {
                aGrid.FCellSet.FSortingDirection = AxesLayout.ValueSortingDirection;
                aGrid.FCellSet.ValueSortedColumn = AxesLayout.ValueSortedColumn;
            }

            foreach (var item in assignedMeasures)
            {
                aGrid.Pivoting(item, LayoutArea.laRow, null, LayoutArea.laNone);
            }
            LoadComments(aGrid);
            LoadColumnsWidth(aGrid);

            aGrid.EndUpdate();
        }
        internal IEnumerable <CellsetMember> AllChildren()
        {
            DebugLogging.WriteLine("CellsetLevel.AllChildren() ({0})", ToString());

            return(FLevel.Grid.CellSet.FRowMembers
                   .SelectMany(item => item.AllChildren())
                   .Union(
                       FLevel.Grid.CellSet.FColumnMembers
                       .SelectMany(item => item.AllChildren()))
                   .Where(item => item.FLevel == this));
        }
        private void DebugLogging_WriteLine(IList <int> LevelIndexes)
        {
            if (DebugLogging.Verify("OlapCubeMetaLine.ctor()"))
            {
                return;
            }

            var levels = "(" + string.Join(", ", Levels.Select(x => x.DisplayName).ToArray()) + ")";

            DebugLogging.WriteLine("OlapCubeMetaLine.ctor(ID={0} AGrid, LevelIndexes={1}={2})", ID,
                                   Extentions.ConvertToString(LevelIndexes), levels);
        }
        protected virtual void WriteXMLInner(Stream stream)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.WriteXMLInner");

            //if (fGrid != null)
            LoadFrom(fGrid);

            fGrid.BeforSave(fGrid, new OnSerializeArgs(this));

            var bf = XmlSerializator.GetXmlSerializer(GetType());

            bf.Serialize(stream, this);
        }
Exemplo n.º 8
0
        internal virtual void SetActive(bool Value)
        {
            DebugLogging.WriteLine("Engine.SetActive(Value={0})", Value);

            if (FGrid != null)
            {
                FGrid.SetActive(Value);
            }
            if (!Value)
            {
                foreach (var ml in FMetaLines.Values)
                {
                    ml.Clear();
                }
                FMetaLines.Clear();
                cache_indexes = null;
                cache_ml      = null;
                FLevelsList.Clear();
            }
        }
        internal virtual void LoadFrom(OlapControl grid)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.LoadFrom");

            EmptyDataString      = grid.FEmptyDataString;
            CurrencyFormatString = grid.FCurrencyFormatString;

            grid.RefreshChartsType();
            ChartsType = grid.ChartsType;
            TrendSerialize(grid);

            AxesLayout = new SerializedLayout();
            AxesLayout.Init(grid);

            var lh = new List <SerializedHierarchy>();

            foreach (var d in grid.Dimensions)
            {
                foreach (var h in d.Hierarchies)
                {
                    lh.Add(new SerializedHierarchy(h));
                }
            }
            Hierarchies = lh.ToArray();

            if (grid.FCellSet.fComments.Count > 0)
            {
                var ca = new List <SerializedICubeAddress>(grid.FCellSet.fComments.Count);
                var cs = new List <string>(grid.FCellSet.fComments.Count);

                foreach (var k in grid.FCellSet.fComments)
                {
                    ca.Add(new SerializedICubeAddress(k.Key));
                    cs.Add(k.Value);
                }

                CommentAddresses = ca.ToArray();
                CommentStrings   = cs.ToArray();
            }
            SaveCubeData(grid);
        }
Exemplo n.º 10
0
        internal override void EndMergeSeries()
        {
            DebugLogging.WriteLine("MdLine.EndMergeSeries()");

            fSortedData = null;

            //if (fCacheKey != null)
            //    fM.Grid.Cache.Remove(fCacheKey);

            //if (fM.Grid.Cache != null)
            //    fCacheKey = Guid.NewGuid() + "ln";

            Array.Resize(ref fNewIndexes, fCounter + fIndexes.Length);
            fIndexes.CopyTo(fNewIndexes, fCounter);
            fIndexes = fNewIndexes;

            Array.Resize(ref fNewData, fCounter + fData.Length);
            fData.CopyTo(fNewData, fCounter);
            fData = fNewData;

            Array.Sort(fIndexes, fData);
            FRange = null;

            //if (fM.Grid.Cache != null)
            //{
            string pathToCachDependencyFile = fM.Grid.SessionState.WorkingDirectoryName + TempDirectory.CacheDependencyFile;
            //    if (!File.Exists(pathToCachDependencyFile))
            //        File.Create(pathToCachDependencyFile).Dispose();

            //    if (!fM.Grid.Cache.TryGetValue(fCacheKey, out object o))
            //    {
            //        //fM.Grid.Cache.Set(fCacheKey, new Tuple<long[], LineData[]>(fIndexes, fData), TimeSpan.FromMinutes(5));
            //        fM.Grid.Cache.Set(fCacheKey, new Tuple<long[], LineData[]>(fIndexes, fData), new FileCacheDependency(pathToCachDependencyFile));
            //        DateTime d = DateTime.Now;
            //        DebugLogging.WriteLine("Grid.Cache.Insert:fCacheKey={0}, Time:{1}, pathToCachDependencyFile:{2}", fCacheKey, d.ToString(), pathToCachDependencyFile);
            //    }
            //}
        }
Exemplo n.º 11
0
 internal Engine()
 {
     DebugLogging.WriteLine("Engine.ctor()");
 }
Exemplo n.º 12
0
        internal override void RetrieveLine2(Dictionary <Level, HashSet <Member> > src, Line ALine)
        {
            DebugLogging.WriteLine("MdEngine.RetrieveLine2(line={0})", ALine.ToString());

            var line = ALine as MdLine;
            //ICubeAddress Restriction = new ICubeAddress(ALine.MetaLine.Grid, restriction);

            var sources = new List <Hierarchy>();

            foreach (var l1 in ALine.Levels)
            {
                if (!src.ContainsKey(l1))
                {
                    sources.Add(l1.Hierarchy);
                }
            }

            var cube = (MOlapCube)FGrid.Cube;

            cube.EnsureConnected();

            var           QUERY   = new StringBuilder();
            var           WITH    = new StringBuilder();
            var           WHERE   = new StringBuilder("WHERE (");
            StringBuilder SUBCUBE = null;
            StringBuilder SELECT;
            var           intelligenceh = ALine.fMode.LinkedIntelligence == null ? null : ALine.fMode.LinkedIntelligence.fParent;
            var           MeasureName   = ALine.fMode.LinkedIntelligence == null
                ? ALine.Measure.UniqueName
                : cube.MakeIntelligenceMember(ALine, WITH);

            if (ALine.fMode.Mode == MeasureShowModeType.smNormal && ALine.Measure.Filter != null)
            {
                cube.MakeMeasureFilter(ALine.Measure, WITH, out MeasureName);
            }

            if (ALine.Measure.AggregateFunction == OlapFunction.stCalculated &&
                !string.IsNullOrEmpty(ALine.Measure.Expression))
            {
                cube.MakeCalculatedMeasure(ALine.Measure, WITH);
            }

            if (cube.MDXCellsetThreshold > 0 && !cube.Is2000)
            {
                SELECT = new StringBuilder("SELECT {HEAD(NONEMPTY({");
            }
            else
            {
                SELECT = new StringBuilder("SELECT NON EMPTY {");
            }
            // GetLineIDX info
            var  idxlevels = new List <Level>(src.Count + sources.Count);
            var  idxmul    = new List <long>(src.Count + sources.Count);
            long idx       = 0;

            //if (!cube.Is2000) //MSAS 2000
            //{
            //    #region MSAS 2000
            //    WITH = RetrieveLine2_MSAS2000(
            //        src, ALine, intelligenceh, WHERE, idxmul, idxlevels,
            //        cube, WITH, sources, MeasureName, ref SELECT, ref idx);

            //    #endregion
            //}
            //else //MSAS 2005
            //{
            //    #region MSAS 2005

            //    RetrieveLine2_MSAS2005(
            //        src, ALine, cube, ref WITH, WHERE, ref SUBCUBE, ref SELECT,
            //        intelligenceh, MeasureName, idxlevels, idxmul);
            //    #endregion
            //}

            RetrieveLine2_MSAS(src, ALine, intelligenceh, WHERE, idxmul, idxlevels, cube, ref WITH, sources,
                               MeasureName, ref SELECT, ref idx, ref SUBCUBE);

            QUERY.Append(WITH);
            QUERY.Append(SELECT);
            QUERY.Append(WHERE);
            QUERY.Append(cube.ApplyCellProperties());

            var css = cube.ExecuteMDXCellset(QUERY.ToString(), true);

            if (css.Cells.Count == cube.MDXCellsetThreshold && cube.MDXCellsetThreshold > 0)
            {
                cube.MDXCellsetThresholdReached = true;
            }

            if (css.Cells.Count == 0)
            {
                return;
            }

            if (css.Axes.Count == 0)
            {
                var c = new WrappedCell(css.Cells[0]);
                CellColorSettings mcs = null;
                CellFontSettings  mfs = null;

                if (c == null || c.Value == null)
                {
                    return;
                }

                ALine.StartMergeSeries(1);

                line.AddData(idx, new LineData(c.Value, c.FormattedValue, mcs, mfs));

                ALine.EndMergeSeries();
                return;
            }
            var cc = css.Cells;
            var tc = css.Axes[0].Set.Tuples;

            ALine.StartMergeSeries(cc.Count);
            for (var i = 0; i < cc.Count; i++)
            {
                var c = new WrappedCell(css.Cells[i]);
                if (c == null || c.Value == null)
                {
                    continue;
                }

                var mc  = tc[i].Members;
                var Idx = idx;
                for (var j = 0; j < mc.Count; j++)
                {
                    var        L = idxlevels[j].CubeLevel;
                    var        m = idxlevels[j].FindMember(mc[j].UniqueName);
                    CubeMember M = null;
                    if (m == null)
                    {
                        var m_ = mc[j];
                        //                        if ((m_.Type == MemberTypeEnum.All) || (m_.UniqueName.EndsWith(".UNKNOWNMEMBER")))
                        if (m_.Type == MemberTypeEnum.All)
                        {
                            Idx = -1;
                            break;
                        }
                        if (m_.LevelName != L.UniqueName && L.Hierarchy.Origin == HierarchyOrigin.hoUserDefined)
                        {
                            L = L.Hierarchy.Levels.Find(m_.LevelName);
                            M = L.FindMemberByUniqueName(m_.UniqueName);
                        }
                        if (M == null)
                        {
                            M = new CubeMember(L.Hierarchy, L, m_.Caption, m_.Description, m_.UniqueName, m_.Name,
                                               false, m_.LevelName);
                            var parent = m_.Parent == null
                                ? null
                                : L.Hierarchy.FindMemberByUniqueName(m_.Parent.UniqueName);
                            if (m_.Type == MemberTypeEnum.Formula)
                            {
                                M.IsMDXCalculated = true;
                            }
                            //if ((parent == null) && (idxlevels[j].Index > 0))
                            //{
                            //    object pname = m_.Properties["PARENT_MEMBER_TYPE"].Value;
                            //    if (pname != null)
                            //        parent = L.Hierarchy.FindMemberByUniqueName(pname.ToString());
                            //}
                            if (parent == null)
                            {
                                L.Members.Add(M);
                            }
                            else
                            {
                                if (L == parent.ParentLevel)
                                {
                                    cube.SetCubeMemberParent(M, parent);
                                }
                                else
                                {
                                    var H = L.Hierarchy;
                                    cube.SetCubeMemberParent(L.Hierarchy, H.Levels.IndexOf(M.ParentLevel),
                                                             H.Levels.IndexOf(parent.ParentLevel), M.UniqueName, parent.UniqueName);
                                    L.Members.Add(M);
                                }
                            }
                        }
                    }
                    if (m != null)
                    {
                        Idx += m.ID * idxmul[j];
                    }
                    else
                    {
                        Idx += M.ID * idxmul[j];
                    }
                }
                CellColorSettings mcs = null;
                CellFontSettings  mfs = null;
                if (Idx >= 0)
                {
                    line.AddData(Idx, new LineData(c.Value, c.FormattedValue, mcs, mfs));
                }
                for (var k = 0; k < ALine.Levels.Count; k++)
                {
                    ALine.Levels[k].CreateNewMembersLight(false);
                }
            }
            for (var k = 0; k < ALine.Levels.Count; k++)
            {
                ALine.Levels[k].CreateNewMembersLight(true);
            }
            ALine.EndMergeSeries();
        }
        internal virtual void ReadXMLInner(Stream stream)
        {
            DebugLogging.WriteLine("OlapAxisLayoutSerializer.ReadXMLInner");

            if (fGrid != null)
            {
                fGrid.BeforLoad(fGrid, EventArgs.Empty);
            }

            #region code of old vertions file (web saving)

            // define signal string
            // content of web-versions file:
            // #1: <?xml version="1.0"?>
            // #2: <OlapGridSerializer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            // # etc ...
            //

            stream.Position = 0;
            var sr = new StreamReader(stream, Encoding.UTF8);

            stream.Position = 0;
            var alldata = sr.ReadToEnd();

            // its Web-like saved !!!
            //if ((!string.IsNullOrEmpty(lines[1])) && (string.Compare(lines[1], signalstr) == 0))
            if (alldata.Contains(_signalstr))
            {
                stream.Position = 0;
                sr      = new StreamReader(stream, Encoding.UTF8);
                alldata = alldata.Replace(_signalstr, @"<OlapAxisLayoutSerializer>");
                alldata = alldata.Replace(@"</OlapGridSerializer>", @"</OlapAxisLayoutSerializer>");

                var ms = new MemoryStream();
                var sw = new StreamWriter(ms);
                sw.Write(alldata);
                sw.Flush();

                var bf = XmlSerializator.GetXmlSerializer(typeof(OlapAxisLayoutSerializer));

#if OLAPWINFORMS
                if (fGrid != null)
                {
                    fGrid.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                }
#endif

                ms.Position = 0;

                var g = (OlapAxisLayoutSerializer)bf.Deserialize(ms);

                if (fGrid != null)
                {
                    g.fGrid = fGrid;
                    g.LoadTo(fGrid);
#if OLAPWINFORMS
                    fGrid.Cursor = System.Windows.Forms.Cursors.Default;
#endif
                    fGrid.AfterLoad(fGrid, new OnSerializeArgs(g));
                }

                return;
            }

            #endregion end of web-xml reading

            _SOLAPGrid = fGrid;

            var bf1 = XmlSerializator.GetXmlSerializer(GetType());

            stream.Flush();
            stream.Position = 0;

            if (fGrid != null)
            {
                var g1 = (OlapGridSerializer)bf1.Deserialize(stream);
                g1.fGrid = fGrid;
                g1.SuppressSaveOLAPSlices = SuppressSaveOLAPSlices;

                fGrid._IsReadXMLProcessing = true;
                if (!fGrid.IsUpdating)
                {
                    fGrid.BeginUpdate();
                    g1.LoadTo(fGrid);
                    fGrid.EndUpdate();
                }
                else
                {
                    g1.LoadTo(fGrid);
                }

                fGrid.AfterLoad(fGrid, new OnSerializeArgs(g1));

                fGrid._IsReadXMLProcessing = false;
            }
            _SOLAPGrid = null;
        }
 internal CellsetLevel(Level ALevel)
 {
     DebugLogging.WriteLine("CellsetLevel.ctor({0})", ToString());
     FLevel = ALevel;
 }
Exemplo n.º 15
0
 public MdMetaLine()
 {
     DebugLogging.WriteLine("OlapCubeMetaLine.ctor(ID=null)");
 }
 public MeasureGroup()
 {
     DebugLogging.WriteLine("MeasureGroup.ctor");
 }