Exemple #1
0
        public static QueryValueRequest ToRequest(this QueryCountOptions options)
        {
            QueryDescription qd = GetQueryDescription(options.QueryName);

            FilterOption.SetFilterTokens(options.FilterOptions, qd);

            var request = new QueryValueRequest
            {
                QueryName = options.QueryName,
                Filters   = options.FilterOptions.Select(f => f.ToFilter()).ToList()
            };

            return(request);
        }
Exemple #2
0
        public void Search()
        {
            if (IsSearching)
            {
                searchQueued = true;
                return;
            }

            FormattedText = (TextWaiting ?? QueryUtils.GetNiceName(QueryName) + "...");
            tb.FontWeight = FontWeights.Regular;

            var options = new QueryCountOptions
            {
                QueryName     = QueryName,
                FilterOptions = FilterOptions.ToList()
            };

            DynamicQueryServer.QueryCountBatch(options, count =>
            {
                ItemsCount = count;
                if (ItemsCount == 0)
                {
                    FormattedText = (TextZeroItems ?? SearchMessage.ThereIsNo0.NiceToString()).FormatWith(QueryUtils.GetNiceName(QueryName));
                    tb.FontWeight = FontWeights.Regular;
                }
                else
                {
                    FormattedText = (Text ?? (QueryUtils.GetNiceName(QueryName) + ": {0}")).FormatWith(ItemsCount);
                    tb.FontWeight = FontWeights.Bold;
                }

                if (searchQueued)
                {
                    searchQueued = false;
                    Search();
                }
            },
                                               () => { });
        }
        public void Search()
        {
            if (IsSearching)
            {
                searchQueued = true;
                return;
            }

            FormattedText = (TextWaiting ?? QueryUtils.GetNiceName(QueryName) + "...");
            tb.FontWeight = FontWeights.Regular;

            var options = new QueryCountOptions
            {
                QueryName = QueryName,
                FilterOptions = FilterOptions.ToList()
            };

            DynamicQueryServer.QueryCountBatch(options, count =>
            {
                ItemsCount = count;
                if (ItemsCount == 0)
                {
                    FormattedText = (TextZeroItems ?? SearchMessage.ThereIsNo0.NiceToString()).Formato(QueryUtils.GetNiceName(QueryName));
                    tb.FontWeight = FontWeights.Regular;
                }
                else
                {
                    FormattedText = (Text ?? (QueryUtils.GetNiceName(QueryName) + ": {0}")).Formato(ItemsCount);
                    tb.FontWeight = FontWeights.Bold;
                }

                if (searchQueued)
                {
                    searchQueued = false;
                    Search();
                }
            },
            () => { });
        }
Exemple #4
0
 public static void QueryCountBatch(QueryCountOptions options, Action <int> onResult, Action @finally)
 {
     options.ToRequest().QueryCountBatch(@onResult, @finally);
 }
Exemple #5
0
 public static int QueryCount(this QueryCountOptions options)
 {
     return(options.ToRequest().QueryCount());
 }