示例#1
0
        public static FormElement AttributeValueFromFormNode(XElement node)
        {
            var formElement = new FormElement();
            var properties = formElement.GetType().GetProperties();

            foreach (var property in properties)
            {
                var value = ExtractAttributeValueFromNode(property.Name, node);
                property.SetValue(formElement, value, null);
            }

            return formElement;
        }
示例#2
0
        public static XElement AddNodeToForm(Element param)
        {
            var node = new XElement("Form");

            var formElement = new FormElement(param);
            var properties = formElement.GetType().GetProperties();

            foreach (var property in properties)
            {
                var value = property.GetValue(formElement, null);

                if (value != null && !string.IsNullOrEmpty(value.ToString()))
                {
                    AddAttributeInNode(property.Name, value.ToString(), node);
                }
            }

            return node;
        }
示例#3
0
 public IEnumerable <IElementValidator> GetValidators(FormElement element)
 {
     return(GetValidators(element.GetType()));
 }