Ejemplo n.º 1
0
        /// <summary>
        /// Gets an optional DateTime value using the specified root node and the specified property name.
        /// The property must be decorated with a <see cref="NodeInfoAttribute"/>.
        /// This method woll locate the nested node.
        /// </summary>
        /// <param name="rootNode">The root node from which to find data for the property.</param>
        /// <param name="propertyName">The name of the property</param>
        /// <returns>A DateTime, or null</returns>
        protected DateTime?GetNullableDateTimeValue(XmlNode rootNode, string propertyName)
        {
            NodeInfoAttribute attrib = GetNodeInfoAttribute(propertyName);

            if (!attrib.Required)
            {
                return(GetNullableDateTimeValue(GetNestedNode(rootNode, attrib.NodeName)));
            }
            // this can happen if the property isn't decorated with Required = false.
            throw new OfxParseException("Do not use this method when property marked as required");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets a Decimal value using the specified root node and the specified property name.
        /// The property must be decorated with a <see cref="NodeInfoAttribute"/>.
        /// This method will locate the nested node.
        /// </summary>
        /// <param name="rootNode">The root node from which to find data for the property.</param>
        /// <param name="propertyName">The name of the property</param>
        /// <returns>A Decimal value.</returns>
        protected Decimal GetDecimalValue(XmlNode rootNode, string propertyName)
        {
            NodeInfoAttribute attrib = GetNodeInfoAttribute(propertyName);

            return(GetDecimalValue(GetNestedNode(rootNode, attrib.NodeName)));
        }