Esempio n. 1
0
        public override string ToString()
        {
            if (FilterOptions.Any())
            {
                QueryDescription queryDescription = DynamicQueryManager.Current.QueryDescription(QueryName);

                FilterOption.SetFilterTokens(FilterOptions, queryDescription, canAggregate: false);
            }

            var elements = Pagination != null?Pagination.GetElementsPerPage() : null;

            string options = new Sequence <string>
            {
                Pagination != null ? "pagination=" + pagination.GetMode().ToString() : null,
                elements != null ? "elems=" + elements : null,
                SearchOnLoad ? "searchOnLoad=true" : null,
                !Create ? "create=false": null,
                !Navigate ? "navigate=false": null,
                !AllowSelection ? "allowSelection=false" : null,
                !AllowChangeColumns ? "allowChangeColumns=false" : null,
                !AllowOrder ? "allowOrder=false" : null,
                !showHeader ? "showHeader=false" : null,
                !showFilters ? "showFilters=false" : null,
                !showFilterButton ? "showFilterButton=false" : null,
                !showFooter ? "showFooter=false" : null,
                !showContextMenu ? "showContextMenu=false" : null,
                (FilterOptions != null && FilterOptions.Count > 0) ? ("filters=" + FilterOptions.ToString(";")) : null,
                (OrderOptions != null && OrderOptions.Count > 0) ? ("orders=" + OrderOptions.ToString(";")) : null,
                (ColumnOptions != null && ColumnOptions.Count > 0) ? ("columns=" + ColumnOptions.ToString(";")) : null,
                (ColumnOptionsMode != ColumnOptionsMode.Add ? ("columnMode=" + ColumnOptionsMode.ToString()) : null),
                !SelectedItemsContextMenu ? "selectedItemsContextMenu=false" : null
            }.NotNull().ToString("&");

            if (options.HasText())
            {
                return(Finder.FindRoute(QueryName) + "?" + options);
            }
            else
            {
                return(Finder.FindRoute(QueryName));
            }
        }
Esempio n. 2
0
        public JObject ToJS(string prefix)
        {
            JObject op = new JObject()
            {
                { "prefix", prefix }
            };

            if (FilterOptions.Any())
            {
                QueryDescription queryDescription = DynamicQueryManager.Current.QueryDescription(QueryName);

                FilterOption.SetFilterTokens(this.FilterOptions, queryDescription, false);
            }

            if (QueryName != null)
            {
                op.Add("webQueryName", Finder.ResolveWebQueryName(QueryName));
            }
            if (SearchOnLoad == true)
            {
                op.Add("searchOnLoad", true);
            }
            if (!Navigate)
            {
                op.Add("navigate", false);
            }
            if (!Create)
            {
                op.Add("create", false);
            }
            if (!AllowSelection)
            {
                op.Add("allowSelection", false);
            }
            if (!SelectedItemsContextMenu)
            {
                op.Add("selectedItemsContextMenu", false);
            }
            if (!AllowChangeColumns)
            {
                op.Add("allowChangeColumns", false);
            }
            if (!AllowOrder)
            {
                op.Add("allowOrder", false);
            }
            if (!showHeader)
            {
                op.Add("showHeader", false);
            }
            if (!showFilters)
            {
                op.Add("showFilters", false);
            }
            if (!showFilterButton)
            {
                op.Add("showFilterButton", false);
            }
            if (!showFooter)
            {
                op.Add("showFooter", false);
            }
            if (!showContextMenu)
            {
                op.Add("showContextMenu", false);
            }
            if (FilterOptions.Any())
            {
                op.Add("filters", new JArray(filterOptions.Select(f => f.ToJS())));
            }
            if (OrderOptions.Any())
            {
                op.Add("orders", new JArray(OrderOptions.Select(oo => oo.ToJS())));
            }
            if (ColumnOptions.Any())
            {
                op.Add("columns", new JArray(ColumnOptions.Select(co => co.ToJS())));
            }
            if (ColumnOptionsMode != Entities.DynamicQuery.ColumnOptionsMode.Add)
            {
                op.Add("columnMode", ColumnOptionsMode.ToString());
            }

            if (Pagination != null)
            {
                op.Add("pagination", Pagination.GetMode().ToString());
                int?elems = Pagination.GetElementsPerPage();
                if (elems != null)
                {
                    op.Add("elems", elems.Value.ToString());
                }
            }

            return(op);
        }