Exemple #1
0
        public string ToXml()
        {
            lock (this)
            {
                XmlTextWriter writer = XmlAPI.CreateWriter();

                // enclosing element
                writer.WriteStartElement(metaDataTag);

                // users element
                writer.WriteStartElement(usersTag);

                // sort the pairs by id
                List <KeyValuePair <int, string> > pairs = new List <KeyValuePair <int, string> >(userIdNameTable);
                pairs.Sort(new IntStringPairSorter());
                foreach (KeyValuePair <int, string> pair in pairs)
                {
                    writer.WriteStartElement(userTag);
                    writer.WriteElementString(userIdTag, pair.Key.ToString());
                    writer.WriteStartElement(userNameTag);
                    writer.WriteCData(pair.Value);
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                // note types element
                writer.WriteStartElement(noteTypesTag);

                pairs = new List <KeyValuePair <int, string> >(noteTypeIdDescriptionTable);
                pairs.Sort(new IntStringPairSorter());
                foreach (KeyValuePair <int, string> pair in pairs)
                {
                    writer.WriteStartElement(noteTypeTag);
                    writer.WriteElementString(noteTypeIdTag, pair.Key.ToString());
                    writer.WriteStartElement(noteTypeDescriptionTag);
                    writer.WriteCData(pair.Value);
                    writer.WriteEndElement();
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();

                writer.WriteEndElement();
                return(XmlAPI.FlushWriter(writer));
            }
        }
Exemple #2
0
        public string ToXml()
        {
            XmlTextWriter writer = XmlAPI.CreateWriter();

            writer.WriteStartElement(orderTag);

            // write the non-note PO details directly from the object
            this.Order.WriteOrderDetailsXml(writer);

            NoteInfo.WriteNotes(writer, this.Order.Notes, existingNotesTag);
            NoteInfo.WriteNotes(writer, this.NewNotes, newNotesTag);

            PhotoInfo.WritePhotos(writer, this.Order.Photos, existingPhotosTag);
            PhotoInfo.WritePhotos(writer, this.NewPhotos, newPhotosTag);

            writer.WriteElementString(statusTag, this.Status.ToString());

            writer.WriteEndElement();
            return(XmlAPI.FlushWriter(writer));
        }