/// <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) { TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument); CurrentDBDocument.Delete(ElementBinder.GetIdForUUID(CurrentDBDocument, element)); TransactionManager.Instance.TransactionTaskDone(); }
public void DeleteElement(ElementId element) { TransactionManager.Instance.EnsureInTransaction(CurrentDBDocument); try { CurrentDBDocument.Delete(element); } catch (Exception e) { LogError(e); } TransactionManager.Instance.TransactionTaskDone(); }
/// <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(); } }
/// <summary> /// Determine if Element exists in the current document /// </summary> /// <param name="id"></param> /// <returns></returns> public bool ElementExistsInDocument(ElementUUID id) { Element e; return(CurrentDBDocument.TryGetElement(id.UUID, out e)); }