Пример #1
0
        /// <summary>
        /// Generates an XML proxy from the object.
        /// </summary>
        /// <returns>XML proxy.</returns>
        internal XsdNs.MaterialRequirementType ToXmlProxy()
        {
            return(new XsdNs.MaterialRequirementType()
            {
                // Material definition identifiers
                MaterialDefinitionID = BuildMaterialDefinitionIdsForProxy(),

                // Material lot identifiers
                MaterialLotID = BuildMaterialLotIdsForProxy(),

                // Material use
                MaterialUse = MaterialUse?.ToXmlProxy(),

                // Quantities
                Quantity = BuildQuantitiesForProxy(),

                // Assembly requirements
                AssemblyRequirement = BuildAssemblyReqsForProxy()
            });
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="proxy">XML proxy.</param>
        /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
        internal MaterialRequirement(XsdNs.MaterialRequirementType proxy)
            : this() // Call the default constructor
        {
            if (proxy.MaterialDefinitionID != null)
            {
                foreach (var idProxy in proxy.MaterialDefinitionID)
                {
                    MaterialDefinitionIdentifiers.Add(new IdentifierType(idProxy)); // throws InvalidMessageException
                }
            }

            if (proxy.MaterialLotID != null)
            {
                foreach (var idProxy in proxy.MaterialLotID)
                {
                    MaterialLotIdentifiers.Add(new IdentifierType(idProxy)); // throws InvalidMessageException
                }
            }

            if (proxy.MaterialUse != null)
            {
                MaterialUse = new MaterialUse(proxy.MaterialUse); // throws InvalidMessageException
            }

            if (proxy.Quantity != null)
            {
                foreach (var qItem in proxy.Quantity)
                {
                    Quantities.Add(new QuantityValue(qItem)); // throws InvalidMessageException
                }
            }

            if (proxy.AssemblyRequirement != null)
            {
                foreach (var arItem in proxy.AssemblyRequirement)
                {
                    AssemblyRequirements.Add(new MaterialRequirement(arItem)); // throws InvalidMessageException
                }
            }
        }