Exemple #1
0
        public QueryTokenTS(QueryToken qt, bool recursive)
        {
            this.toString        = qt.ToString();
            this.niceName        = qt.NiceName();
            this.key             = qt.Key;
            this.fullKey         = qt.FullKey();
            this.type            = new TypeReferenceTS(qt.Type, qt.GetImplementations());
            this.filterType      = QueryUtils.TryGetFilterType(qt.Type);
            this.format          = qt.Format;
            this.unit            = qt.Unit;
            this.typeColor       = qt.TypeColor;
            this.niceTypeName    = qt.NiceTypeName;
            this.queryTokenType  = GetQueryTokenType(qt);
            this.isGroupable     = qt.IsGroupable;
            this.hasOrderAdapter = QueryUtils.OrderAdapters.ContainsKey(qt.Type);

            this.preferEquals = qt.Type == typeof(string) &&
                                qt.GetPropertyRoute() is PropertyRoute pr &&
                                typeof(Entity).IsAssignableFrom(pr.RootType) &&
                                Schema.Current.HasSomeIndex(pr);

            this.propertyRoute = qt.GetPropertyRoute()?.ToString();
            if (recursive && qt.Parent != null)
            {
                this.parent = new QueryTokenTS(qt.Parent, recursive);
            }
        }
        public ContentResult AddColumn(string webQueryName, string tokenName)
        {
            object           queryName = Finder.ResolveQueryName(webQueryName);
            QueryDescription qd        = DynamicQueryManager.Current.QueryDescription(queryName);
            QueryToken       token     = QueryUtils.Parse(tokenName, qd, SubTokensOptions.CanElement);

            return(Content(SearchControlHelper.Header(new Column(token, token.NiceName()), null).ToString()));
        }
Exemple #3
0
        private void AddColumn(QueryToken token)
        {
            if (!AllowChangeColumns)
            {
                return;
            }

            string result = token.NiceName();

            if (ValueLineBox.Show <string>(ref result, SearchMessage.NewColumnSName.NiceToString(), SearchMessage.ChooseTheDisplayNameOfTheNewColumn.NiceToString(), SearchMessage.Name.NiceToString(), null, null, Window.GetWindow(this)))
            {
                ClearResults();

                AddListViewColumn(new Column(token, result));
            }
        }
        public string?Validate(string?parameter, QueryToken?token)
        {
            if (token == null)
            {
                return(null); //?
            }
            var enumValue = this.SingleOrDefault(a => a.Name == parameter);

            if (enumValue == null)
            {
                return("{0} is not in the list".FormatWith(parameter));
            }

            if (!enumValue.CompatibleWith(token))
            {
                return("{0} is not compatible with {1}".FormatWith(parameter, token?.NiceName()));
            }

            return(null);
        }
Exemple #5
0
 public QueryTokenTS(QueryToken qt, bool recursive)
 {
     this.toString       = qt.ToString();
     this.niceName       = qt.NiceName();
     this.key            = qt.Key;
     this.fullKey        = qt.FullKey();
     this.type           = new TypeReferenceTS(qt.Type, qt.GetImplementations());
     this.filterType     = QueryUtils.TryGetFilterType(qt.Type);
     this.format         = qt.Format;
     this.unit           = qt.Unit;
     this.typeColor      = qt.TypeColor;
     this.niceTypeName   = qt.NiceTypeName;
     this.queryTokenType = GetQueryTokenType(qt);
     this.isGroupable    = qt.IsGroupable;
     this.propertyRoute  = qt.GetPropertyRoute()?.ToString();
     if (recursive && qt.Parent != null)
     {
         this.parent = new QueryTokenTS(qt.Parent, recursive);
     }
 }
 public string DefaultValue(QueryToken?token)
 {
     return(this.Where(a => a.CompatibleWith(token)).FirstEx(() => "No default parameter value for {0} found".FormatWith(token?.NiceName())).Name);
 }
        private void AddColumn(QueryToken token)
        {
            if (!AllowChangeColumns)
                return;

            string result = token.NiceName();
            if (ValueLineBox.Show<string>(ref result, SearchMessage.NewColumnSName.NiceToString(), SearchMessage.ChooseTheDisplayNameOfTheNewColumn.NiceToString(), SearchMessage.Name.NiceToString(), null, null, Window.GetWindow(this)))
            {
                ClearResults();

                AddListViewColumn(new Column(token, result));
            }
        }
Exemple #8
0
 public override string NiceName()
 {
     return(QueryTokenMessage._0Mod1.NiceToString(parent.NiceName(), Divisor));
 }
Exemple #9
0
 public override string NiceName()
 {
     return(QueryTokenMessage._0Steps1.NiceToString(parent.NiceName(), StepSize));
 }
 public QueryTokenTS(QueryToken qt, bool recursive)
 {
     this.toString = qt.ToString();
     this.niceName = qt.NiceName();
     this.key = qt.Key;
     this.fullKey = qt.FullKey();
     this.type = new TypeReferenceTS(qt.Type, qt.GetImplementations());
     this.filterType = QueryUtils.TryGetFilterType(qt.Type);
     this.format = qt.Format;
     this.unit = qt.Unit;
     this.typeColor = qt.TypeColor;
     this.niceTypeName = qt.NiceTypeName;
     this.queryTokenType = GetQueryTokenType(qt);
     this.isGroupable = qt.IsGroupable;
     this.propertyRoute = qt.GetPropertyRoute()?.ToString();
     if (recursive && qt.Parent != null)
         this.parent = new QueryTokenTS(qt.Parent, recursive);
 }