Ejemplo n.º 1
0
        //Using Handler 432
        public NoteClass(Stream stream)
        {
            ProductNoteClass _productNote = new ProductNoteClass();
            string k = string.Empty;
            stream.Position = 0;
            XmlTextReader reader = new XmlTextReader(stream);

            while (reader.Read())
            {
                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    #region if element
                    switch (reader.LocalName)
                    {
                        case "CustomerOrderNumber":
                            k = reader.ReadString().Trim();
                            OrderNumber = k;
                            break;

                        case "Notes":
                            k = reader.ReadString().Trim();
                            Note = k;
                            break;

                        case "AddProductNoteList":
                            int _dept = reader.Depth;
                            while (reader.Read() && reader.Depth > _dept)
                            {
                                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                                {
                                    switch (reader.LocalName)
                                    {
                                        case "AddProductNote":
                                            //ProductNoteClass _productNote = new ProductNoteClass();
                                            int _xdept = reader.Depth;
                                            while (reader.Read() && reader.Depth > _xdept)
                                            {
                                                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                                                {
                                                    switch (reader.LocalName)
                                                    {
                                                        case "ProductNumber":
                                                            reader.Read();

                                                            _productNote.ProductNumber = reader.Value;
                                                            break;
                                                    }
                                                }
                                            }
                                            break;
                                    }
                                }
                            }
                            break;

                        default:
                            break;
                    }
                    #endregion
                }
            }

            stream.Position = 0;
            XmlTextReader reader2 = new XmlTextReader(stream);
            XmlDocument doc = new XmlDocument();
            doc.Load(reader2);
            // Add the namespace.
            XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
            nsmgr.AddNamespace("ns5", "http://schemas.datacontract.org/2004/07/FSoft.OVM.GenericAPIs");

            var temp = doc.SelectSingleNode("//ns5:Notes", nsmgr);
            if (temp != null && !string.IsNullOrEmpty(temp.InnerText))
            {
                _productNote.Notes = temp.InnerXml.ToString();
            }
            _productNoteList.Add(_productNote);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="reader"></param>
        public NoteClass(System.Xml.XmlReader reader)
        {
            string k = string.Empty;
            while (reader.Read())
            {
                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                {
                    #region if element
                    switch (reader.LocalName)
                    {
                        case "CustomerOrderNumber":
                            k = reader.ReadString().Trim();
                            OrderNumber = k;
                            break;

                        case "Notes":
                            k = reader.ReadString().Trim();
                            Note = k;
                            break;

                        case "AddProductNoteList":
                            int _dept = reader.Depth;
                            while (reader.Read() && reader.Depth > _dept)
                            {
                                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                                {
                                    switch (reader.LocalName)
                                    {
                                        case "AddProductNote":
                                            ProductNoteClass _productNote = new ProductNoteClass();
                                            int _xdept = reader.Depth;
                                            while (reader.Read() && reader.Depth > _xdept)
                                            {
                                                if (reader.NodeType == System.Xml.XmlNodeType.Element)
                                                {
                                                    switch (reader.LocalName)
                                                    {
                                                        case "Notes":
                                                            reader.Read();
                                                            _productNote.Notes = reader.Value;
                                                            break;
                                                        case "ProductNumber":
                                                            reader.Read();
                                                            _productNote.ProductNumber = reader.Value;
                                                            break;
                                                    }
                                                }
                                            }
                                            _productNoteList.Add(_productNote);
                                            break;
                                    }
                                }
                            }
                            break;

                        default:
                            break;
                    }
                    #endregion
                }
            }
        }