private static ConditionResult VerifyCondition(List <object> objects, HasId idCondition) { ConditionResult result = new ConditionResult() { Condition = idCondition }; foreach (var obj in objects) { IBHoMObject bhomObj = obj as IBHoMObject; if (bhomObj == null || idCondition.Ids.Contains(bhomObj.FindFragment <IAdapterId>()?.Id)) { result.PassedObjects.Add(obj); result.Pattern.Add(true); } else { result.FailedObjects.Add(obj); result.FailInfo.Add($"{(string.IsNullOrWhiteSpace(idCondition.Clause) ? "" : idCondition.Clause + " failed: ")}" + $"does not have the requested id."); result.Pattern.Add(false); } } return(result); }
private void BeforeSave(HasId document) { if (document.GetId().IsEmpty()) { document.SetId(Guid.NewGuid().ToString()); } }
public ChangeIdTool(HasId elementWithTargetId, string newId, bool updateTree, bool reloadPanel) { this.elementWithTargetId = elementWithTargetId; this.id = newId; this.oldId = elementWithTargetId.getId(); this.updateTree = updateTree; this.reloadPanel = reloadPanel; this.controller = Controller.getInstance(); }
public void HasId_ObjectAndTypeId_AreEqual() { var hasId = new HasId() { Id = 100500 }; Assert.True(((IHasId) hasId).Id?.Equals(100500) == true); }
public void HasId_IsNew_False() { var hasId = new HasId() { Id = 100500 }; Assert.False(hasId.IsNew()); }
public void HasId_ObjectAndTypeId_AreEqual() { var hasId = new HasId() { Id = 100500 }; Assert.True(((IHasId)hasId).Id?.Equals(100500) == true); }
public void HasId_IsNew_False() { var hasId = new HasId() { Id = 100500 }; Assert.False(hasId.IsNew()); }
public override int GetHashCode() { unchecked { var hashCode = HasName.GetHashCode(); hashCode = (hashCode * 397) ^ HasTag.GetHashCode(); hashCode = (hashCode * 397) ^ HasId.GetHashCode(); hashCode = (hashCode * 397) ^ HasHelpContextId.GetHashCode(); hashCode = (hashCode * 397) ^ HasBitFlags.GetHashCode(); hashCode = (hashCode * 397) ^ HasObjectStreamSize.GetHashCode(); hashCode = (hashCode * 397) ^ HasTabIndex.GetHashCode(); hashCode = (hashCode * 397) ^ HasClsidCacheIndex.GetHashCode(); hashCode = (hashCode * 397) ^ HasPosition.GetHashCode(); hashCode = (hashCode * 397) ^ HasGroupId.GetHashCode(); hashCode = (hashCode * 397) ^ HasControlTipText.GetHashCode(); hashCode = (hashCode * 397) ^ HasRuntimeLicKey.GetHashCode(); hashCode = (hashCode * 397) ^ HasControlSource.GetHashCode(); hashCode = (hashCode * 397) ^ HasRowSource.GetHashCode(); return(hashCode); } }
public static bool IsRemoved(this HasId element) { return(Game.Instance.GameState.GetRemovedElements().Contains(element.getId())); }
/** * Default constructor. Does not update neither tree nor panel * * @param elementWithTargetId * @param newId */ public ChangeIdTool(HasId elementWithTargetId, string newId) : this(elementWithTargetId, newId, false, true) { }
public static bool HasId(this HasId target, object id) { return(Equals(target.GetId(), id)); }
public void HasId_IsNew_True() { var hasId = new HasId(); Assert.True(hasId.IsNew()); }
public void HasId_IsNew_True() { var hasId = new HasId(); Assert.True(hasId.IsNew()); }