Ejemplo n.º 1
0
        private void WriteFeedFile(XmlWriter xmlWriter, FeedGenerationFileInstruction fileInstruction)
        {
            var countRec = new Tuple <int, int, int>(0, 0, 0);

            xmlWriter.WriteStartDocument();
            xmlWriter.WriteDocType("product_catalog_data", null, DocTypeSystemId, null);
            xmlWriter.WriteStartElement("product_catalog_data");
            var header = new XE("header");

            header.Add(new XE("cid", Cid));
            header.Add(new XE("subid", SubId));
            //header.Add(new XE("datefmt", DateFormatString));
            header.Add(new XE("processtype", (_isIncrementalRun) ? "UPDATE" : "OVERWRITE"));
            header.Add(new XE("aid", fileInstruction.Aid));

            header.WriteTo(xmlWriter);

            //<feedGenerationFileLineItem isIncluded="true" catalog="books" storedProcedureName="uspCJFeedBooks" catalogattributesection="booksattributes" ranges="00-04;05-09" />
            foreach (var fileComponent in fileInstruction.LineItems)
            {
                WriteFileComponent(xmlWriter, fileComponent, ref countRec);
            }

            xmlWriter.WriteEndElement();
            xmlWriter.WriteEndDocument();
        }