Beispiel #1
0
        internal string RenderTitle(View view)
        {
            try
            {
                if (_pageTitle == null)
                {
                    return(null);
                }

                return(_templateParser.Render(_pageTitle, new TemplateParserContext(view, this)));
            }
            catch (TemplateParserException ex)
            {
                throw new ViciMvcException("Error rendering template " + Path.GetFileName(_fileName), ex);
            }
        }
Beispiel #2
0
        protected virtual void ParseMessage(NotificationMessage message, object payLoad)
        {
            if (message.Body == null && message.To == null && message.Subject == null)
            {
                return;
            }

            if (message.Body != null)
            {
                message.Body.Content = parser.Render(message.Body.Content, payLoad);
            }

            if (message.To != null)
            {
                foreach (var to in message.To)
                {
                    to.Address = parser.Render(to.Address, payLoad);

                    if (!string.IsNullOrEmpty(to.Name))
                    {
                        to.Name = parser.Render(to.Name, payLoad);
                    }
                }
            }

            if (message.BccTo != null)
            {
                foreach (var bccTo in message.BccTo)
                {
                    bccTo.Address = parser.Render(bccTo.Address, payLoad);

                    if (!string.IsNullOrEmpty(bccTo.Name))
                    {
                        bccTo.Name = parser.Render(bccTo.Name, payLoad);
                    }
                }
            }

            if (message.CcTo != null)
            {
                foreach (var ccTo in message.CcTo)
                {
                    ccTo.Address = parser.Render(ccTo.Address, payLoad);

                    if (!string.IsNullOrEmpty(ccTo.Name))
                    {
                        ccTo.Name = parser.Render(ccTo.Name, payLoad);
                    }
                }
            }

            if (message.Subject != null)
            {
                message.Subject.Content = parser.Render(message.Subject.Content, payLoad);
            }
        }