Ejemplo n.º 1
0
        /// <summary>
        /// Delete an element from the current document given the ElementUUID
        /// </summary>
        /// <param name="element">The UUID of the element to delete</param>
        public void DeleteElement(ElementUUID element)
        {
            ElementId id = ElementBinder.GetIdForUUID(CurrentDBDocument, element);

            if (null != id)
            {
                TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument);
                try
                {
                    CurrentDBDocument.Delete(id);
                }
                catch (Exception e)
                {
                    var ele = CurrentDBDocument.GetElement(id);
                    throw new ArgumentException(String.Format("This Element {0} {1} cannot be deleted", ele.ToString(), ele.Name));
                }

                TransactionManager.Instance.TransactionTaskDone();
            }
        }