Inheritance: IFilterValueSource
Exemplo n.º 1
0
        public static FilterModel FromProperty(IFrozenContext frozenCtx, IEnumerable <Property> props)
        {
            var last  = props.Last();
            var label = string.Join(", ", props.Select(i => i.GetLabel()).ToArray());

            if (last is DateTimeProperty)
            {
                return(RangeFilterModel.Create(frozenCtx, label, FilterValueSource.FromProperty(props), typeof(DateTime), null, null));
            }
            else if (last is IntProperty)
            {
                return(RangeFilterModel.Create(frozenCtx, label, FilterValueSource.FromProperty(props), typeof(int), null, null));
            }
            else if (last is DecimalProperty)
            {
                return(RangeFilterModel.Create(frozenCtx, label, FilterValueSource.FromProperty(props), typeof(decimal), null, null));
            }
            else if (last is DoubleProperty)
            {
                return(RangeFilterModel.Create(frozenCtx, label, FilterValueSource.FromProperty(props), typeof(double), null, null));
            }
            else
            {
                return(SingleValueFilterModel.Create(frozenCtx, label, props));
            }
        }
Exemplo n.º 2
0
        public static SingleValueFilterModel Create(IFrozenContext frozenCtx, string label, IEnumerable <Property> props, ControlKind requestedKind, ControlKind requestedArgumentKind)
        {
            var predicate = FilterValueSource.FromProperty(props);
            var last      = props.Last();

            if (last is DecimalProperty)
            {
                return(Create(frozenCtx, label, predicate, typeof(decimal), requestedKind, requestedArgumentKind));
            }
            else if (last is IntProperty)
            {
                return(Create(frozenCtx, label, predicate, typeof(int), requestedKind, requestedArgumentKind));
            }
            else if (last is DoubleProperty)
            {
                return(Create(frozenCtx, label, predicate, typeof(double), requestedKind, requestedArgumentKind));
            }
            else if (last is StringProperty)
            {
                return(Create(frozenCtx, label, predicate, typeof(string), requestedKind, requestedArgumentKind));
            }
            else if (last is BoolProperty)
            {
                return(Create(frozenCtx, label, predicate, typeof(bool), requestedKind, requestedArgumentKind));
            }
            else if (last is EnumerationProperty)
            {
                return(Create(frozenCtx, label, predicate, ((EnumerationProperty)last).Enumeration.ExportGuid, requestedKind, requestedArgumentKind));
            }
            else if (last is ObjectReferenceProperty)
            {
                return(Create(frozenCtx, label, predicate, ((ObjectReferenceProperty)last).GetReferencedObjectClass(), requestedKind, requestedArgumentKind));
            }
            else if (last is CompoundObjectProperty)
            {
                return(Create(frozenCtx, label, predicate, ((CompoundObjectProperty)last).CompoundObjectDefinition, requestedKind, requestedArgumentKind));
            }
            else
            {
                throw new NotSupportedException(string.Format("Singlevalue filters of Property Type {0} are not supported yet", last.GetType().Name));
            }
        }
Exemplo n.º 3
0
        public static OptionalPredicateFilterModel Create(IFrozenContext frozenCtx, string label, string predicate, ControlKind requestedKind, ControlKind requestedArgumentKind)
        {
            if (frozenCtx == null)
            {
                throw new ArgumentNullException("frozenCtx");
            }

            var fmdl = new OptionalPredicateFilterModel()
            {
                Label         = label,
                ValueSource   = FilterValueSource.FromExpression(predicate),
                ViewModelType = ViewModelDescriptors.Zetbox_Client_Presentables_FilterViewModels_OptionalPredicateFilterViewModel.Find(frozenCtx),
                RequestedKind = requestedKind,
            };
            var valueMdl = new BoolValueModel(label, "", false, false, requestedArgumentKind);

            valueMdl.Value = false;
            fmdl.FilterArguments.Add(new FilterArgumentConfig(valueMdl,
                                                              ViewModelDescriptors.Zetbox_Client_Presentables_ValueViewModels_NullableBoolPropertyViewModel.Find(frozenCtx)));
            return(fmdl);
        }
Exemplo n.º 4
0
 public static RangeFilterModel Create(IFrozenContext frozenCtx, string label, string predicate, Type type, ControlKind requestedKind, ControlKind requestedArgumentKind)
 {
     return(Create(frozenCtx, label, FilterValueSource.FromExpression(predicate), type, requestedKind, requestedArgumentKind));
 }
Exemplo n.º 5
0
 public static SingleValueFilterModel Create(IFrozenContext frozenCtx, string label, string predicate, ObjectClass referencedClass, ControlKind requestedKind, ControlKind requestedArgumentKind)
 {
     return(Create(frozenCtx, label, FilterValueSource.FromExpression(predicate), referencedClass, requestedKind, requestedArgumentKind));
 }
Exemplo n.º 6
0
 public static SingleValueFilterModel Create(IFrozenContext frozenCtx, string label, string predicate, Guid enumDef, ControlKind requestedKind, ControlKind requestedArgumentKind)
 {
     return(Create(frozenCtx, label, FilterValueSource.FromExpression(predicate), enumDef, requestedKind, requestedArgumentKind));
 }