internal SLCacheField Clone()
        {
            var cf = new SLCacheField();

            cf.Name                = Name;
            cf.Caption             = Caption;
            cf.PropertyName        = PropertyName;
            cf.ServerField         = ServerField;
            cf.UniqueList          = UniqueList;
            cf.NumberFormatId      = NumberFormatId;
            cf.Formula             = Formula;
            cf.SqlType             = SqlType;
            cf.Hierarchy           = Hierarchy;
            cf.Level               = Level;
            cf.DatabaseField       = DatabaseField;
            cf.MappingCount        = MappingCount;
            cf.MemberPropertyField = MemberPropertyField;

            cf.HasSharedItems = HasSharedItems;
            cf.SharedItems    = SharedItems.Clone();

            cf.HasFieldGroup = HasFieldGroup;
            cf.FieldGroup    = FieldGroup.Clone();

            cf.MemberPropertiesMaps = new List <int>();
            foreach (var i in MemberPropertiesMaps)
            {
                cf.MemberPropertiesMaps.Add(i);
            }

            return(cf);
        }
Esempio n. 2
0
        internal void FromPivotCacheDefinition(PivotCacheDefinition pcd)
        {
            SetAllNull();

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

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

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

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

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

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

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

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

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

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

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

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