/// <summary> /// /// </summary> /// <param name="elementRefP"></param> /// <param name="modelRefPtr"></param> /// <param name="className"></param> /// <returns></returns> internal bool HasECClass(IntPtr elementRefP, IntPtr modelRefPtr, string className) { var ecInstances = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); var testClass = Schema.GetClass(className); return(ecInstances.Any(ecInstance => ecInstance.ClassDefinition.Is(testClass))); }
/// <summary> /// Test to see if element has any instances of objects from this schema /// </summary> /// <param name="elementRefP"></param> /// <param name="modelRefPtr"></param> /// <returns></returns> internal bool IsSchemaObjectInstances(IntPtr elementRefP, IntPtr modelRefPtr) { var ecInstances = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); return (ecInstances.Any( ecInstance => ecInstance.ClassDefinition.Schema.IsSamePrimarySchema(Schema) || ecInstance.ClassDefinition.Schema.IsSameSupplementedSchema(Schema))); }
internal void DeleteInstancesOnElement(Element element) { var elementRefP = (IntPtr)element.MdlElementRef(); var modelRefPtr = (IntPtr)element.ModelReference.MdlModelRefP(); var instanceList = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); foreach (IECInstance inst in instanceList) { XmlInstanceDelete.DeleteInstance(inst.InstanceId, modelRefPtr); } }
internal bool HasECInstanceAttached(Element element) { var elementRefP = (IntPtr)element.MdlElementRef(); var modelRefPtr = (IntPtr)element.ModelReference.MdlModelRefP(); var instanceList = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); if (instanceList.Count > 0) { return(true); } return(false); }
internal void DeleteInstancesOnElement(Element element, string strInstanceName) { var elementRefP = (IntPtr)element.MdlElementRef(); var modelRefPtr = (IntPtr)element.ModelReference.MdlModelRefP(); var instanceList = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); foreach (IECInstance inst in instanceList) { if (inst.ClassDefinition.Name == strInstanceName) { XmlInstanceDelete.DeleteInstance(inst.InstanceId, modelRefPtr); } break; } }
internal bool HasECInstanceAttached(Element element, string strInstanceName) { var elementRefP = (IntPtr)element.MdlElementRef(); var modelRefPtr = (IntPtr)element.ModelReference.MdlModelRefP(); var instanceList = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); if (instanceList.Count > 0) { foreach (IECInstance inst in instanceList) { if (inst.ClassDefinition.Name == strInstanceName) { return(true); } } } return(false); }
/// <summary> /// /// </summary> /// <param name="elementRefP"></param> /// <param name="modelRefP"></param> /// <returns></returns> internal ECInstanceList ReadInstancesFromElement(IntPtr elementRefP, IntPtr modelRefP) { return(XmlInstanceRead.ReadInstances(elementRefP, modelRefP)); }
/// <summary> /// /// </summary> /// <param name="elementRefP"></param> /// <param name="modelRefPtr"></param> /// <param name="instanceId"></param> /// <returns></returns> internal bool HasECInstance(IntPtr elementRefP, IntPtr modelRefPtr, string instanceId) { var ecInstances = XmlInstanceRead.ReadInstances(elementRefP, modelRefPtr); return(ecInstances.Any(ecInstance => ecInstance.InstanceId.Equals(instanceId))); }