Пример #1
0
            public override MvcHtmlString ToHtml(HtmlHelper helper)
            {
                var a = new HtmlTag("button").Id(this.Id)
                        .Class("btn btn-default btn-help")
                        .Class(HelpLogic.GetQueryHelp(QueryName).HasEntity ? "hasItems" : null)
                        .Attr("type", "button")
                        .SetInnerText("?");

                var query = HelpLogic.GetQueryHelpService(this.QueryName);

                var jsType = new
                {
                    QueryName = QueryUtils.GetKey(query.QueryName),
                    Info      = query.Info,
                    Columns   = query.Columns,
                };

                var result = new HtmlTag("div").Class("btn-group").InnerHtml(a).ToHtml();

                result = result.Concat(helper.ScriptCss("~/Help/Content/helpWidget.css"));
                result = result.Concat(MvcHtmlString.Create("<script>$('#" + this.Id + "').on('mouseup', function(event){ if(event.which == 3) return; " +
                                                            HelpClient.WidgetModule["searchClick"](JsFunction.This, this.Prefix, jsType, helper.UrlHelper().Action((HelpController c) => c.ComplexColumns())).ToString() +
                                                            " })</script>"));

                return(result);
            }
Пример #2
0
        public static SearchControlProxy GetSearchControl(this ILineContainer lineContainer, object queryName)
        {
            string queryKey = QueryUtils.GetKey(queryName);

            var element = lineContainer.Element.WaitElementVisible(By.CssSelector("div.sf-search-control[data-query-key={0}]".FormatWith(queryKey)));

            return(new SearchControlProxy(element));
        }
Пример #3
0
        public static ValueSearchControlLineProxy GetValueSearchControlLine(this ILineContainer lineContainer, object queryName)
        {
            string queryKey = QueryUtils.GetKey(queryName);

            var element = lineContainer.Element.WaitElementVisible(By.CssSelector("[data-value-query-key={0}]".FormatWith(queryKey)));

            return(new ValueSearchControlLineProxy(element));
        }
Пример #4
0
        public static SearchControlProxy GetSearchControl(this ILineContainer lineContainer, object queryName)
        {
            string query = QueryUtils.GetKey(queryName);

            var prefix = (string)lineContainer.Selenium.ExecuteScript("return $('div.sf-search-control[data-queryname=\"{0}\"]').data('prefix')".FormatWith(query));

            return(new SearchControlProxy(lineContainer.Selenium, prefix));
        }
Пример #5
0
 static IEnumerable <QueryEntity> GenerateQueries()
 {
     return(DynamicQueryManager.Current.GetQueryNames()
            .Select(qn => new QueryEntity
     {
         Key = QueryUtils.GetKey(qn)
     }));
 }
Пример #6
0
 static IEnumerable <QueryEntity> GenerateQueries()
 {
     return(Queries.GetQueryNames()
            .Select(qn => new QueryEntity
     {
         Key = QueryUtils.GetKey(qn)
     }));
 }
Пример #7
0
        public async Task <HttpResponseMessage> ToPlainExcel(ChartRequest request, CancellationToken token)
        {
            var resultTable = await ChartLogic.ExecuteChartAsync(request, token);

            byte[] binaryFile = PlainExcelGenerator.WritePlainExcel(resultTable, QueryUtils.GetNiceName(request.QueryName));

            var fileName = request.ChartScript.ToString() + " " + QueryUtils.GetKey(request.QueryName) + TimeZoneManager.Now.ToString("yyyyMMdd-HHmmss") + ".xlsx";

            return(FilesController.GetHttpReponseMessage(new MemoryStream(binaryFile), fileName));
        }
Пример #8
0
        public QueryDescriptionTS(QueryDescription queryDescription)
        {
            this.queryKey = QueryUtils.GetKey(queryDescription.QueryName);
            this.columns  = queryDescription.Columns.ToDictionary(a => a.Name, a => new ColumnDescriptionTS(a, queryDescription.QueryName));

            foreach (var action in AddExtension.GetInvocationListTyped())
            {
                action(this);
            }
        }
Пример #9
0
        public static void Start(HttpConfiguration config, params IOmniboxResultGenerator[] generators)
        {
            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod());
            QueryTokenJsonConverter.GetQueryTokenTS = qt => new QueryTokenTS(qt, true);
            QueryNameJsonConverter.GetQueryKey      = qn => QueryUtils.GetKey(qn);
            OmniboxParser.Manager = new ReactOmniboxManager();

            ReflectionServer.RegisterLike(typeof(OmniboxMessage));

            foreach (var g in generators)
            {
                OmniboxParser.Generators.Add(g);
            }
        }
Пример #10
0
        public static void Start(IApplicationBuilder app, params IOmniboxResultGenerator[] generators)
        {
            SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod());
            QueryTokenJsonConverter.GetQueryTokenTS = qt => new QueryTokenTS(qt, true);
            QueryNameJsonConverter.GetQueryKey      = qn => QueryUtils.GetKey(qn);
            OmniboxParser.Manager = new ReactOmniboxManager();

            ReflectionServer.RegisterLike(typeof(OmniboxMessage), () => OmniboxPermission.ViewOmnibox.IsAuthorized());

            foreach (var g in generators)
            {
                OmniboxParser.Generators.Add(g);
            }
        }
Пример #11
0
        static SqlPreCommand?SynchronizeQueries(Replacements replacements, SyncData data)
        {
            var dic = Database.Query <QueryHelpEntity>().ToList();

            if (dic.IsEmpty())
            {
                return(null);
            }

            var queryKeys = QueryLogic.Queries.GetQueryNames().ToDictionary(a => QueryUtils.GetKey(a));

            var table = Schema.Current.Table <QueryHelpEntity>();

            var replace = replacements.TryGetC(QueryLogic.QueriesKey);

            return(dic.Select(qh =>
            {
                object?queryName = queryKeys.TryGetC(replace?.TryGetC(qh.Query.Key) ?? qh.Query.Key);
                if (queryName == null)
                {
                    return null; //PreDeleteSqlSync
                }
                if (qh.Columns.Any())
                {
                    var columns = QueryLogic.Queries.GetQuery(queryName).Core.Value.StaticColumns;

                    Synchronizer.SynchronizeReplacing(replacements, "ColumnsOfQuery:" + QueryUtils.GetKey(queryName),
                                                      columns.ToDictionary(a => a.Name),
                                                      qh.Columns.ToDictionary(a => a.ColumnName),
                                                      null,
                                                      (qn, oldQ) => qh.Columns.Remove(oldQ),
                                                      (qn, newQ, oldQ) =>
                    {
                        oldQ.ColumnName = newQ.Name;
                    });

                    foreach (var col in qh.Columns)
                    {
                        col.Description = SynchronizeContent(col.Description, replacements, data) !;
                    }
                }

                qh.Description = SynchronizeContent(qh.Description, replacements, data);

                return table.UpdateSqlSync(qh, h => h.Query.Key == qh.Query.Key);
            }).Combine(Spacing.Simple));
        }
Пример #12
0
        async Task <T> ExecuteAsync <T>(ExecuteType executeType, object queryName, BaseQueryRequest request, Func <DynamicQueryBucket, Task <T> > executor)
        {
            using (ExecutionMode.UserInterface())
                using (HeavyProfiler.Log(executeType.ToString(), () => QueryUtils.GetKey(queryName)))
                {
                    try
                    {
                        var qb = GetQuery(queryName);

                        using (Disposable.Combine(QueryExecuted, f => f(executeType, queryName, request)))
                        {
                            return(await executor(qb));
                        }
                    }
                    catch (Exception e)
                    {
                        e.Data["QueryName"] = queryName;
                        throw;
                    }
                }
        }
Пример #13
0
        void SearchControl_Loaded(object sender, RoutedEventArgs e)
        {
            this.Loaded -= SearchControl_Loaded;

            if (DesignerProperties.GetIsInDesignMode(this) || QueryName == null)
            {
                return;
            }

            if (qd == null)
            {
                qd = DynamicQueryServer.GetQueryDescription(QueryName);
            }

            if (FilterColumn.HasText())
            {
                FilterOptions.Add(new FilterOption
                {
                    ColumnName = FilterColumn,
                    Operation  = FilterOperation.EqualTo,
                    Frozen     = true,
                }.Bind(FilterOption.ValueProperty, new Binding("DataContext" + (FilterRoute.HasText() ? "." + FilterRoute : null))
                {
                    Source = this
                }));
                ColumnOptions.Add(new ColumnOption(FilterColumn));
                ColumnOptionsMode = ColumnOptionsMode.Remove;
            }

            FilterOption.SetFilterTokens(FilterOptions, qd);

            AutomationProperties.SetName(this, QueryUtils.GetKey(QueryName));

            Search();

            foreach (var item in FilterOptions)
            {
                item.BindingValueChanged += new DependencyPropertyChangedEventHandler(item_BindingValueChanged);
            }
        }
Пример #14
0
        void searchControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (this.EntityTypeTitle == null)
            {
                this.EntityTypeTitle = searchControl.EntityType.NicePluralName();
            }

            if (this.QueryNameTitle == null)
            {
                this.QueryNameTitle = QueryUtils.GetNiceName(QueryName);
            }

            if (this.QueryNameTitle.StartsWith(this.EntityTypeTitle))
            {
                this.QueryNameTitle = this.QueryNameTitle.Substring(this.EntityTypeTitle.Length).Trim();
            }
            else
            {
                this.QueryNameTitle = "- " + this.QueryNameTitle;
            }

            AutomationProperties.SetName(this, QueryUtils.GetKey(QueryName));
        }
Пример #15
0
        public override void Execute()
        {
            WriteLiteral("\r\n");


            #line 8 "..\..\Dashboard\Views\SearchControlPart.cshtml"
            using (var tc = Html.TypeContext <UserQueryPartEntity>())
            {
                UserQueryEntity uq        = tc.Value.UserQuery;
                object          queryName = Finder.Manager.QuerySettings.Keys.FirstEx(k => QueryUtils.GetKey(k) == uq.Query.Key);

                FindOptions fo = new FindOptions(queryName)
                {
                    ShowHeader     = false,
                    ShowFooter     = false,
                    AllowSelection = tc.Value.RenderMode == UserQueryPartRenderMode.SearchControl,
                    SearchOnLoad   = true,
                };



            #line default
            #line hidden

            #line 21 "..\..\Dashboard\Views\SearchControlPart.cshtml"
                Write(Html.SearchControl(uq, fo, new Context(null, Model.Prefix), sc => sc.AvoidFullScreenButton = true));


            #line default
            #line hidden

            #line 21 "..\..\Dashboard\Views\SearchControlPart.cshtml"
                ;
            }

            #line default
            #line hidden
        }
Пример #16
0
 public static string IdQuery(object queryName)
 {
     return("q-" + QueryUtils.GetKey(queryName).ToString().Replace(".", "_"));
 }
Пример #17
0
        public override void Execute()
        {
            DefineSection("head", () => {
                WriteLiteral("\r\n");

                WriteLiteral("    ");


            #line 12 "..\..\Help\Views\ViewEntity.cshtml"
                Write(Html.ScriptCss("~/help/Content/help.css"));


            #line default
            #line hidden
                WriteLiteral("\r\n");
            });

            WriteLiteral("\r\n");


            #line 15 "..\..\Help\Views\ViewEntity.cshtml"

            EntityHelp eh = (EntityHelp)Model;
            ViewBag.Title = eh.Type.NiceName();


            #line default
            #line hidden
            WriteLiteral("\r\n\r\n");

            WriteLiteral("\r\n\r\n<div");

            WriteLiteral(" class=\"row\"");

            WriteLiteral(">\r\n    <div");

            WriteLiteral(" class=\"col-md-9\"");

            WriteLiteral(">\r\n");


            #line 52 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 52 "..\..\Help\Views\ViewEntity.cshtml"
            using (TypeContext <EntityHelpEntity> ec = new TypeContext <EntityHelpEntity>(eh.Entity.Value, null))
            {
                var name = Navigator.ResolveWebTypeName(eh.Type);
                ec.FormGroupStyle = FormGroupStyle.None;


                using (Html.BeginForm((HelpController hc) => hc.SaveEntity(), new { id = "form-save" }))
                {
            #line default
            #line hidden

            #line 60 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.HiddenRuntimeInfo(ec));


            #line default
            #line hidden

            #line 60 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden

            #line 61 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.HiddenRuntimeInfo(ec, e => e.Culture));


            #line default
            #line hidden

            #line 61 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden

            #line 62 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.HiddenRuntimeInfo(ec, e => e.Type));


            #line default
            #line hidden

            #line 62 "..\..\Help\Views\ViewEntity.cshtml"

                    if (!Navigator.IsReadOnly(typeof(EntityHelpEntity)))
                    {
                        Html.RenderPartial(HelpClient.Buttons, new ViewDataDictionary
                        {
                            { "options", Database.Query <EntityHelpEntity>()
                              .Where(e => e.Type == ec.Value.Type && e.Culture != ec.Value.Culture)
                              .Select(e => new { e.Culture })
                              .ToList()
                              .Select(e => KVP.Create(e.Culture.ToCultureInfo(), this.Url.Action((HelpController a) => a.TraslateEntity(e.Culture.Name))))
                              .ToDictionary() }
                        });
                    }


            #line default
            #line hidden
                    WriteLiteral("            <div");

                    WriteLiteral(" class=\"edit-container\"");

                    WriteLiteral(">\r\n                <h1");

                    WriteAttribute("title", Tuple.Create(" title=\"", 2876), Tuple.Create("\"", 2902)

            #line 76 "..\..\Help\Views\ViewEntity.cshtml"
                                   , Tuple.Create(Tuple.Create("", 2884), Tuple.Create <System.Object, System.Int32>(eh.Type.Namespace

            #line default
            #line hidden
                                                                                                                     , 2884), false)
                                   );

                    WriteLiteral(">");


            #line 76 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(eh.Type.NiceName());


            #line default
            #line hidden
                    WriteLiteral("</h1>\r\n                <code");

                    WriteLiteral(" class=\'shortcut\'");

                    WriteLiteral(">[e:");


            #line 77 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(name);


            #line default
            #line hidden
                    WriteLiteral("]</code>\r\n                <span");

                    WriteLiteral(" class=\"info\"");

                    WriteLiteral(">\r\n");

                    WriteLiteral("                    ");


            #line 79 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.WikiParse(eh.Info, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                    WriteLiteral("\r\n                </span>\r\n");

                    WriteLiteral("                ");


            #line 81 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.TextArea(ec.SubContextPrefix(a => a.Description), eh.Description, 5, 80, new { @class = "editable" }));


            #line default
            #line hidden
                    WriteLiteral("\r\n                <span");

                    WriteLiteral(" class=\"wiki\"");

                    WriteLiteral(">\r\n");

                    WriteLiteral("                    ");


            #line 83 "..\..\Help\Views\ViewEntity.cshtml"
                    Write(Html.WikiParse(eh.Description, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                    WriteLiteral("\r\n                </span>\r\n            </div>\r\n");

                    WriteLiteral("            <div");

                    WriteLiteral(" id=\"entityContent\"");

                    WriteLiteral(" class=\"help_left\"");

                    WriteLiteral(">\r\n");


            #line 87 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 87 "..\..\Help\Views\ViewEntity.cshtml"

                    var allowedProps = eh.Properties.Where(a => a.Value.IsAllowed() == null).ToDictionary();


            #line default
            #line hidden
                    WriteLiteral("\r\n\r\n");


            #line 91 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 91 "..\..\Help\Views\ViewEntity.cshtml"
                    if (allowedProps.Any())
                    {
            #line default
            #line hidden
                        WriteLiteral("                    <div");

                        WriteLiteral(" id=\"properties\"");

                        WriteLiteral(">\r\n                        <h2");

                        WriteLiteral(" class=\"greyTitle\"");

                        WriteLiteral(">");


            #line 94 "..\..\Help\Views\ViewEntity.cshtml"
                        Write(Html.PropertyNiceName(() => eh.Entity.Value.Properties));


            #line default
            #line hidden
                        WriteLiteral("</h2>\r\n");


            #line 95 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 95 "..\..\Help\Views\ViewEntity.cshtml"

                        var elementContexts = ec.TypeElementContext(e => e.Properties).ToDictionary(a => a.Value.Property.Path);

                        var tuplesDic = allowedProps.Values.Select(p => Tuple.Create(p, elementContexts.GetOrThrow(p.PropertyRoute.PropertyString()))).ToDictionary(a => a.Item1.PropertyRoute);

                        var roots = TreeHelper.ToTreeC(tuplesDic.Values, kvp =>
                        {
                            var parent = kvp.Item1.PropertyRoute.Parent;
                            if (parent.PropertyRouteType == PropertyRouteType.Root || parent.PropertyRouteType == PropertyRouteType.Mixin)
                            {
                                return(null);
                            }

                            if (parent.PropertyRouteType == PropertyRouteType.MListItems)
                            {
                                parent = parent.Parent;
                            }

                            return(tuplesDic.GetOrThrow(parent));
                        });


            #line default
            #line hidden
                        WriteLiteral("\r\n\r\n                        <dl");

                        WriteLiteral(" class=\"dl-horizontal\"");

                        WriteLiteral(">\r\n");


            #line 114 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 114 "..\..\Help\Views\ViewEntity.cshtml"
                        foreach (var node in roots)
                        {
            #line default
            #line hidden

            #line 116 "..\..\Help\Views\ViewEntity.cshtml"
                            Write(WriteProperty(node, name));


            #line default
            #line hidden

            #line 116 "..\..\Help\Views\ViewEntity.cshtml"
                            ;
                        }


            #line default
            #line hidden
                        WriteLiteral("                        </dl>\r\n                    </div>\r\n");


            #line 120 "..\..\Help\Views\ViewEntity.cshtml"
                    }


            #line default
            #line hidden
                    WriteLiteral("\r\n");


            #line 122 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 122 "..\..\Help\Views\ViewEntity.cshtml"

                    var allowedOperations = eh.Operations.Where(a => a.Value.IsAllowed() == null).ToDictionary();


            #line default
            #line hidden
                    WriteLiteral("\r\n\r\n");


            #line 126 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 126 "..\..\Help\Views\ViewEntity.cshtml"
                    if (allowedOperations.Any())
                    {
                        var operations = ec.TypeElementContext(e => e.Operations).ToDictionary(a => a.Value.Operation);



            #line default
            #line hidden
                        WriteLiteral("                    <div");

                        WriteLiteral(" id=\"operations\"");

                        WriteLiteral(">\r\n                        <h2");

                        WriteLiteral(" class=\"greyTitle\"");

                        WriteLiteral(">");


            #line 131 "..\..\Help\Views\ViewEntity.cshtml"
                        Write(Html.PropertyNiceName(() => eh.Entity.Value.Operations));


            #line default
            #line hidden
                        WriteLiteral("</h2>\r\n                        <dl");

                        WriteLiteral(" class=\"dl-horizontal\"");

                        WriteLiteral(">\r\n");


            #line 133 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 133 "..\..\Help\Views\ViewEntity.cshtml"
                        foreach (var op in allowedOperations)
                        {
                            using (TypeElementContext <OperationHelpEntity> ctx = operations.GetOrThrow(op.Key))
                            {
            #line default
            #line hidden
                                WriteLiteral("                                <dt");

                                WriteAttribute("id", Tuple.Create(" id=\"", 5953), Tuple.Create("\"", 5987)

            #line 137 "..\..\Help\Views\ViewEntity.cshtml"
                                               , Tuple.Create(Tuple.Create("", 5958), Tuple.Create <System.Object, System.Int32>(HelpUrls.IdOperation(op.Key)

            #line default
            #line hidden
                                                                                                                                 , 5958), false)
                                               );

                                WriteLiteral(">");


            #line 137 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(op.Key.NiceToString());


            #line default
            #line hidden
                                WriteLiteral("<code");

                                WriteLiteral(" class=\'shortcut\'");

                                WriteLiteral(">[o:");


            #line 137 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(op.Key.Key);


            #line default
            #line hidden
                                WriteLiteral("]</code></dt>\r\n");

                                WriteLiteral("                                <dd>\r\n                                    <span");

                                WriteLiteral(" class=\"info\"");

                                WriteLiteral(">\r\n");

                                WriteLiteral("                                        ");


            #line 140 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.WikiParse(op.Value.Info, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                    </span>\r\n");

                                WriteLiteral("                                    ");


            #line 142 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(ctx));


            #line default
            #line hidden
                                WriteLiteral("\r\n");

                                WriteLiteral("                                    ");


            #line 143 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(ctx, e => e.Culture));


            #line default
            #line hidden
                                WriteLiteral("\r\n");

                                WriteLiteral("                                    ");


            #line 144 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(ctx, a => a.Operation));


            #line default
            #line hidden
                                WriteLiteral("\r\n");

                                WriteLiteral("                                    ");


            #line 145 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.TextArea(ctx.SubContextPrefix(a => a.Description), op.Value.UserDescription, new { @class = "editable" }));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                    <span");

                                WriteLiteral(" class=\"wiki\"");

                                WriteLiteral(">\r\n");

                                WriteLiteral("                                        ");


            #line 147 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.WikiParse(op.Value.UserDescription, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                    </span>\r\n                                </" +
                                             "dd>\r\n");


            #line 150 "..\..\Help\Views\ViewEntity.cshtml"
                            }
                        }


            #line default
            #line hidden
                        WriteLiteral("                        </dl>\r\n                    </div>\r\n");


            #line 154 "..\..\Help\Views\ViewEntity.cshtml"
                    }


            #line default
            #line hidden
                    WriteLiteral("\r\n");


            #line 156 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 156 "..\..\Help\Views\ViewEntity.cshtml"

                    var allowedQueries = eh.Queries.Where(a => a.Value.IsAllowed() == null).ToDictionary();


            #line default
            #line hidden
                    WriteLiteral("\r\n\r\n");


            #line 160 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 160 "..\..\Help\Views\ViewEntity.cshtml"
                    if (allowedQueries.Any())
                    {
                        var queries = ec.TypeElementContext(e => e.Queries).ToDictionary(a => a.Value.Query);



            #line default
            #line hidden
                        WriteLiteral("                    <div");

                        WriteLiteral(" id=\"queries\"");

                        WriteLiteral(">\r\n                        <h2");

                        WriteLiteral(" class=\"greyTitle\"");

                        WriteLiteral(">");


            #line 165 "..\..\Help\Views\ViewEntity.cshtml"
                        Write(typeof(QueryEntity).NicePluralName());


            #line default
            #line hidden
                        WriteLiteral("</h2>\r\n");


            #line 166 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 166 "..\..\Help\Views\ViewEntity.cshtml"
                        foreach (var mq in allowedQueries)
                        {
                            using (TypeElementContext <QueryHelpEntity> qctx = queries.GetOrThrow(QueryLogic.GetQueryEntity(mq.Key)))
                            {
            #line default
            #line hidden

            #line 171 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(qctx));


            #line default
            #line hidden

            #line 171 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden

            #line 172 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(qctx, e => e.Culture));


            #line default
            #line hidden

            #line 172 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden

            #line 173 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.HiddenRuntimeInfo(qctx, a => a.Query));


            #line default
            #line hidden

            #line 173 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden
                                WriteLiteral("                            <h3");

                                WriteAttribute("id", Tuple.Create(" id=\"", 8163), Tuple.Create("\"", 8193)

            #line 174 "..\..\Help\Views\ViewEntity.cshtml"
                                               , Tuple.Create(Tuple.Create("", 8168), Tuple.Create <System.Object, System.Int32>(HelpUrls.IdQuery(mq.Key)

            #line default
            #line hidden
                                                                                                                                 , 8168), false)
                                               );

                                WriteLiteral(">");


            #line 174 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(QueryUtils.GetNiceName(mq.Key));


            #line default
            #line hidden
                                WriteLiteral("</h3>\r\n");

                                WriteLiteral("                            <div");

                                WriteLiteral(" class=\"queryName\"");

                                WriteLiteral(">\r\n                                <code");

                                WriteLiteral(" class=\'shortcut\'");

                                WriteLiteral(">[q:");


            #line 176 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(QueryUtils.GetKey(mq.Key));


            #line default
            #line hidden
                                WriteLiteral("]</code>\r\n                                <span");

                                WriteLiteral(" class=\"info\"");

                                WriteLiteral(">\r\n");

                                WriteLiteral("                                    ");


            #line 178 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.WikiParse(mq.Value.Info, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                </span>\r\n");

                                WriteLiteral("                                ");


            #line 180 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.TextArea(qctx.SubContextPrefix(a => a.Description), mq.Value.UserDescription, new { @class = "editable" }));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                <span");

                                WriteLiteral(" class=\"wiki\"");

                                WriteLiteral(">\r\n");

                                WriteLiteral("                                    ");


            #line 182 "..\..\Help\Views\ViewEntity.cshtml"
                                Write(Html.WikiParse(mq.Value.UserDescription, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                WriteLiteral("\r\n                                </span>\r\n                            </div>\r\n");


            #line 185 "..\..\Help\Views\ViewEntity.cshtml"

                                var allowedColumn = mq.Value.Columns.Where(a => a.Value.IsAllowed() == null);
                                if (allowedColumn.Any())
                                {
                                    var columns = qctx.TypeElementContext(a => a.Columns).ToDictionary(a => a.Value.ColumnName);



            #line default
            #line hidden
                                    WriteLiteral("                            <dl");

                                    WriteLiteral(" class=\"dl-horizontal columns\"");

                                    WriteLiteral(">\r\n");


            #line 192 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 192 "..\..\Help\Views\ViewEntity.cshtml"
                                    foreach (var qc in allowedColumn)
                                    {
                                        using (var ctx = columns.GetOrThrow(qc.Value.Column.Name))
                                        {
            #line default
            #line hidden

            #line 196 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(Html.HiddenRuntimeInfo(ctx));


            #line default
            #line hidden

            #line 196 "..\..\Help\Views\ViewEntity.cshtml"



            #line default
            #line hidden
                                            WriteLiteral("                                    <dt>");


            #line 197 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(qc.Value.NiceName);


            #line default
            #line hidden
                                            WriteLiteral("</dt>\r\n");

                                            WriteLiteral("                                    <dd>\r\n                                       " +
                                                         " <span");

                                            WriteLiteral(" class=\"info\"");

                                            WriteLiteral(">\r\n");

                                            WriteLiteral("                                            ");


            #line 200 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(Html.WikiParse(qc.Value.Info, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                            WriteLiteral("\r\n                                        </span>\r\n");

                                            WriteLiteral("                                        ");


            #line 202 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(Html.Hidden(ctx.SubContextPrefix(a => a.ColumnName), ctx.Value.ColumnName));


            #line default
            #line hidden
                                            WriteLiteral("\r\n");

                                            WriteLiteral("                                        ");


            #line 203 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(Html.TextArea(ctx.SubContextPrefix(a => a.Description), ctx.Value.Description, new { @class = "editable" }));


            #line default
            #line hidden
                                            WriteLiteral("\r\n                                        <span");

                                            WriteLiteral(" class=\"wiki\"");

                                            WriteLiteral(">\r\n");

                                            WriteLiteral("                                            ");


            #line 205 "..\..\Help\Views\ViewEntity.cshtml"
                                            Write(Html.WikiParse(qc.Value.UserDescription, HelpWiki.DefaultWikiSettings));


            #line default
            #line hidden
                                            WriteLiteral("\r\n                                        </span>\r\n                              " +
                                                         "      </dd>\r\n");


            #line 208 "..\..\Help\Views\ViewEntity.cshtml"
                                        }
                                    }


            #line default
            #line hidden
                                    WriteLiteral("                            </dl>\r\n");


            #line 211 "..\..\Help\Views\ViewEntity.cshtml"
                                }
                            }
                        }


            #line default
            #line hidden
                        WriteLiteral("                    </div>\r\n");


            #line 216 "..\..\Help\Views\ViewEntity.cshtml"
                    }


            #line default
            #line hidden
                    WriteLiteral("            </div>\r\n");


            #line 218 "..\..\Help\Views\ViewEntity.cshtml"
                }
            }


            #line default
            #line hidden
            WriteLiteral("    </div>\r\n\r\n    <div");

            WriteLiteral(" class=\"col-md-3\"");

            WriteLiteral(">\r\n");


            #line 223 "..\..\Help\Views\ViewEntity.cshtml"


            #line default
            #line hidden

            #line 223 "..\..\Help\Views\ViewEntity.cshtml"
            Html.RenderPartial(HelpClient.MiniMenu, new ViewDataDictionary {
                { "type", eh.Type }
            });

            #line default
            #line hidden
            WriteLiteral("\r\n    </div>\r\n</div>\r\n");
        }
Пример #18
0
 public override string GetName(DynamicQueryOmniboxResult result)
 {
     return("Q:" + QueryUtils.GetKey(result.QueryName));
 }
Пример #19
0
        private void QueryNameChanged(DependencyPropertyChangedEventArgs s)
        {
            if (DesignerProperties.GetIsInDesignMode(this) || s.NewValue == null)
            {
                return;
            }

            if (!Finder.IsFindable(s.NewValue))
            {
                Common.VoteCollapsed(this);
                return;
            }

            Common.VoteVisible(this);


            Settings = Finder.GetQuerySettings(s.NewValue);

            Description = DynamicQueryServer.GetQueryDescription(s.NewValue);

            if (Settings.SimpleFilterBuilder != null)
            {
                SimpleFilterBuilder = Settings.SimpleFilterBuilder(Description);
            }

            tokenBuilder.Token           = null;
            tokenBuilder.SubTokensEvent += tokenBuilder_SubTokensEvent;

            entityColumn = Description.Columns.SingleOrDefaultEx(a => a.IsEntity);
            if (entityColumn == null)
            {
                throw new InvalidOperationException("Entity Column not found on {0}".FormatWith(QueryUtils.GetKey(QueryName)));
            }
        }
Пример #20
0
 public static List <Lite <ExcelReportEntity> > GetExcelReports(object queryName)
 {
     return((from er in Database.Query <ExcelReportEntity>()
             where er.Query.Key == QueryUtils.GetKey(queryName)
             select er.ToLite()).ToList());
 }
Пример #21
0
 static string QueryKey(object tokenList)
 {
     return("tokens-Query-" + QueryUtils.GetKey(tokenList));
 }
Пример #22
0
        static SqlPreCommand SynchronizeOperations(Replacements replacements, SyncData data)
        {
            var dic = Database.Query <OperationHelpEntity>().ToList();

            if (dic.IsEmpty())
            {
                return(null);
            }

            var queryKeys = DynamicQueryManager.Current.GetQueryNames().ToDictionary(a => QueryUtils.GetKey(a));

            var table = Schema.Current.Table <OperationHelpEntity>();

            var replace = replacements.TryGetC(QueryLogic.QueriesKey);

            using (replacements.WithReplacedDatabaseName())
                return(dic.Select(qh =>
                {
                    qh.Description = SynchronizeContent(qh.Description, replacements, data);

                    return table.UpdateSqlSync(qh);
                }).Combine(Spacing.Simple));
        }
Пример #23
0
        public void OnLoaded()
        {
            if (loaded)
            {
                return;
            }

            loaded = true;

            if (FilterColumn.HasText())
            {
                FilterOptions.Add(new FilterOption
                {
                    ColumnName = FilterColumn,
                    Operation  = FilterOperation.EqualTo,
                    Frozen     = true,
                }.Bind(FilterOption.ValueProperty, new Binding("DataContext" + (FilterRoute.HasText() ? "." + FilterRoute : null))
                {
                    Source = this
                }));

                if (QueryUtils.IsColumnToken(FilterColumn))
                {
                    ColumnOptions.Add(new ColumnOption(FilterColumn));
                    ColumnOptionsMode = ColumnOptionsMode.Remove;
                }
                if (this.NotSet(SearchOnLoadProperty))
                {
                    SearchOnLoad = true;
                }
            }

            if (OrderOptions.IsNullOrEmpty() && !entityColumn.Implementations.Value.IsByAll)
            {
                var orderType = entityColumn.Implementations.Value.Types.All(t => EntityKindCache.GetEntityData(t) == EntityData.Master) ? OrderType.Ascending : OrderType.Descending;

                var column = Description.Columns.SingleOrDefaultEx(c => c.Name == "Id");

                if (column != null)
                {
                    OrderOptions.Add(new OrderOption(column.Name, orderType));
                }
            }

            btCreate.ToolTip = SearchMessage.CreateNew0_G.NiceToString()
                               .ForGenderAndNumber(entityColumn.Implementations.Value.Types.FirstOrDefault()?.GetGender() ?? 'm')
                               .FormatWith(entityColumn.Implementations.Value.Types.CommaOr(a => a.NiceName()));

            if (this.NotSet(SearchControl.NavigateProperty) && Navigate)
            {
                Navigate = Implementations.IsByAll ? true :
                           Implementations.Types.Any(t => Navigator.IsNavigable(t, isSearch: true));
            }

            if (this.NotSet(EntityBase.CreateProperty) && Create)
            {
                Create = Implementations.IsByAll ? false :
                         Implementations.Types.Any(t => Navigator.IsCreable(t, isSearch: true));
            }

            ColumnOption.SetColumnTokens(ColumnOptions, Description);

            if (this.CanAddFilters || this.AllowChangeColumns)
            {
                headerContextMenu = new ContextMenu();

                if (this.CanAddFilters)
                {
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = SearchMessage.AddFilter.NiceToString()
                    }.Handle(MenuItem.ClickEvent, filterHeader_Click));
                }

                if (this.CanAddFilters && this.AllowChangeColumns)
                {
                    headerContextMenu.Items.Add(new Separator());
                }

                if (this.AllowChangeColumns)
                {
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = SearchMessage.Rename.NiceToString()
                    }.Handle(MenuItem.ClickEvent, renameMenu_Click));
                    headerContextMenu.Items.Add(new MenuItem {
                        Header = EntityControlMessage.Remove.NiceToString()
                    }.Handle(MenuItem.ClickEvent, removeMenu_Click));
                }
            }

            GenerateListViewColumns();

            FilterOption.SetFilterTokens(FilterOptions, Description);

            filterBuilder.Filters = FilterOptions;
            ((INotifyCollectionChanged)FilterOptions).CollectionChanged += FilterOptions_CollectionChanged;

            OrderOption.SetOrderTokens(OrderOptions, Description);

            SortGridViewColumnHeader.SetColumnAdorners(gvResults, OrderOptions);

            if (IsVisible)
            {
                FillMenuItems();

                if (SearchOnLoad)
                {
                    Search();
                }
            }
            else
            {
                IsVisibleChanged += SearchControl_IsVisibleChanged;
            }

            UpdateVisibility();

            AutomationProperties.SetName(this, QueryUtils.GetKey(QueryName));

            foreach (var item in FilterOptions)
            {
                item.BindingValueChanged += new DependencyPropertyChangedEventHandler(item_BindingValueChanged);
            }
        }
Пример #24
0
 private static Dictionary <string, object> CreateQueryNames()
 {
     return(Queries.GetQueryNames().ToDictionaryEx(qn => QueryUtils.GetKey(qn), "queryName"));
 }
Пример #25
0
        public static void SetQueryRules(QueryRulePack rules)
        {
            string[] queryKeys = QueryLogic.Queries.GetTypeQueries(TypeLogic.EntityToType[rules.Type]).Keys.Select(qn => QueryUtils.GetKey(qn)).ToArray();

            cache.SetRules(rules, r => queryKeys.Contains(r.Key));
        }
Пример #26
0
 public static SearchWindowProxy QuickLinkExplore(this LeftPanelProxy left, object queryName)
 {
     return(left.QuickLinkCapture(QueryUtils.GetKey(queryName)).ToSearchWindow());
 }
Пример #27
0
        static Implementations DefaultImplementations(Type type, object queryName)
        {
            var property = type.GetProperty("Entity", BindingFlags.Instance | BindingFlags.Public);

            if (property == null)
            {
                throw new InvalidOperationException("Entity property not found on query {0}".FormatWith(QueryUtils.GetKey(queryName)));
            }

            return(Implementations.By(property.PropertyType.CleanType()));
        }
Пример #28
0
 public static NormalWindowProxy <T> QuickLinkNavigate <T>(this LeftPanelProxy left) where T : Entity
 {
     return(left.QuickLinkCapture(QueryUtils.GetKey(typeof(T).FullName)).ToNormalWindow <T>());
 }
Пример #29
0
        public DynamicQueryBucket(object queryName, Func <IDynamicQueryCore> lazyQueryCore, Implementations entityImplementations)
        {
            if (lazyQueryCore == null)
            {
                throw new ArgumentNullException("lazyQueryCore");
            }

            this.QueryName             = queryName ?? throw new ArgumentNullException("queryName");
            this.EntityImplementations = entityImplementations;

            this.Core = new ResetLazy <IDynamicQueryCore>(() =>
            {
                var core = lazyQueryCore();

                core.QueryName = QueryName;

                core.StaticColumns.Where(sc => sc.IsEntity).SingleEx(() => "Entity column on {0}".FormatWith(QueryUtils.GetKey(QueryName)));

                core.EntityColumnFactory().Implementations = entityImplementations;

                var errors = core.StaticColumns.Where(sc => sc.Implementations == null && sc.Type.CleanType().IsIEntity()).CommaAnd(a => $"'{a.Name}'");

                if (errors.HasText())
                {
                    throw new InvalidOperationException("Column {0} of query '{1}' do(es) not have implementations deffined. Use Column extension method".FormatWith(errors, QueryUtils.GetKey(QueryName)));
                }

                return(core);
            });
        }
Пример #30
0
 private static Dictionary <string, object> CreateQueryNames()
 {
     return(DynamicQueryManager.Current.GetQueryNames().ToDictionaryEx(qn => QueryUtils.GetKey(qn), "queryName"));
 }