Exemple #1
0
    public static void Start(IApplicationBuilder app)
    {
        UserAssetServer.Start(app);

        SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod());

        SignumServer.WebEntityJsonConverterFactory.AfterDeserilization.Register((UserQueryEntity uq) =>
        {
            if (uq.Query != null)
            {
                var qd = QueryLogic.Queries.QueryDescription(uq.Query.ToQueryName());
                uq.ParseData(qd);
            }
        });

        EntityPackTS.AddExtension += ep =>
        {
            if (ep.entity.IsNew || !UserQueryPermission.ViewUserQuery.IsAuthorized())
            {
                return;
            }

            var userQueries = UserQueryLogic.GetUserQueriesEntity(ep.entity.GetType());
            if (userQueries.Any())
            {
                ep.extension.Add("userQueries", userQueries);
            }
        };
    }
 public IEnumerable <Lite <UserQueryEntity> > FromEntityType(string typeName)
 {
     return(UserQueryLogic.GetUserQueriesEntity(TypeLogic.GetType(typeName)));
 }
Exemple #3
0
        public static void Start()
        {
            if (Navigator.Manager.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                QueryClient.Start();

                Navigator.RegisterArea(typeof(UserQueriesClient));

                UserAssetsClient.Start();
                UserAssetsClient.RegisterExportAssertLink <UserQueryEntity>();

                LinksClient.RegisterEntityLinks <UserQueryEntity>((lite, ctx) => new[]
                {
                    new QuickLinkAction(UserQueryMessage.Preview, RouteHelper.New().Action <UserQueriesController>(cc => cc.View(lite, null, null)))
                    {
                        IsVisible = UserQueryPermission.ViewUserQuery.IsAuthorized()
                    }
                });

                RouteTable.Routes.MapRoute(null, "UQ/{webQueryName}/{lite}",
                                           new { controller = "UserQueries", action = "View" });

                Navigator.AddSettings(new List <EntitySettings>
                {
                    new EntitySettings <UserQueryEntity> {
                        PartialViewName = e => ViewPrefix.FormatWith("UserQuery"), IsCreable = EntityWhen.Never
                    },

                    new EmbeddedEntitySettings <QueryFilterEmbedded>
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("QueryFilter"),
                        MappingDefault  = new EntityMapping <QueryFilterEmbedded>(false)
                                          .SetProperty(a => a.Token, QueryTokenMapping(SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement))
                                          .CreateProperty(a => a.Operation)
                                          .CreateProperty(a => a.ValueString)
                    },

                    new EmbeddedEntitySettings <QueryColumnEmbedded>
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("QueryColumn"),
                        MappingDefault  = new EntityMapping <QueryColumnEmbedded>(false)
                                          .SetProperty(a => a.Token, QueryTokenMapping(SubTokensOptions.CanElement))
                                          .CreateProperty(a => a.DisplayName)
                    },

                    new EmbeddedEntitySettings <QueryOrderEmbedded>
                    {
                        PartialViewName = e => ViewPrefix.FormatWith("QueryOrder"),
                        MappingDefault  = new EntityMapping <QueryOrderEmbedded>(false)
                                          .SetProperty(a => a.Token, QueryTokenMapping(SubTokensOptions.CanElement))
                                          .CreateProperty(a => a.OrderType)
                    },
                });

                ButtonBarQueryHelper.RegisterGlobalButtons(ButtonBarQueryHelper_GetButtonBarForQueryName);

                OperationClient.AddSettings(new List <OperationSettings>
                {
                    new EntityOperationSettings <UserQueryEntity>(UserQueryOperation.Delete)
                    {
                        Click = ctx => Module["deleteUserQuery"](ctx.Options(), Finder.FindRoute(((UserQueryEntity)ctx.Entity).Query.ToQueryName())),
                    }
                });

                LinksClient.RegisterEntityLinks <Entity>((entity, ctrl) =>
                {
                    if (!UserQueryPermission.ViewUserQuery.IsAuthorized())
                    {
                        return(null);
                    }

                    return(UserQueryLogic.GetUserQueriesEntity(entity.EntityType)
                           .Select(cp => new UserQueryQuickLink(cp, entity)).ToArray());
                });
            }
        }