private void SetAllNull()
        {
            HasTuples = false;
            Tuples    = new SLTuplesType();

            Mdx = "";
        }
        private void SetAllNull()
        {
            Tuples = new List <SLTuplesType>();

            HasSortByTuple = false;
            SortByTuple    = new SLTuplesType();

            MaxRank       = 0;
            SetDefinition = "";
            SortType      = SortValues.None;
            QueryFailed   = false;
        }
Esempio n. 3
0
        internal SLTuplesType Clone()
        {
            var tt = new SLTuplesType();

            tt.MemberNameCount = MemberNameCount;

            tt.Tuples = new List <SLTuple>();
            foreach (var t in Tuples)
            {
                tt.Tuples.Add(t.Clone());
            }

            return(tt);
        }
        internal void FromTupleSet(TupleSet ts)
        {
            SetAllNull();

            if (ts.MaxRank != null)
            {
                MaxRank = ts.MaxRank.Value;
            }
            if (ts.SetDefinition != null)
            {
                SetDefinition = ts.SetDefinition.Value;
            }
            if (ts.SortType != null)
            {
                SortType = ts.SortType.Value;
            }
            if (ts.QueryFailed != null)
            {
                QueryFailed = ts.QueryFailed.Value;
            }

            SLTuplesType tt;

            using (var oxr = OpenXmlReader.Create(ts))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Tuples))
                    {
                        tt = new SLTuplesType();
                        tt.FromTuples((Tuples)oxr.LoadCurrentElement());
                        Tuples.Add(tt);
                    }
                    else if (oxr.ElementType == typeof(SortByTuple))
                    {
                        SortByTuple.FromSortByTuple((SortByTuple)oxr.LoadCurrentElement());
                        HasSortByTuple = true;
                    }
                }
            }
        }
        internal void FromMissingItem(MissingItem mi)
        {
            SetAllNull();

            if (mi.Unused != null)
            {
                Unused = mi.Unused.Value;
            }
            if (mi.Calculated != null)
            {
                Calculated = mi.Calculated.Value;
            }
            if (mi.Caption != null)
            {
                Caption = mi.Caption.Value;
            }
            if (mi.PropertyCount != null)
            {
                PropertyCount = mi.PropertyCount.Value;
            }
            if (mi.FormatIndex != null)
            {
                FormatIndex = mi.FormatIndex.Value;
            }
            if (mi.BackgroundColor != null)
            {
                BackgroundColor = mi.BackgroundColor.Value;
            }
            if (mi.ForegroundColor != null)
            {
                ForegroundColor = mi.ForegroundColor.Value;
            }
            if (mi.Italic != null)
            {
                Italic = mi.Italic.Value;
            }
            if (mi.Underline != null)
            {
                Underline = mi.Underline.Value;
            }
            if (mi.Strikethrough != null)
            {
                Strikethrough = mi.Strikethrough.Value;
            }
            if (mi.Bold != null)
            {
                Bold = mi.Bold.Value;
            }

            SLTuplesType        tt;
            MemberPropertyIndex mpi;

            using (var oxr = OpenXmlReader.Create(mi))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(Tuples))
                    {
                        tt = new SLTuplesType();
                        tt.FromTuples((Tuples)oxr.LoadCurrentElement());
                        Tuples.Add(tt);
                    }
                    else if (oxr.ElementType == typeof(MemberPropertyIndex))
                    {
                        // 0 is the default value.
                        mpi = (MemberPropertyIndex)oxr.LoadCurrentElement();
                        if (mpi.Val != null)
                        {
                            MemberPropertyIndexes.Add(mpi.Val.Value);
                        }
                        else
                        {
                            MemberPropertyIndexes.Add(0);
                        }
                    }
                }
            }
        }