Esempio n. 1
0
        public XmlNode ToXml(XmlDocument doc)
        {
            XmlNode      layerNode     = doc.CreateElement("Layer");
            XmlAttribute nameAttribute = doc.CreateAttribute("Name");

            nameAttribute.Value = _name;
            XmlAttribute aliasNameAttribute = doc.CreateAttribute("AliasName");

            aliasNameAttribute.Value = _aliasName;
            XmlAttribute templateAttribute = doc.CreateAttribute("Template");

            templateAttribute.Value = _templateName;
            XmlAttribute visibleAttribute = doc.CreateAttribute("Visible");

            visibleAttribute.Value = _visible.ToString();
            XmlAttribute typeAttribute = doc.CreateAttribute("DataType");

            typeAttribute.Value = EnumHelper.ConvertDataTypeToString(_dataType);
            XmlAttribute heightAttribute = doc.CreateAttribute("HeightType");

            heightAttribute.Value = EnumHelper.ConvertHeightTypeToStr(_heightType);

            XmlAttribute depthAttribute = doc.CreateAttribute("DepthType");

            depthAttribute.Value = EnumHelper.ConvertDepthTypeToStr(_depthType);

            XmlAttribute sectionAttribute = doc.CreateAttribute("SectionType");

            sectionAttribute.Value = EnumHelper.ConvertSectionTypeToStr(_sectionType);

            XmlAttribute validateKeysAttribute = doc.CreateAttribute("ValidateKeys");

            validateKeysAttribute.Value = _validateKeys;
            XmlAttribute autoNamesAttribute = doc.CreateAttribute("AutoNames");

            autoNamesAttribute.Value = _autoNames;
            layerNode.Attributes.Append(nameAttribute);
            layerNode.Attributes.Append(aliasNameAttribute);
            layerNode.Attributes.Append(templateAttribute);
            layerNode.Attributes.Append(visibleAttribute);
            layerNode.Attributes.Append(typeAttribute);
            layerNode.Attributes.Append(heightAttribute);
            layerNode.Attributes.Append(depthAttribute);
            layerNode.Attributes.Append(sectionAttribute);
            layerNode.Attributes.Append(validateKeysAttribute);
            layerNode.Attributes.Append(autoNamesAttribute);

            XmlNode fieldsNode = doc.CreateElement("Fields");

            foreach (IYTField ytField in _fields)
            {
                XmlNode fieldNode = ytField.ToXml(doc);
                fieldsNode.AppendChild(fieldNode);
            }
            layerNode.AppendChild(fieldsNode);
            return(layerNode);
        }
Esempio n. 2
0
        public XmlNode ToXml(XmlDocument doc)
        {
            XmlNode      templateNode  = doc.CreateElement("Template");
            XmlAttribute nameAttribute = doc.CreateAttribute("Name");

            nameAttribute.Value = _name;
            XmlAttribute captionAttribute = doc.CreateAttribute("Caption");

            captionAttribute.Value = _caption;
            XmlAttribute typeAttribute = doc.CreateAttribute("DataType");

            typeAttribute.Value = EnumHelper.ConvertDataTypeToString(_dataType);
            templateNode.Attributes.Append(nameAttribute);
            templateNode.Attributes.Append(captionAttribute);
            templateNode.Attributes.Append(typeAttribute);
            XmlNode fieldsNode = doc.CreateElement("Fields");

            foreach (IYTField ytField in _fields)
            {
                fieldsNode.AppendChild(ytField.ToXml(doc));
            }
            templateNode.AppendChild(fieldsNode);
            return(templateNode);
        }