Beispiel #1
0
        public ClientControlDisplay RenderFilterUI(AuditEventKind eventKind, IAuditEventFilter initialState)
        {
            var pf    = initialState as IPropertyFilter;
            var comps = pf == null ? null : pf.Components;

            var propUIs = from c in comps.EmptyIfNull()
                          let ui = PropertyValueSelectorsController.RenderSelector(Composition, c.Property, c.Value)
                                   where ui != null
                                   select new { c, ui };

            return(new ClientControlDisplay
            {
                ValueAsString = string.Join(",", propUIs.Select(x => (x.ui.ValueAsString ?? "").Replace(",", ",,"))),
                Render = (html, jsOnChangeFunction) => html.Partial <Views.PropertyFilterUI>().WithModel(
                    new Models.PropertyFilterUIModel
                {
                    OnChangeFunction = jsOnChangeFunction,
                    AllPossibleProperties = eventKind.Properties,
                    Properties = propUIs.Select(x =>
                                                new Models.PropertyFilterComponentUIModel
                    {
                        Comparison = x.c.Comparison,
                        Property = x.c.Property,
                        ValueSelector = x.ui
                    })
                })
            });
        }
        public XElement Serialize(IAuditEventFilter f)
        {
            var pf = f as IPropertyFilter;

            return(new XElement("_",
                                from c in pf.Components
                                select new XElement("Prop",
                                                    new XAttribute("Id", c.Property.ID),
                                                    new XAttribute("Value", c.Value),
                                                    new XAttribute("Cmp", c.Comparison)
                                                    )
                                ));
        }
Beispiel #3
0
 public XElement Serialize(IAuditEventFilter obj)
 {
     return(new XElement("_"));
 }