Beispiel #1
0
 public virtual void SetVisibleToAt(LSP __item, int __index)
 {
     if (__item == null)
     {
         visibleTo[__index].RemovePrivateTemplates(this);
     }
     else
     {
         visibleTo[__index] = __item;
         if (!__item.PrivateTemplates.Contains(this))
         {
             __item.AddPrivateTemplates(this);
         }
     }
 }
Beispiel #2
0
 public virtual void AddVisibleTo(LSP __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!visibleTo.Contains(__item))
     {
         InternalAddVisibleTo(__item);
     }
     if (!__item.PrivateTemplates.Contains(this))
     {
         __item.AddPrivateTemplates(this);
     }
 }
Beispiel #3
0
 public virtual void AddAtIndexVisibleTo(int index, LSP __item)
 {
     if (__item == null)
     {
         return;
     }
     if (!visibleTo.Contains(__item))
     {
         visibleTo.Insert(index, __item);
     }
     if (!__item.PrivateTemplates.Contains(this))
     {
         __item.AddPrivateTemplates(this);
     }
 }
Beispiel #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 [LSP] instance to use as the destination.</param>
/// <returns>A copy of the object</returns>
        public virtual LSP Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, LSP copy = null)
        {
            if (copiedObjects == null)
            {
                copiedObjects = new Hashtable();
            }
            if (copy == null && copiedObjects.Contains(this))
            {
                return((LSP)copiedObjects[this]);
            }
            copy = copy ?? new LSP();
            if (!asNew)
            {
                copy.TransientId = this.TransientId;
                copy.Id          = this.Id;
            }
            copy.LSPName        = this.LSPName;
            copy.LSPDescription = this.LSPDescription;
            if (!copiedObjects.Contains(this))
            {
                copiedObjects.Add(this, copy);
            }
            copy.lSPUsers = new List <LSPUser>();
            if (deep && this.lSPUsers != null)
            {
                foreach (var __item in this.lSPUsers)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddLSPUsers(__item);
                        }
                        else
                        {
                            copy.AddLSPUsers(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddLSPUsers((LSPUser)copiedObjects[__item]);
                    }
                }
            }
            copy.privateTemplates = new List <ScheduledRouteTemplate>();
            if (deep && this.privateTemplates != null)
            {
                foreach (var __item in this.privateTemplates)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddPrivateTemplates(__item);
                        }
                        else
                        {
                            copy.AddPrivateTemplates(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddPrivateTemplates((ScheduledRouteTemplate)copiedObjects[__item]);
                    }
                }
            }
            copy.workContracts = new List <WorkContract>();
            if (deep && this.workContracts != null)
            {
                foreach (var __item in this.workContracts)
                {
                    if (!copiedObjects.Contains(__item))
                    {
                        if (asNew && reuseNestedObjects)
                        {
                            copy.AddWorkContracts(__item);
                        }
                        else
                        {
                            copy.AddWorkContracts(__item.Copy(deep, copiedObjects, asNew));
                        }
                    }
                    else
                    {
                        copy.AddWorkContracts((WorkContract)copiedObjects[__item]);
                    }
                }
            }
            return(copy);
        }