public static void Start(IApplicationBuilder app) { TypeHelpServer.Start(app); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); ReflectionServer.RegisterLike(typeof(TemplateTokenMessage)); EntityJsonConverter.AfterDeserilization.Register((EmailTemplateEntity et) => { if (et.Query != null) { var qd = QueryLogic.Queries.QueryDescription(et.Query.ToQueryName()); et.ParseData(qd); } }); QueryDescriptionTS.AddExtension += qd => { object type = QueryLogic.ToQueryName(qd.queryKey); if (Schema.Current.IsAllowed(typeof(EmailTemplateEntity), true) == null) { var templates = EmailTemplateLogic.GetApplicableEmailTemplates(type, null, EmailTemplateVisibleOn.Query); if (templates.HasItems()) { qd.Extension.Add("emailTemplates", templates); } } }; }
public static void Start(HttpConfiguration config) { SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); ReflectionServer.RegisterLike(typeof(TemplateTokenMessage)); EntityJsonConverter.AfterDeserilization.Register((EmailTemplateEntity et) => { if (et.Query != null) { var qd = DynamicQueryManager.Current.QueryDescription(et.Query.ToQueryName()); et.ParseData(qd); } }); QueryDescriptionTS.AddExtension += qd => { object type = QueryLogic.ToQueryName(qd.queryKey); var templates = EmailTemplateLogic.GetApplicableEmailTemplates(type, null, EmailTemplateVisibleOn.Query); if (templates.HasItems()) { qd.Extension.Add("emailTemplates", templates); } }; }
public async Task <ResultTable> FindRowsLike([Required, FromBody] AutocompleteQueryRequestTS request, CancellationToken token) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = QueryLogic.Queries.QueryDescription(qn); var dqRequest = new DQueryableRequest { QueryName = qn, Columns = request.columns.EmptyIfNull().Select(a => a.ToColumn(qd, false)).ToList(), Filters = request.filters.EmptyIfNull().Select(a => a.ToFilter(qd, false)).ToList(), Orders = request.orders.EmptyIfNull().Select(a => a.ToOrder(qd, false)).ToList() }; var dqueryable = QueryLogic.Queries.GetDQueryable(dqRequest); var entityType = qd.Columns.Single(a => a.IsEntity).Implementations !.Value.Types.SingleEx(); var result = await dqueryable.Query.AutocompleteUntypedAsync(dqueryable.Context.GetEntitySelector(), request.subString, request.count, entityType, token); var columnAccessors = dqRequest.Columns.Select(c => ( column: c, lambda: Expression.Lambda(c.Token.BuildExpression(dqueryable.Context), dqueryable.Context.Parameter) )).ToList(); return(DQueryable.ToResultTable(result.ToArray(), columnAccessors, null, new Pagination.Firsts(request.count))); }
static void UserQueryLogic_Retrieved(UserQueryEntity userQuery) { object queryName = QueryLogic.ToQueryName(userQuery.Query.Key); QueryDescription description = DynamicQueryManager.Current.QueryDescription(queryName); userQuery.ParseData(description); }
static void PredictorMultiColumnEntity_Retrieved(PredictorMultiColumnEntity mc) { object queryName = QueryLogic.ToQueryName(mc.Query.Key); QueryDescription description = DynamicQueryManager.Current.QueryDescription(queryName); mc.ParseData(description); }
static void PredictorEntity_Retrieved(PredictorEntity predictor) { object queryName = QueryLogic.ToQueryName(predictor.Query.Key); QueryDescription description = DynamicQueryManager.Current.QueryDescription(queryName); predictor.ParseData(description); }
public List <Lite <EmailTemplateEntity> > GetEmailTemplates(string queryKey, EmailTemplateVisibleOn visibleOn, [Required, FromBody] GetEmailTemplatesRequest request) { object queryName = QueryLogic.ToQueryName(queryKey); var entity = request.lite?.RetrieveAndForget(); return(EmailTemplateLogic.GetApplicableEmailTemplates(queryName, entity, visibleOn)); }
public List <Lite <EmailTemplateEntity> > GetWordTemplates(string queryKey, EmailTemplateVisibleOn visibleOn, Lite <Entity> lite) { object queryName = QueryLogic.ToQueryName(queryKey); var entity = lite?.RetrieveAndForget(); return(EmailTemplateLogic.GetApplicableEmailTemplates(queryName, entity, visibleOn)); }
static void Newsletter_PreSaving(NewsletterEntity newsletter, ref bool graphModified) { var queryname = QueryLogic.ToQueryName(newsletter.Query.Key); QueryDescription qd = DynamicQueryManager.Current.QueryDescription(queryname); newsletter.Subject = EmailTemplateParser.Parse(newsletter.Subject, qd, null).ToString(); newsletter.Text = EmailTemplateParser.Parse(newsletter.Text, qd, null).ToString(); }
public List<Lite<WordTemplateEntity>> GetWordTemplates(string queryKey, WordTemplateVisibleOn visibleOn, [Required, FromBody]GetWordTemplatesRequest request) { object type = QueryLogic.ToQueryName(queryKey); var entity = request.lite?.RetrieveAndForget(); return WordTemplateLogic.GetApplicableWordTemplates(type, entity, visibleOn); }
public static FindOptions ToFindOptions(this UserQueryEntity userQuery) { object queryName = QueryLogic.ToQueryName(userQuery.Query.Key); var result = new FindOptions(queryName); result.ApplyUserQuery(userQuery); return(result); }
public List <Lite <Entity> > GetEntitiesWithFilter(QueryEntitiesRequestTS request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); var filters = request.filters.EmptyIfNull().Select(f => f.ToFilter(qd, canAggregate: false)).ToList(); return(DynamicQueryManager.Current.GetEntities(qn, filters).Take(request.count).ToList()); }
public List <QueryTokenTS> ParseTokens([Required, FromBody] ParseTokensRequest request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = QueryLogic.Queries.QueryDescription(qn); var tokens = request.tokens.Select(tr => QueryUtils.Parse(tr.token, qd, tr.options)).ToList(); return(tokens.Select(qt => new QueryTokenTS(qt, recursive: true)).ToList()); }
public List <QueryTokenTS> ParseTokens(ParseTokensRequest request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); var tokens = request.tokens.Select(tr => QueryUtils.Parse(tr.token, qd, tr.options)).ToList(); return(tokens.Select(qt => new QueryTokenTS(qt, recursive: true)).ToList()); }
public EmailMessageBuilder(EmailTemplateEntity template, Entity entity, ISystemEmail systemEmail) { this.template = template; this.entity = entity; this.systemEmail = systemEmail; this.queryName = QueryLogic.ToQueryName(template.Query.Key); this.qd = DynamicQueryManager.Current.QueryDescription(queryName); this.smtpConfig = EmailTemplateLogic.GetSmtpConfiguration == null ? null : EmailTemplateLogic.GetSmtpConfiguration(template); }
public EmailMessageBuilder(EmailTemplateEntity template, Entity?entity, IEmailModel?systemEmail) { this.template = template; this.entity = entity; this.model = systemEmail; this.queryName = QueryLogic.ToQueryName(template.Query.Key); this.qd = QueryLogic.Queries.QueryDescription(queryName); this.smtpConfig = EmailTemplateLogic.GetSmtpConfiguration?.Invoke(template, (systemEmail?.UntypedEntity as Entity ?? entity)?.ToLite()); }
static void EmailTemplateLogic_Retrieved(EmailTemplateEntity emailTemplate) { using (emailTemplate.DisableAuthorization ? ExecutionMode.Global() : null) { object queryName = QueryLogic.ToQueryName(emailTemplate.Query.Key); QueryDescription description = QueryLogic.Queries.QueryDescription(queryName); using (emailTemplate.DisableAuthorization ? ExecutionMode.Global() : null) emailTemplate.ParseData(description); } }
public static TextTemplateParser.BlockNode ParseTemplate(EmailTemplateEntity template, string?text, out string errorMessage) { using (template.DisableAuthorization ? ExecutionMode.Global() : null) { object queryName = QueryLogic.ToQueryName(template.Query.Key); QueryDescription qd = QueryLogic.Queries.QueryDescription(queryName); List <QueryToken> list = new List <QueryToken>(); return(TextTemplateParser.TryParse(text, qd, template.Model?.ToType(), out errorMessage)); } }
public List <Lite <Entity> > FindLiteLikeWithFilters(AutocompleteQueryRequestTS request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); var filters = request.filters.Select(a => a.ToFilter(qd, false)).ToList(); var entitiesQuery = DynamicQueryManager.Current.GetEntities(qn, filters); var entityType = qd.Columns.Single(a => a.IsEntity).Implementations.Value.Types.SingleEx(); return(entitiesQuery.AutocompleteUntyped(request.subString, request.count, entityType)); }
public List <QueryTokenTS> SubTokens(SubTokensRequest request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); var token = request.token == null ? null: QueryUtils.Parse(request.token, qd, request.options); var tokens = QueryUtils.SubTokens(token, qd, request.options); return(tokens.Select(qt => new QueryTokenTS(qt, recursive: false)).ToList()); }
public List <QueryTokenTS> SubTokens([Required, FromBody] SubTokensRequest request) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = QueryLogic.Queries.QueryDescription(qn); var token = request.token == null ? null: QueryUtils.Parse(request.token, qd, request.options); var tokens = QueryUtils.SubTokens(token, qd, request.options); return(tokens.Select(qt => new QueryTokenTS(qt, recursive: false)).ToList()); }
public static void Start(IApplicationBuilder app) { TypeHelpServer.Start(app); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); ReflectionServer.OverrideIsNamespaceAllowed.Add(typeof(ExchangeVersion).Namespace !, () => TypeAuthLogic.GetAllowed(typeof(EmailSenderConfigurationEntity)).MaxUI() > TypeAllowedBasic.None); ReflectionServer.OverrideIsNamespaceAllowed.Add(typeof(SmtpDeliveryMethod).Namespace !, () => TypeAuthLogic.GetAllowed(typeof(EmailSenderConfigurationEntity)).MaxUI() > TypeAllowedBasic.None); TemplatingServer.Start(app); EntityJsonConverter.AfterDeserilization.Register((EmailTemplateEntity et) => { if (et.Query != null) { var qd = QueryLogic.Queries.QueryDescription(et.Query.ToQueryName()); et.ParseData(qd); } }); QueryDescriptionTS.AddExtension += qd => { object type = QueryLogic.ToQueryName(qd.queryKey); if (Schema.Current.IsAllowed(typeof(EmailTemplateEntity), true) == null) { var templates = EmailTemplateLogic.GetApplicableEmailTemplates(type, null, EmailTemplateVisibleOn.Query); if (templates.HasItems()) { qd.Extension.Add("emailTemplates", templates); } } }; if (Schema.Current.Tables.ContainsKey(typeof(EmailSenderConfigurationEntity))) { var piPassword = ReflectionTools.GetPropertyInfo((SmtpNetworkDeliveryEmbedded e) => e.Password); var pcs = PropertyConverter.GetPropertyConverters(typeof(SmtpNetworkDeliveryEmbedded)); pcs.GetOrThrow("password").CustomWriteJsonProperty = ctx => { }; pcs.Add("newPassword", new PropertyConverter { AvoidValidate = true, CustomWriteJsonProperty = ctx => { }, CustomReadJsonProperty = ctx => { EntityJsonConverter.AssertCanWrite(ctx.ParentPropertyRoute.Add(piPassword)); var password = (string)ctx.JsonReader.Value !; ((SmtpNetworkDeliveryEmbedded)ctx.Entity).Password = EmailSenderConfigurationLogic.EncryptPassword(password); } });
private static QueryTokenEmbedded ParseQueryToken(string tokenString, string queryRuntimeInfoInput) { if (tokenString.IsNullOrEmpty()) { return(null); } var queryRuntimeInfo = RuntimeInfo.FromFormValue(queryRuntimeInfoInput); var queryName = QueryLogic.ToQueryName(((Lite <QueryEntity>)queryRuntimeInfo.ToLite()).InDB(q => q.Key)); QueryDescription qd = DynamicQueryManager.Current.QueryDescription(queryName); return(new QueryTokenEmbedded(QueryUtils.Parse(tokenString, qd, SubTokensOptions.CanElement))); }
public async Task <List <Lite <Entity> > > GetEntitiesWithFilter(QueryEntitiesRequestTS request, CancellationToken token) { var qn = QueryLogic.ToQueryName(request.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); return(await DynamicQueryManager.Current.GetEntities(new QueryEntitiesRequest { QueryName = qn, Count = request.count, Filters = request.filters.EmptyIfNull().Select(f => f.ToFilter(qd, canAggregate: false)).ToList(), Orders = request.orders.EmptyIfNull().Select(f => f.ToOrder(qd, canAggregate: false)).ToList(), }).ToListAsync()); }
public List <FilterNode> ParseFilters([Required, FromBody] ParseFiltersRequest request) { var queryName = QueryLogic.ToQueryName(request.queryKey); var qd = QueryLogic.Queries.QueryDescription(queryName); var options = SubTokensOptions.CanAnyAll | SubTokensOptions.CanElement | (request.canAggregate ? SubTokensOptions.CanAggregate : 0); using (request.entity != null ? CurrentEntityConverter.SetCurrentEntity(request.entity.RetrieveAndRemember()) : null) { var result = ParseFilterInternal(request.filters, qd, options, 0).ToList(); return(result); } }
public QueryEntitiesRequest ToQueryEntitiesRequest() { var qn = QueryLogic.ToQueryName(queryKey); var qd = QueryLogic.Queries.QueryDescription(qn); return(new QueryEntitiesRequest { QueryName = qn, Count = count, Filters = filters.EmptyIfNull().Select(f => f.ToFilter(qd, canAggregate: false)).ToList(), Orders = orders.EmptyIfNull().Select(f => f.ToOrder(qd, canAggregate: false)).ToList(), }); }
static void ChartLogic_Retrieved(UserChartEntity userQuery) { object queryName = QueryLogic.ToQueryName(userQuery.Query.Key); QueryDescription description = DynamicQueryManager.Current.QueryDescription(queryName); foreach (var item in userQuery.Columns) { item.parentChart = userQuery; } userQuery.ParseData(description); }
public QueryValueRequest ToQueryCountRequest() { var qn = QueryLogic.ToQueryName(this.querykey); var qd = DynamicQueryManager.Current.QueryDescription(qn); var value = valueToken.HasText() ? QueryUtils.Parse(valueToken, qd, SubTokensOptions.CanAggregate | SubTokensOptions.CanElement) : null; return(new QueryValueRequest { QueryName = qn, Filters = this.filters.EmptyIfNull().Select(f => f.ToFilter(qd, canAggregate: false)).ToList(), ValueToken = value, }); }
public static void Start(IApplicationBuilder app) { TypeHelpServer.Start(app); SignumControllerFactory.RegisterArea(MethodInfo.GetCurrentMethod()); TemplatingServer.Start(app); CustomizeFiltersModel(); EntityPackTS.AddExtension += ep => { if (ep.entity.IsNew || !WordTemplatePermission.GenerateReport.IsAuthorized()) { return; } var wordTemplates = WordTemplateLogic.TemplatesByEntityType.Value.TryGetC(ep.entity.GetType()); if (wordTemplates != null) { var applicable = wordTemplates.Where(a => a.IsApplicable(ep.entity)); if (applicable.HasItems()) { ep.extension.Add("wordTemplates", applicable.Select(a => a.ToLite()).ToList()); } } }; QueryDescriptionTS.AddExtension += qd => { object type = QueryLogic.ToQueryName(qd.queryKey); if (Schema.Current.IsAllowed(typeof(WordTemplateEntity), true) == null) { var templates = WordTemplateLogic.GetApplicableWordTemplates(type, null, WordTemplateVisibleOn.Query); if (templates.HasItems()) { qd.Extension.Add("wordTemplates", templates); } } }; EntityJsonConverter.AfterDeserilization.Register((WordTemplateEntity uq) => { if (uq.Query != null) { var qd = QueryLogic.Queries.QueryDescription(uq.Query.ToQueryName()); uq.ParseData(qd); } }); }
public QueryRequest ToQueryRequest() { var qn = QueryLogic.ToQueryName(this.queryKey); var qd = DynamicQueryManager.Current.QueryDescription(qn); return(new QueryRequest { QueryName = qn, Filters = this.filters.EmptyIfNull().Select(f => f.ToFilter(qd, canAggregate: false)).ToList(), Orders = this.orders.EmptyIfNull().Select(f => f.ToOrder(qd, canAggregate: false)).ToList(), Columns = this.columns.EmptyIfNull().Select(f => f.ToColumn(qd)).ToList(), Pagination = this.pagination.ToPagination() }); }