Ejemplo n.º 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);
            }
        }
Ejemplo n.º 2
0
        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()));
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 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);
     }
 }
Ejemplo n.º 6
0
 public string DefaultValue(QueryToken?token)
 {
     return(this.Where(a => a.CompatibleWith(token)).FirstEx(() => "No default parameter value for {0} found".FormatWith(token?.NiceName())).Name);
 }
Ejemplo n.º 7
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));
            }
        }
Ejemplo n.º 8
0
 public override string NiceName()
 {
     return(QueryTokenMessage._0Mod1.NiceToString(parent.NiceName(), Divisor));
 }
Ejemplo n.º 9
0
 public override string NiceName()
 {
     return(QueryTokenMessage._0Steps1.NiceToString(parent.NiceName(), StepSize));
 }
Ejemplo n.º 10
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);
 }