コード例 #1
0
        internal SLCalculatedItem Clone()
        {
            SLCalculatedItem ci = new SLCalculatedItem();
            ci.Field = this.Field;
            ci.Formula = this.Formula;
            ci.PivotArea = this.PivotArea.Clone();

            return ci;
        }
コード例 #2
0
        internal SLCalculatedItem Clone()
        {
            SLCalculatedItem ci = new SLCalculatedItem();

            ci.Field     = this.Field;
            ci.Formula   = this.Formula;
            ci.PivotArea = this.PivotArea.Clone();

            return(ci);
        }
コード例 #3
0
        internal void FromPivotCacheDefinition(PivotCacheDefinition pcd)
        {
            this.SetAllNull();

            if (pcd.Id != null) this.Id = pcd.Id.Value;
            if (pcd.Invalid != null) this.Invalid = pcd.Invalid.Value;
            if (pcd.SaveData != null) this.SaveData = pcd.SaveData.Value;
            if (pcd.RefreshOnLoad != null) this.RefreshOnLoad = pcd.RefreshOnLoad.Value;
            if (pcd.OptimizeMemory != null) this.OptimizeMemory = pcd.OptimizeMemory.Value;
            if (pcd.EnableRefresh != null) this.EnableRefresh = pcd.EnableRefresh.Value;
            if (pcd.RefreshedBy != null) this.RefreshedBy = pcd.RefreshedBy.Value;
            if (pcd.RefreshedDate != null) this.RefreshedDate = pcd.RefreshedDate.Value;
            if (pcd.BackgroundQuery != null) this.BackgroundQuery = pcd.BackgroundQuery.Value;
            if (pcd.MissingItemsLimit != null) this.MissingItemsLimit = pcd.MissingItemsLimit.Value;
            if (pcd.CreatedVersion != null) this.CreatedVersion = pcd.CreatedVersion.Value;
            if (pcd.RefreshedVersion != null) this.RefreshedVersion = pcd.RefreshedVersion.Value;
            if (pcd.MinRefreshableVersion != null) this.MinRefreshableVersion = pcd.MinRefreshableVersion.Value;
            if (pcd.RecordCount != null) this.RecordCount = pcd.RecordCount.Value;
            if (pcd.UpgradeOnRefresh != null) this.UpgradeOnRefresh = pcd.UpgradeOnRefresh.Value;
            if (pcd.IsTupleCache != null) this.IsTupleCache = pcd.IsTupleCache.Value;
            if (pcd.SupportSubquery != null) this.SupportSubquery = pcd.SupportSubquery.Value;
            if (pcd.SupportAdvancedDrill != null) this.SupportAdvancedDrill = pcd.SupportAdvancedDrill.Value;

            if (pcd.CacheSource != null) this.CacheSource.FromCacheSource(pcd.CacheSource);

            // doing one by one because it's bloody hindering awkward complicated.

            if (pcd.CacheFields != null)
            {
                SLCacheField cf;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CacheFields))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CacheField))
                        {
                            cf = new SLCacheField();
                            cf.FromCacheField((CacheField)oxr.LoadCurrentElement());
                            this.CacheFields.Add(cf);
                        }
                    }
                }
            }

            if (pcd.CacheHierarchies != null)
            {
                SLCacheHierarchy ch;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CacheHierarchies))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CacheHierarchy))
                        {
                            ch = new SLCacheHierarchy();
                            ch.FromCacheHierarchy((CacheHierarchy)oxr.LoadCurrentElement());
                            this.CacheHierarchies.Add(ch);
                        }
                    }
                }
            }

            if (pcd.Kpis != null)
            {
                SLKpi k;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Kpis))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Kpi))
                        {
                            k = new SLKpi();
                            k.FromKpi((Kpi)oxr.LoadCurrentElement());
                            this.Kpis.Add(k);
                        }
                    }
                }
            }

            if (pcd.TupleCache != null)
            {
                this.TupleCache.FromTupleCache(pcd.TupleCache);
                this.HasTupleCache = true;
            }

            if (pcd.CalculatedItems != null)
            {
                SLCalculatedItem ci;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CalculatedItems))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CalculatedItem))
                        {
                            ci = new SLCalculatedItem();
                            ci.FromCalculatedItem((CalculatedItem)oxr.LoadCurrentElement());
                            this.CalculatedItems.Add(ci);
                        }
                    }
                }
            }

            if (pcd.CalculatedMembers != null)
            {
                SLCalculatedMember cm;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CalculatedMembers))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CalculatedMember))
                        {
                            cm = new SLCalculatedMember();
                            cm.FromCalculatedMember((CalculatedMember)oxr.LoadCurrentElement());
                            this.CalculatedMembers.Add(cm);
                        }
                    }
                }
            }

            if (pcd.Dimensions != null)
            {
                SLDimension d;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Dimensions))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Dimension))
                        {
                            d = new SLDimension();
                            d.FromDimension((Dimension)oxr.LoadCurrentElement());
                            this.Dimensions.Add(d);
                        }
                    }
                }
            }

            if (pcd.MeasureGroups != null)
            {
                SLMeasureGroup mg;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.MeasureGroups))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(MeasureGroup))
                        {
                            mg = new SLMeasureGroup();
                            mg.FromMeasureGroup((MeasureGroup)oxr.LoadCurrentElement());
                            this.MeasureGroups.Add(mg);
                        }
                    }
                }
            }

            if (pcd.Maps != null)
            {
                SLMeasureDimensionMap mdm;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Maps))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(MeasureDimensionMap))
                        {
                            mdm = new SLMeasureDimensionMap();
                            mdm.FromMeasureDimensionMap((MeasureDimensionMap)oxr.LoadCurrentElement());
                            this.Maps.Add(mdm);
                        }
                    }
                }
            }
        }
コード例 #4
0
        internal void FromPivotCacheDefinition(PivotCacheDefinition pcd)
        {
            this.SetAllNull();

            if (pcd.Id != null)
            {
                this.Id = pcd.Id.Value;
            }
            if (pcd.Invalid != null)
            {
                this.Invalid = pcd.Invalid.Value;
            }
            if (pcd.SaveData != null)
            {
                this.SaveData = pcd.SaveData.Value;
            }
            if (pcd.RefreshOnLoad != null)
            {
                this.RefreshOnLoad = pcd.RefreshOnLoad.Value;
            }
            if (pcd.OptimizeMemory != null)
            {
                this.OptimizeMemory = pcd.OptimizeMemory.Value;
            }
            if (pcd.EnableRefresh != null)
            {
                this.EnableRefresh = pcd.EnableRefresh.Value;
            }
            if (pcd.RefreshedBy != null)
            {
                this.RefreshedBy = pcd.RefreshedBy.Value;
            }
            if (pcd.RefreshedDate != null)
            {
                this.RefreshedDate = pcd.RefreshedDate.Value;
            }
            if (pcd.BackgroundQuery != null)
            {
                this.BackgroundQuery = pcd.BackgroundQuery.Value;
            }
            if (pcd.MissingItemsLimit != null)
            {
                this.MissingItemsLimit = pcd.MissingItemsLimit.Value;
            }
            if (pcd.CreatedVersion != null)
            {
                this.CreatedVersion = pcd.CreatedVersion.Value;
            }
            if (pcd.RefreshedVersion != null)
            {
                this.RefreshedVersion = pcd.RefreshedVersion.Value;
            }
            if (pcd.MinRefreshableVersion != null)
            {
                this.MinRefreshableVersion = pcd.MinRefreshableVersion.Value;
            }
            if (pcd.RecordCount != null)
            {
                this.RecordCount = pcd.RecordCount.Value;
            }
            if (pcd.UpgradeOnRefresh != null)
            {
                this.UpgradeOnRefresh = pcd.UpgradeOnRefresh.Value;
            }
            if (pcd.IsTupleCache != null)
            {
                this.IsTupleCache = pcd.IsTupleCache.Value;
            }
            if (pcd.SupportSubquery != null)
            {
                this.SupportSubquery = pcd.SupportSubquery.Value;
            }
            if (pcd.SupportAdvancedDrill != null)
            {
                this.SupportAdvancedDrill = pcd.SupportAdvancedDrill.Value;
            }

            if (pcd.CacheSource != null)
            {
                this.CacheSource.FromCacheSource(pcd.CacheSource);
            }

            // doing one by one because it's bloody hindering awkward complicated.

            if (pcd.CacheFields != null)
            {
                SLCacheField cf;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CacheFields))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CacheField))
                        {
                            cf = new SLCacheField();
                            cf.FromCacheField((CacheField)oxr.LoadCurrentElement());
                            this.CacheFields.Add(cf);
                        }
                    }
                }
            }

            if (pcd.CacheHierarchies != null)
            {
                SLCacheHierarchy ch;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CacheHierarchies))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CacheHierarchy))
                        {
                            ch = new SLCacheHierarchy();
                            ch.FromCacheHierarchy((CacheHierarchy)oxr.LoadCurrentElement());
                            this.CacheHierarchies.Add(ch);
                        }
                    }
                }
            }

            if (pcd.Kpis != null)
            {
                SLKpi k;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Kpis))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Kpi))
                        {
                            k = new SLKpi();
                            k.FromKpi((Kpi)oxr.LoadCurrentElement());
                            this.Kpis.Add(k);
                        }
                    }
                }
            }

            if (pcd.TupleCache != null)
            {
                this.TupleCache.FromTupleCache(pcd.TupleCache);
                this.HasTupleCache = true;
            }

            if (pcd.CalculatedItems != null)
            {
                SLCalculatedItem ci;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CalculatedItems))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CalculatedItem))
                        {
                            ci = new SLCalculatedItem();
                            ci.FromCalculatedItem((CalculatedItem)oxr.LoadCurrentElement());
                            this.CalculatedItems.Add(ci);
                        }
                    }
                }
            }

            if (pcd.CalculatedMembers != null)
            {
                SLCalculatedMember cm;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.CalculatedMembers))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(CalculatedMember))
                        {
                            cm = new SLCalculatedMember();
                            cm.FromCalculatedMember((CalculatedMember)oxr.LoadCurrentElement());
                            this.CalculatedMembers.Add(cm);
                        }
                    }
                }
            }

            if (pcd.Dimensions != null)
            {
                SLDimension d;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Dimensions))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(Dimension))
                        {
                            d = new SLDimension();
                            d.FromDimension((Dimension)oxr.LoadCurrentElement());
                            this.Dimensions.Add(d);
                        }
                    }
                }
            }

            if (pcd.MeasureGroups != null)
            {
                SLMeasureGroup mg;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.MeasureGroups))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(MeasureGroup))
                        {
                            mg = new SLMeasureGroup();
                            mg.FromMeasureGroup((MeasureGroup)oxr.LoadCurrentElement());
                            this.MeasureGroups.Add(mg);
                        }
                    }
                }
            }

            if (pcd.Maps != null)
            {
                SLMeasureDimensionMap mdm;
                using (OpenXmlReader oxr = OpenXmlReader.Create(pcd.Maps))
                {
                    while (oxr.Read())
                    {
                        if (oxr.ElementType == typeof(MeasureDimensionMap))
                        {
                            mdm = new SLMeasureDimensionMap();
                            mdm.FromMeasureDimensionMap((MeasureDimensionMap)oxr.LoadCurrentElement());
                            this.Maps.Add(mdm);
                        }
                    }
                }
            }
        }