/// <summary> /// /// This method will serialize a ProductCadre within a Product instance. /// /// </summary> /// <param name="poTmpPrdCadre">The target ProductCadre being serialized</param> /// <param name="poProductListBuilder">The buffer that is holding the written WONKA-XML message</param> /// <returns>None</returns> private void AppendProductCadre(WonkaProductCadre poTmpPrdCadre, StringBuilder poProductListBuilder) { XmlSerializer Serializer = new XmlSerializer(typeof(WonkaProductCadre)); XmlWriter WonkaXmlWriter = XmlWriter.Create(poProductListBuilder, DefaultSubPrdWriterSettings); poProductListBuilder.Append("\n "); Serializer.Serialize(WonkaXmlWriter, poTmpPrdCadre, DefaultNamespaces); }
/// <summary> /// /// This method will serialize a WonkaProduct into a string buffer. /// /// </summary> /// <param name="poProduct">The data structure representation of a WONKA product</param> /// <param name="poMessageBuffer">The buffer to which the serialized version of the product will be written</param> /// <returns>N/A</returns> public void WriteWonkaProduct(WonkaProduct poProduct, StringBuilder poMessageBuffer) { poMessageBuffer.Append("\n <Product>"); foreach (int nFieldId in poProduct.ProductCadreIndex.Keys) { WonkaProductCadre TempProductCadre = poProduct.ProductCadreIndex[nFieldId]; AppendProductCadre(TempProductCadre, poMessageBuffer); } foreach (WonkaPrdGroup TempProductGroup in poProduct) { AppendProductGroup(TempProductGroup, poMessageBuffer); } poMessageBuffer.Append("\n </Product>"); }