Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        static string?ValidateTokens(NewsletterEntity newsletter, string?text)
        {
            var queryName = QueryLogic.ToQueryName(newsletter.Query !.Key);

            QueryDescription qd = QueryLogic.Queries.QueryDescription(queryName);

            try
            {
                TextTemplateParser.TryParse(text, qd, null, out string error);

                return(error.DefaultToNull());
            }
            catch (Exception e)
            {
                return(e.Message);
            }
        }