예제 #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()));
 }