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 FieldGroup ToFieldGroup() { FieldGroup fg = new FieldGroup(); if (this.ParentId != null) { fg.ParentId = this.ParentId.Value; } if (this.Base != null) { fg.Base = this.Base.Value; } if (this.HasRangeProperties) { fg.Append(this.RangeProperties.ToRangeProperties()); } if (this.DiscreteProperties.Count > 0) { DiscreteProperties dp = new DiscreteProperties(); dp.Count = (uint)this.DiscreteProperties.Count; foreach (uint i in this.DiscreteProperties) { dp.Append(new FieldItem() { Val = i }); } fg.Append(dp); } if (this.HasGroupItems) { fg.Append(this.GroupItems.ToGroupItems()); } 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 FieldGroup ToFieldGroup() { FieldGroup fg = new FieldGroup(); if (this.ParentId != null) fg.ParentId = this.ParentId.Value; if (this.Base != null) fg.Base = this.Base.Value; if (this.HasRangeProperties) { fg.Append(this.RangeProperties.ToRangeProperties()); } if (this.DiscreteProperties.Count > 0) { DiscreteProperties dp = new DiscreteProperties(); dp.Count = (uint)this.DiscreteProperties.Count; foreach (uint i in this.DiscreteProperties) { dp.Append(new FieldItem() { Val = i }); } fg.Append(dp); } if (this.HasGroupItems) { fg.Append(this.GroupItems.ToGroupItems()); } return fg; }