Beispiel #1
0
        /// <summary>
        /// Writes This Object to an Existing XML Document
        /// </summary>
        /// <param name="xwriter">Pointer to the XMLWriter Writing the Document</param>
        public void WriteXML(XmlWriter xwriter)
        {
            this.Validate();
            if (this.capacityStatus != null)
            {
                xwriter.WriteElementString("CapacityStatus", HAVEEnumUtils.CapacityStatusToString(this.capacityStatus));
            }

            if (this.availableCount != null)
            {
                xwriter.WriteElementString("AvailableCount", this.availableCount.ToString());
            }

            if (this.baselineCount != null)
            {
                xwriter.WriteElementString("BaselineCount", this.baselineCount.ToString());
            }

            if (this.additionalCapacityCount24Hr != null)
            {
                xwriter.WriteElementString("AdditionalCapacityCount24Hr", this.additionalCapacityCount24Hr.ToString());
            }

            if (this.additionalCapacityCount72Hr != null)
            {
                xwriter.WriteElementString("AdditionalCapacityCount72Hr", this.additionalCapacityCount72Hr.ToString());
            }
        }
Beispiel #2
0
        /// <summary>
        /// Reads an XML Object From An Existing DOM
        /// </summary>
        /// <param name="rootnode">Node Containing the root Object element</param>
        public void ReadXML(XmlNode rootnode)
        {
            foreach (XmlNode node in rootnode.ChildNodes)
            {
                if (string.IsNullOrEmpty(node.InnerText))
                {
                    continue;
                }

                switch (node.LocalName)
                {
                case "CapacityStatus":
                    this.capacityStatus = HAVEEnumUtils.StringToCapacityStatus(node.InnerText); ////(CapacityStatusType)Enum.Parse(typeof(CapacityStatusType), node.InnerText);
                    break;

                case "AvailableCount":
                    this.availableCount = int.Parse(node.InnerText);
                    break;

                case "BaselineCount":
                    this.baselineCount = int.Parse(node.InnerText);
                    break;

                case "AdditionalCapacityCount24Hr":
                    this.additionalCapacityCount24Hr = int.Parse(node.InnerText);
                    break;

                case "AdditionalCapacityCount72Hr":
                    this.additionalCapacityCount72Hr = int.Parse(node.InnerText);
                    break;

                case "#comment":
                    break;

                default:
                    throw new ArgumentException("Unexpected node name: " + node.Name + " in CapacityType");
                }
            }

            this.Validate();
        }