Пример #1
0
        protected static void ParseSubmitHandlers(XElement root, IDynamicDefinition definition)
        {
            var submitHandlersElement = root.Element("SubmitHandlers");

            if (submitHandlersElement == null)
            {
                return;
            }

            foreach (var handler in submitHandlersElement.Elements("Add"))
            {
                var typeString = handler.Attribute("Type").Value;

                var type = Type.GetType(typeString);
                if (type == null)
                {
                    if (typeString.StartsWith("CompositeC1Contrib.FormBuilder.Dynamic.Wizard.SubmitHandlers.EmailSubmitHandler"))
                    {
                        type = typeof(EmailSubmitHandler);
                    }
                }

                if (type == null)
                {
                    continue;
                }

                var instance = (FormSubmitHandler)XElementHelper.DeserializeInstanceWithArgument(type, handler);

                instance.Load(definition, handler);
                definition.SubmitHandlers.Add(instance);
            }
        }
Пример #2
0
        private static void ParseInputElement(XElement xml, IList <Attribute> attrs)
        {
            var type = Type.GetType(xml.Attribute("type").Value);

            if (type == null)
            {
                return;
            }

            var inputElementAttr = (InputElementTypeAttribute)XElementHelper.DeserializeInstanceWithArgument(type, xml);

            attrs.Add(inputElementAttr);
        }
Пример #3
0
        private static void ParseValidationRules(XElement el, ICollection <Attribute> attrs)
        {
            var rules = el.Elements("Add");

            foreach (var rule in rules)
            {
                var typeString = rule.Attribute("type").Value;

                var type = Type.GetType(typeString);
                if (type == null)
                {
                    continue;
                }

                var ruleAttribute = (FormValidationAttribute)XElementHelper.DeserializeInstanceWithArgument(type, rule);

                attrs.Add(ruleAttribute);
            }
        }
Пример #4
0
        protected static void ParseFormSettings(XElement metaData, IDynamicDefinition definition)
        {
            var formSettingsElement = metaData.Element("FormSettings");

            if (formSettingsElement == null)
            {
                return;
            }

            var typeString = formSettingsElement.Attribute("Type").Value;

            var type = Type.GetType(typeString);

            if (type == null)
            {
                return;
            }

            var instance = (IFormSettings)XElementHelper.DeserializeInstanceWithArgument(type, formSettingsElement);

            definition.Settings = instance;
        }