Example #1
0
        public bool RemovePart(string id)
        {
            if (id == this.Id)
            {
                return(false);
            }

            IContentPart toRemove = null;

            foreach (IContentPart p in this.Parts)
            {
                if (p.Id == id)
                {
                    toRemove = p;
                    break;
                }
                if (p is IColumnContainer)
                {
                    IColumnContainer container = p as IColumnContainer;
                    bool             result    = container.RemovePart(id);
                    if (result)
                    {
                        return(result);
                    }
                }
            }

            if (toRemove != null)
            {
                this.Parts.Remove(toRemove);
            }
            return(true);
        }
        public bool RemovePart(string partId)
        {
            foreach (Column c in this._Columns)
            {
                IContentPart toRemove = null;

                foreach (IContentPart p in c.Parts)
                {
                    if (p.Id == partId)
                    {
                        toRemove = p;
                        break;
                    }
                    if (p is IColumnContainer)
                    {
                        IColumnContainer container = p as IColumnContainer;
                        bool             result    = container.RemovePart(partId);
                        if (result)
                        {
                            return(true);
                        }
                    }
                }

                if (toRemove != null)
                {
                    c.Parts.Remove(toRemove);
                    return(true);
                }
            }

            return(false);
        }