示例#1
0
        private IDirectAccessIterator <IdentificationUnit> _identificationUnitIterator;//Dieser iteriert im Gegensatz zu den anderen KLassen in Datamanagement nur auf dem TopLevel


        #endregion

        #region Constructor

        internal IdentificationUnits(CollectionSpecimen cs)
        {
            if (cs != null)
            {
                this._collectionSpecimen    = cs;
                _identificationUnitIterator = cs.IdentificationUnits;
                _identificationUnitIterator.Reset();
                this._currentIdentificationUnit = _identificationUnitIterator.First();
                if (this._currentIdentificationUnit != null)
                {
                    while (this._currentIdentificationUnit.RelatedUnitID != null)
                    {
                        try
                        {
                            this._currentIdentificationUnit = this.Next;
                        }
                        catch (DataFunctionsException)
                        {
                            this._currentIdentificationUnit = null;
                        }
                    }
                }
                //this._identificationUnitBrotherIterator = this._identificationUnitIterator;
            }
        }
        private IDirectAccessIterator<IdentificationUnit> _identificationUnitIterator; //Dieser iteriert im Gegensatz zu den anderen KLassen in Datamanagement nur auf dem TopLevel

        #endregion Fields

        #region Constructors

        internal IdentificationUnits(CollectionSpecimen cs)
        {
            if (cs != null)
            {
                this._collectionSpecimen = cs;
                _identificationUnitIterator = cs.IdentificationUnits;
                _identificationUnitIterator.Reset();
                this._currentIdentificationUnit = _identificationUnitIterator.First();
                if (this._currentIdentificationUnit != null)
                {
                    while (this._currentIdentificationUnit.RelatedUnitID != null)
                    {
                        try
                        {
                            this._currentIdentificationUnit = this.Next;
                        }
                        catch (DataFunctionsException)
                        {
                            this._currentIdentificationUnit = null;
                        }
                    }
                }
                //this._identificationUnitBrotherIterator = this._identificationUnitIterator;
            }
        }
 internal Specimen(CollectionEvent ce)
 {
     if (ce != null)
     {
         _parent = ce;
         _csIterator = ce.CollectionSpecimen;
         _csIterator.Reset();
         this.Current = _csIterator.First();
     }
 }
示例#4
0
 internal Specimen(CollectionEvent ce)
 {
     if (ce != null)
     {
         _parent     = ce;
         _csIterator = ce.CollectionSpecimen;
         _csIterator.Reset();
         this.Current = _csIterator.First();
     }
 }
示例#5
0
            private void bottomUp(ISerializableObject iso, List <ISerializableObject> parents)
            {
                if (iso.GetType().Equals(typeof(IdentificationUnitAnalysis)))
                {
                    IdentificationUnitAnalysis iua = (IdentificationUnitAnalysis)iso;
                    IdentificationUnit         iu  = iua.IdentificationUnit;
                    if (iu != null)
                    {
                        parents.Add(iu);
                        bottomUp(iu, parents);
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                else if (iso.GetType().Equals(typeof(IdentificationUnit)))
                {
                    IdentificationUnit iu = (IdentificationUnit)iso;

                    /*
                     * IDirectAccessIterator<Identification> identifications = iu.Identifications;
                     * short i = 0;
                     * Identification ident = null;
                     * foreach (Identification id in identifications)
                     * {
                     *  if (id.IdentificationSequence != null && id.IdentificationSequence > i)
                     *  {
                     *      i = (short)id.IdentificationSequence;
                     *      ident = id;
                     *  }
                     * }
                     * if (ident != null)
                     *  parents.Add(ident);*/
                    IdentificationUnit relatedUnit = iu.RelatedUnit;
                    if (relatedUnit != null)
                    {
                        parents.Add(relatedUnit);
                        bottomUp(relatedUnit, parents);
                    }
                    else
                    {
                        CollectionSpecimen spec = iu.CollectionSpecimen;
                        if (spec != null)
                        {
                            parents.Add(spec);
                            bottomUp(spec, parents);
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }
                }
                else if (iso.GetType().Equals(typeof(CollectionSpecimen)))
                {
                    CollectionSpecimen spec = (CollectionSpecimen)iso;
                    CollectionAgent    ca   = spec.CollectionAgent.First();
                    if (ca != null)
                    {
                        parents.Add(ca);
                    }
                    CollectionEvent ce = spec.CollectionEvent;
                    if (ce != null)
                    {
                        parents.Add(ce);
                        bottomUp(ce, parents);
                    }
                    else
                    {
                        this.root = spec;
                    };                      //Warnung dass das Specimen nicht angezeigt werden kann
                }
                else if (iso.GetType().Equals(typeof(CollectionEvent)))
                {
                    CollectionEvent ce = (CollectionEvent)iso;
                    IDirectAccessIterator <CollectionEventLocalisation> locations = ce.CollectionEventLocalisation;
                    foreach (CollectionEventLocalisation loc in locations)
                    {
                        parents.Add(loc);
                    }
                    IDirectAccessIterator <CollectionEventProperty> properties = ce.CollectionEventProperties;
                    foreach (CollectionEventProperty prop in properties)
                    {
                        parents.Add(prop);
                    }
                    CollectionEventSeries cs = ce.CollectionEventSeries;
                    if (cs != null)
                    {
                        parents.Add(cs);
                        this.root = cs;
                    }
                    else
                    {
                        this.root = ce;
                    }
                }
                else if (iso.GetType().Equals(typeof(CollectionEventSeries)))
                {
                    CollectionEventSeries cs = (CollectionEventSeries)iso;
                    this.root = cs;
                }
            }
示例#6
0
 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);
         }
     }
 }