private void topDown(ISerializableObject iso, List <ISerializableObject> children) { if (iso.GetType().Equals(typeof(CollectionEventSeries))) { CollectionEventSeries cs = (CollectionEventSeries)iso; IDirectAccessIterator <CollectionEvent> events = cs.CollectionEvents; foreach (CollectionEvent ce in events) { children.Add(ce); topDown(ce, children); } } if (iso.GetType().Equals(typeof(CollectionEvent))) { CollectionEvent ce = (CollectionEvent)iso; IDirectAccessIterator <CollectionEventLocalisation> locations = ce.CollectionEventLocalisation; foreach (CollectionEventLocalisation loc in locations) { children.Add(loc); } IDirectAccessIterator <CollectionEventProperty> properties = ce.CollectionEventProperties; foreach (CollectionEventProperty prop in properties) { children.Add(prop); } IDirectAccessIterator <CollectionSpecimen> specimen = ce.CollectionSpecimen; foreach (CollectionSpecimen spec in specimen) { children.Add(spec); topDown(spec, children); } } if (iso.GetType().Equals(typeof(CollectionSpecimen))) { CollectionSpecimen spec = (CollectionSpecimen)iso; CollectionAgent ca = spec.CollectionAgent.First(); if (ca != null) { children.Add(ca); } IDirectAccessIterator <CollectionProject> projects = spec.CollectionProject; foreach (CollectionProject pr in projects) { children.Add(pr); } IDirectAccessIterator <IdentificationUnit> units = spec.IdentificationUnits; foreach (IdentificationUnit iu in units) { if (iu.RelatedUnit == null)//Hier kann der Aufwand optimiert werden indem gleich alle IdentificationUnits angehängt werden, alerdings muss dann der Fall von einer IU als Startpunkt gesondert behandelt werden { children.Add(iu); topDown(iu, children); } } } if (iso.GetType().Equals(typeof(IdentificationUnit))) { IdentificationUnit iu = (IdentificationUnit)iso; IDirectAccessIterator <IdentificationUnitAnalysis> analyses = iu.IdentificationUnitAnalysis; IDirectAccessIterator <IdentificationUnitGeoAnalysis> geoAnalyses = iu.IdentificationUnitGeoAnalysis; IDirectAccessIterator <Identification> ids = iu.Identifications; foreach (IdentificationUnitAnalysis iua in analyses) { children.Add(iua); } foreach (IdentificationUnitGeoAnalysis iuga in geoAnalyses) { children.Add(iuga); } foreach (Identification id in ids) { children.Add(id); } IDirectAccessIterator <IdentificationUnit> units = iu.ChildUnits; foreach (IdentificationUnit childUnit in units) { children.Add(childUnit); topDown(childUnit, children); } } }