public void AddAttribute(string AttId, string Value, string AttachmentLevel) { bool Exists = false; foreach (var item in this.JsonStruct.Attributes) { if (item.Id == AttId) { Exists = true; SDMXJsonValue Val = new SDMXJsonValue(); Val.Id = Value; if (!(item.ExistValue(Val))) { item.Values.Add(Val); break; } } } if (!Exists) { SDMXJsonAttributes Att = new SDMXJsonAttributes(); Att.Id = AttId; Att.AttachmentLevel = AttachmentLevel; this.JsonStruct.Attributes.Add(Att); AddAttribute(AttId, Value, AttachmentLevel); } }
public void AddObsValue(string TimeValue) { bool Exists = false; if (!(this.JsonStruct.Observation.Values == null)) { foreach (var item in this.JsonStruct.Observation.Values) { if (item.Id == TimeValue) { Exists = true; break; } } } if (!Exists) { SDMXJsonValue Val = new SDMXJsonValue(); Val.Id = TimeValue; if (!(this.JsonStruct.Observation.ExistValue(Val))) { if (this.JsonStruct.Observation.Values.Count > 0) { Val.Index = this.JsonStruct.Observation.GetLastIndex(Val) + 1; } else { Val.Index = this.JsonStruct.Observation.GetLastIndex(Val); } this.JsonStruct.Observation.Values.Add(Val); } } }
public void AddSerie(string DimId, string Value, string KeyPosition, bool isFrequency) { bool Exists = false; foreach (var item in this.JsonStruct.Series) { if (item.Id == DimId) { Exists = true; SDMXJsonValue Val = new SDMXJsonValue(); Val.Id = Value; if (!(item.ExistValue(Val))) { if (item.Values.Count > 0) { Val.Index = item.GetLastIndex(Val) + 1; } else { Val.Index = item.GetLastIndex(Val); } item.Values.Add(Val); break; } } } if (!Exists) { SDMXJsonDimension Serie = new SDMXJsonDimension(); Serie.Id = DimId; Serie.KeyPosition = KeyPosition; if (isFrequency) { Serie.Role = "frequency"; } this.JsonStruct.Series.Add(Serie); AddSerie(DimId, Value, KeyPosition, isFrequency); } }