internal SLDateTimeItem Clone() { SLDateTimeItem dti = new SLDateTimeItem(); dti.Val = this.Val; dti.Unused = this.Unused; dti.Calculated = this.Calculated; dti.Caption = this.Caption; dti.PropertyCount = this.PropertyCount; dti.MemberPropertyIndexes = new List <int>(); foreach (int i in this.MemberPropertyIndexes) { dti.MemberPropertyIndexes.Add(i); } return(dti); }
internal void FromGroupItems(GroupItems gis) { this.SetAllNull(); SLMissingItem mi; SLNumberItem ni; SLBooleanItem bi; SLErrorItem ei; SLStringItem si; SLDateTimeItem dti; using (OpenXmlReader oxr = OpenXmlReader.Create(gis)) { while (oxr.Read()) { // make sure to add to Items first, because of the Count thing. if (oxr.ElementType == typeof(MissingItem)) { mi = new SLMissingItem(); mi.FromMissingItem((MissingItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Missing, this.MissingItems.Count)); this.MissingItems.Add(mi); } else if (oxr.ElementType == typeof(NumberItem)) { ni = new SLNumberItem(); ni.FromNumberItem((NumberItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Number, this.NumberItems.Count)); this.NumberItems.Add(ni); } else if (oxr.ElementType == typeof(BooleanItem)) { bi = new SLBooleanItem(); bi.FromBooleanItem((BooleanItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Boolean, this.BooleanItems.Count)); this.BooleanItems.Add(bi); } else if (oxr.ElementType == typeof(ErrorItem)) { ei = new SLErrorItem(); ei.FromErrorItem((ErrorItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Error, this.ErrorItems.Count)); this.ErrorItems.Add(ei); } else if (oxr.ElementType == typeof(StringItem)) { si = new SLStringItem(); si.FromStringItem((StringItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.String, this.StringItems.Count)); this.StringItems.Add(si); } else if (oxr.ElementType == typeof(DateTimeItem)) { dti = new SLDateTimeItem(); dti.FromDateTimeItem((DateTimeItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.DateTime, this.DateTimeItems.Count)); this.DateTimeItems.Add(dti); } } } }
internal void FromSharedItems(SharedItems sis) { this.SetAllNull(); if (sis.ContainsSemiMixedTypes != null) { this.ContainsSemiMixedTypes = sis.ContainsSemiMixedTypes.Value; } if (sis.ContainsNonDate != null) { this.ContainsNonDate = sis.ContainsNonDate.Value; } if (sis.ContainsDate != null) { this.ContainsDate = sis.ContainsDate.Value; } if (sis.ContainsString != null) { this.ContainsString = sis.ContainsString.Value; } if (sis.ContainsBlank != null) { this.ContainsBlank = sis.ContainsBlank.Value; } if (sis.ContainsMixedTypes != null) { this.ContainsMixedTypes = sis.ContainsMixedTypes.Value; } if (sis.ContainsNumber != null) { this.ContainsNumber = sis.ContainsNumber.Value; } if (sis.ContainsInteger != null) { this.ContainsInteger = sis.ContainsInteger.Value; } if (sis.MinValue != null) { this.MinValue = sis.MinValue.Value; } if (sis.MaxValue != null) { this.MaxValue = sis.MaxValue.Value; } if (sis.MinDate != null) { this.MinDate = sis.MinDate.Value; } if (sis.MaxDate != null) { this.MaxDate = sis.MaxDate.Value; } //count if (sis.LongText != null) { this.LongText = sis.LongText.Value; } SLMissingItem mi; SLNumberItem ni; SLBooleanItem bi; SLErrorItem ei; SLStringItem si; SLDateTimeItem dti; using (OpenXmlReader oxr = OpenXmlReader.Create(sis)) { while (oxr.Read()) { // make sure to add to Items first, because of the Count thing. if (oxr.ElementType == typeof(MissingItem)) { mi = new SLMissingItem(); mi.FromMissingItem((MissingItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Missing, this.MissingItems.Count)); this.MissingItems.Add(mi); } else if (oxr.ElementType == typeof(NumberItem)) { ni = new SLNumberItem(); ni.FromNumberItem((NumberItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Number, this.NumberItems.Count)); this.NumberItems.Add(ni); } else if (oxr.ElementType == typeof(BooleanItem)) { bi = new SLBooleanItem(); bi.FromBooleanItem((BooleanItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Boolean, this.BooleanItems.Count)); this.BooleanItems.Add(bi); } else if (oxr.ElementType == typeof(ErrorItem)) { ei = new SLErrorItem(); ei.FromErrorItem((ErrorItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.Error, this.ErrorItems.Count)); this.ErrorItems.Add(ei); } else if (oxr.ElementType == typeof(StringItem)) { si = new SLStringItem(); si.FromStringItem((StringItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.String, this.StringItems.Count)); this.StringItems.Add(si); } else if (oxr.ElementType == typeof(DateTimeItem)) { dti = new SLDateTimeItem(); dti.FromDateTimeItem((DateTimeItem)oxr.LoadCurrentElement()); this.Items.Add(new SLSharedGroupItemsTypeIndexPair(SLSharedGroupItemsType.DateTime, this.DateTimeItems.Count)); this.DateTimeItems.Add(dti); } } } }