Example #1
0
        /// <summary>
        /// Gets the destinations on this procedure.
        /// </summary>
        /// <returns>List of destinations</returns>
        public List <MaterialDestination> GetDestinations()
        {
            List <MaterialDestination> destinations = new List <MaterialDestination>();

            // Get the procedure's properties
            PropertyInfo[] propertyInfos = this.GetType().GetProperties();
            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                // Is this property a MaterialDestination ?
                if (propertyInfo.PropertyType.IsSubclassOf(typeof(MaterialDestination)) || propertyInfo.PropertyType == typeof(MaterialDestination))
                {
                    // If so then add it to the list of destinations ?
                    System.Object getValue = propertyInfo.GetValue(this, null);

                    if (getValue == null)
                    {
                        MaterialDestination destination = new MaterialDestination();
                        propertyInfo.SetValue(this, destination, null);
                        destinations.Add(destination);
                    }
                    else if (getValue is MaterialDestination)
                    {
                        destinations.Add(getValue as MaterialDestination);
                    }
                }
                // Is the property a list of objects ?
                else if (propertyInfo.PropertyType.IsArray)
                {
                    System.Object getValue = propertyInfo.GetValue(this, null);
                    if (getValue != null)
                    {
                        // Check each object to see if it is a MaterialDestination
                        foreach (Object thisElement in getValue as Array)
                        {
                            if (thisElement is MaterialDestination)
                            {
                                destinations.Add(thisElement as MaterialDestination);
                            }
                        }
                    }
                }
            }

            return(destinations);
        }
Example #2
0
        /// <summary>
        /// Gets the destinations on this procedure.
        /// </summary>
        /// <returns>List of destinations</returns>
        public List<MaterialDestination> GetDestinations()
        {
            List<MaterialDestination> destinations = new List<MaterialDestination>();

            // Get the procedure's properties
            PropertyInfo[] propertyInfos = this.GetType().GetProperties();
            foreach (PropertyInfo propertyInfo in propertyInfos)
            {
                // Is this property a MaterialDestination ?
                if (propertyInfo.PropertyType.IsSubclassOf(typeof(MaterialDestination)) || propertyInfo.PropertyType == typeof(MaterialDestination))
                {
                    // If so then add it to the list of destinations ?
                    System.Object getValue = propertyInfo.GetValue(this, null);

                    if (getValue == null)
                    {
                        MaterialDestination destination = new MaterialDestination();
                        propertyInfo.SetValue(this, destination, null);
                        destinations.Add(destination);
                    }
                    else if (getValue is MaterialDestination)
                        destinations.Add(getValue as MaterialDestination);
                }
                // Is the property a list of objects ?
                else if (propertyInfo.PropertyType.IsArray)
                {
                    System.Object getValue = propertyInfo.GetValue(this, null);
                    if (getValue != null)
                    {
                        // Check each object to see if it is a MaterialDestination
                        foreach (Object thisElement in getValue as Array)
                        {
                            if (thisElement is MaterialDestination)
                                destinations.Add(thisElement as MaterialDestination);
                        }
                    }
                }
            }

            return destinations;
        }
Example #3
0
 // TODO Finish FindProcedure procedure
 private Procedure SearchForProcedureByName(MaterialDestination parentDestination, String procedureName)
 {
     return(null);
 }
Example #4
0
 // TODO Finish FindProcedure procedure   
 private Procedure SearchForProcedureByName(MaterialDestination parentDestination, String procedureName)
 {
     return null;
 }