Ejemplo n.º 1
0
 public virtual void RemoveOwnedFerries(Ferry __item)
 {
     if (__item != null && ownedFerries != null && ownedFerries.Contains(__item))
     {
         ownedFerries.Remove(__item);
         __item.MarineAgency = null;
     }
 }
Ejemplo n.º 2
0
 public virtual void AddOwnedFerries(Ferry __item)
 {
     if (__item != null && ownedFerries != null && !ownedFerries.Contains(__item))
     {
         ownedFerries.Add(__item);
         if (__item.MarineAgency != this)
         {
             __item.MarineAgency = this;
         }
     }
 }
Ejemplo n.º 3
0
 public virtual void SetOwnedFerriesAt(Ferry __item, int __index)
 {
     if (__item == null)
     {
         ownedFerries[__index].MarineAgency = null;
     }
     else
     {
         ownedFerries[__index] = __item;
         if (__item.MarineAgency != this)
         {
             __item.MarineAgency = this;
         }
     }
 }
Ejemplo n.º 4
0
/// <summary>
/// Copies the current object to a new instance
/// </summary>
/// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param>
/// <param name="copiedObjects">Objects that should be reused</param>
/// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param>
/// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param>
/// <param name="copy">Optional - An existing [Ferry] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual Ferry Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, Ferry copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((Ferry)copiedObjects[this]);
            }
            copy = copy ?? new Ferry();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
            }
            copy.Name       = this.Name;
            copy.FastCraft  = this.FastCraft;
            copy.ForthCRSId = this.ForthCRSId;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            if (deep && this.marineAgency != null)
            {
                if (!copiedObjects.Contains(this.marineAgency))
                {
                    if (asNew && reuseNestedObjects)
                    {
                        copy.MarineAgency = this.MarineAgency;
                    }
                    else if (asNew)
                    {
                        copy.MarineAgency = this.MarineAgency.Copy(deep, copiedObjects, true);
                    }
                    else
                    {
                        copy.marineAgency = this.marineAgency.Copy(deep, copiedObjects, false);
                    }
                }
                else
                {
                    if (asNew)
                    {
                        copy.MarineAgency = (MarineAgency)copiedObjects[this.MarineAgency];
                    }
                    else
                    {
                        copy.marineAgency = (MarineAgency)copiedObjects[this.MarineAgency];
                    }
                }
            }
            base.Copy(deep, copiedObjects, asNew, reuseNestedObjects, copy);
            return(copy);
        }