internal void FromRangeProperties(RangeProperties rp)
        {
            this.SetAllNull();

            if (rp.AutoStart != null) this.AutoStart = rp.AutoStart.Value;
            if (rp.AutoEnd != null) this.AutoEnd = rp.AutoEnd.Value;
            if (rp.GroupBy != null) this.GroupBy = rp.GroupBy.Value;
            if (rp.StartNumber != null) this.StartNumber = rp.StartNumber.Value;
            if (rp.EndNum != null) this.EndNum = rp.EndNum.Value;
            if (rp.StartDate != null) this.StartDate = rp.StartDate.Value;
            if (rp.EndDate != null) this.EndDate = rp.EndDate.Value;
            if (rp.GroupInterval != null) this.GroupInterval = rp.GroupInterval.Value;
        }
        internal void FromFieldGroup(FieldGroup fg)
        {
            SetAllNull();

            if (fg.ParentId != null)
            {
                ParentId = fg.ParentId.Value;
            }
            if (fg.Base != null)
            {
                Base = fg.Base.Value;
            }

            using (var oxr = OpenXmlReader.Create(fg))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(RangeProperties))
                    {
                        RangeProperties.FromRangeProperties((RangeProperties)oxr.LoadCurrentElement());
                        HasRangeProperties = true;
                    }
                    else if (oxr.ElementType == typeof(DiscreteProperties))
                    {
                        var       dp = (DiscreteProperties)oxr.LoadCurrentElement();
                        FieldItem fi;
                        using (var oxrDiscrete = OpenXmlReader.Create(dp))
                        {
                            while (oxrDiscrete.Read())
                            {
                                if (oxrDiscrete.ElementType == typeof(FieldItem))
                                {
                                    fi = (FieldItem)oxrDiscrete.LoadCurrentElement();
                                    DiscreteProperties.Add(fi.Val);
                                }
                            }
                        }
                    }
                    else if (oxr.ElementType == typeof(GroupItems))
                    {
                        GroupItems.FromGroupItems((GroupItems)oxr.LoadCurrentElement());
                        HasGroupItems = true;
                    }
                }
            }
        }
        internal SLFieldGroup Clone()
        {
            var fg = new SLFieldGroup();

            fg.ParentId = ParentId;
            fg.Base     = Base;

            fg.HasRangeProperties = HasRangeProperties;
            fg.RangeProperties    = RangeProperties.Clone();

            fg.DiscreteProperties = new List <uint>();
            foreach (var i in DiscreteProperties)
            {
                fg.DiscreteProperties.Add(i);
            }

            fg.HasGroupItems = HasGroupItems;
            fg.GroupItems    = GroupItems.Clone();

            return(fg);
        }
        internal FieldGroup ToFieldGroup()
        {
            var fg = new FieldGroup();

            if (ParentId != null)
            {
                fg.ParentId = ParentId.Value;
            }
            if (Base != null)
            {
                fg.Base = Base.Value;
            }

            if (HasRangeProperties)
            {
                fg.Append(RangeProperties.ToRangeProperties());
            }

            if (DiscreteProperties.Count > 0)
            {
                var dp = new DiscreteProperties();
                dp.Count = (uint)DiscreteProperties.Count;
                foreach (var i in DiscreteProperties)
                {
                    dp.Append(new FieldItem {
                        Val = i
                    });
                }

                fg.Append(dp);
            }

            if (HasGroupItems)
            {
                fg.Append(GroupItems.ToGroupItems());
            }

            return(fg);
        }
        internal RangeProperties ToRangeProperties()
        {
            RangeProperties rp = new RangeProperties();

            if (this.AutoStart != true)
            {
                rp.AutoStart = this.AutoStart;
            }
            if (this.AutoEnd != true)
            {
                rp.AutoEnd = this.AutoEnd;
            }
            if (this.GroupBy != GroupByValues.Range)
            {
                rp.GroupBy = this.GroupBy;
            }
            if (this.StartNumber != null)
            {
                rp.StartNumber = this.StartNumber.Value;
            }
            if (this.EndNum != null)
            {
                rp.EndNum = this.EndNum.Value;
            }
            if (this.StartDate != null)
            {
                rp.StartDate = this.StartDate.Value;
            }
            if (this.EndDate != null)
            {
                rp.EndDate = this.EndDate.Value;
            }
            if (this.GroupInterval != 1)
            {
                rp.GroupInterval = this.GroupInterval;
            }

            return(rp);
        }
Пример #6
0
        internal RangeProperties ToRangeProperties()
        {
            var rp = new RangeProperties();

            if (AutoStart != true)
            {
                rp.AutoStart = AutoStart;
            }
            if (AutoEnd != true)
            {
                rp.AutoEnd = AutoEnd;
            }
            if (GroupBy != GroupByValues.Range)
            {
                rp.GroupBy = GroupBy;
            }
            if (StartNumber != null)
            {
                rp.StartNumber = StartNumber.Value;
            }
            if (EndNum != null)
            {
                rp.EndNum = EndNum.Value;
            }
            if (StartDate != null)
            {
                rp.StartDate = StartDate.Value;
            }
            if (EndDate != null)
            {
                rp.EndDate = EndDate.Value;
            }
            if (GroupInterval != 1)
            {
                rp.GroupInterval = GroupInterval;
            }

            return(rp);
        }
        internal void FromRangeProperties(RangeProperties rp)
        {
            this.SetAllNull();

            if (rp.AutoStart != null)
            {
                this.AutoStart = rp.AutoStart.Value;
            }
            if (rp.AutoEnd != null)
            {
                this.AutoEnd = rp.AutoEnd.Value;
            }
            if (rp.GroupBy != null)
            {
                this.GroupBy = rp.GroupBy.Value;
            }
            if (rp.StartNumber != null)
            {
                this.StartNumber = rp.StartNumber.Value;
            }
            if (rp.EndNum != null)
            {
                this.EndNum = rp.EndNum.Value;
            }
            if (rp.StartDate != null)
            {
                this.StartDate = rp.StartDate.Value;
            }
            if (rp.EndDate != null)
            {
                this.EndDate = rp.EndDate.Value;
            }
            if (rp.GroupInterval != null)
            {
                this.GroupInterval = rp.GroupInterval.Value;
            }
        }
        internal RangeProperties ToRangeProperties()
        {
            RangeProperties rp = new RangeProperties();
            if (this.AutoStart != true) rp.AutoStart = this.AutoStart;
            if (this.AutoEnd != true) rp.AutoEnd = this.AutoEnd;
            if (this.GroupBy != GroupByValues.Range) rp.GroupBy = this.GroupBy;
            if (this.StartNumber != null) rp.StartNumber = this.StartNumber.Value;
            if (this.EndNum != null) rp.EndNum = this.EndNum.Value;
            if (this.StartDate != null) rp.StartDate = this.StartDate.Value;
            if (this.EndDate != null) rp.EndDate = this.EndDate.Value;
            if (this.GroupInterval != 1) rp.GroupInterval = this.GroupInterval;

            return rp;
        }