Example #1
0
        /// <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)));
        }
Example #2
0
        /// <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)));
        }
Example #3
0
        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);
            }
        }
Example #4
0
        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);
        }
Example #5
0
        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;
            }
        }
Example #6
0
        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);
        }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="elementRefP"></param>
 /// <param name="modelRefP"></param>
 /// <returns></returns>
 internal ECInstanceList ReadInstancesFromElement(IntPtr elementRefP, IntPtr modelRefP)
 {
     return(XmlInstanceRead.ReadInstances(elementRefP, modelRefP));
 }
Example #8
0
        /// <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)));
        }