Exemple #1
0
        /// <summary> Crea el cuerpo del Mail a ser enviado
        /// </summary>
        /// <param name="receptor"></param>
        /// <param name="replacements"></param>
        public void CreateMessage(Receptor receptor, ListDictionary replacements)
        {
            var html = HtmlBody.ToString();

            if (FuncHtmlParse != null)
            {
                html = FuncHtmlParse.Invoke(receptor, html);
            }

            Mensaje = Definition.CreateMailMessage(receptor.Email, replacements, html, new System.Web.UI.Control());

            //var header = new Attachment(Properties.Resources.logo_agc.ToStream(ImageFormat.Png), "header.png", "image/png")
            //{
            //    ContentId = "header"
            //};

            //var footer = new Attachment(Properties.Resources.footer_mail.ToStream(ImageFormat.Png), "footer.png", "image/png")
            //{
            //    ContentId = "footer"
            //};

            //Mensaje.Attachments.Add(header);
            //Mensaje.Attachments.Add(footer);
        }
Exemple #2
0
        public string ToHtml(Card card)
        {
            var html = new StringBuilder();

            if (!string.IsNullOrEmpty(Prefix))
            {
                html.Append(Prefix);
            }

            switch (TokenType)
            {
            case EffectTokenType.Attack_Icon:
                html.Append("<img src='/Images/attack.gif'>");
                break;

            case EffectTokenType.Defense_Icon:
                html.Append("<img src='/Images/defense.gif'>");
                break;

            case EffectTokenType.Self:
                html.Append(card.Title);
                break;

            case EffectTokenType.Card_Title:
                //html.AppendFormat("<a href='/Cards/Search?Query=%2Btitle%3A{0}' target='_blank' title='{1}'>{1}</a>", card.Title.UrlEncode(), card.Title);
                break;

            case EffectTokenType.Specific_Card:
                //var specific = (Card)Body;
                //html.AppendFormat("<a href='/Cards/Details/{0} target='_blank' title={1}'>{1}</a>", specific.Slug, specific.Title);
                break;

            case EffectTokenType.Text:
            case EffectTokenType.Inline_Text:
            case EffectTokenType.Inline_Prefix:
                html.Append(HtmlBody.ToString());
                break;

            case EffectTokenType.Flavor_Text:
                html.AppendFormat("<i>{0}</i>", HtmlBody.ToString());
                break;

            case EffectTokenType.Trigger:
            {
                if (TextBody.ToString() == "Shadow:")
                {
                    html.Append("<br/><img src='/Images/ShadowDivider.png' style='display:block;margin-left:auto;margin-right:auto;width:285px;'/><br/>");
                }

                html.AppendFormat("<strong>{0}</strong>", HtmlBody.ToString());
            }
            break;

            default:
                break;
            }

            if (!string.IsNullOrEmpty(Suffix))
            {
                html.Append(Suffix);
            }

            return(html.ToString());
        }