Exemplo n.º 1
0
        //
        private static string getMessages(string typeMessage)
        {
            StringBuilder html = new StringBuilder();
            List <string> list = (List <string>)UtilMessage.TempData[typeMessage];

            if (list == null || list.Count == 0)
            {
                return("");
            }

            foreach (string message in list)
            {
                html.AppendLine(message).Append("<br />");
            }

            var tagBuilder = new TagBuilder("div");

            tagBuilder.AddCssClass("alert");
            tagBuilder.AddCssClass(string.Concat("alert-", typeMessage));
            tagBuilder.AddCssClass("alert-dismissable");
            tagBuilder.InnerHtml += "<i class=\"fa " + FlashMessage.getIconMessage(typeMessage) + "\"></i>";
            tagBuilder.InnerHtml += ("<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button> <b>" + FlashMessage.getTitleMessage(typeMessage) + "</b>!<br />");
            tagBuilder.InnerHtml += html.ToString();

            UtilMessage.TempData[typeMessage] = null;
            return(new MvcHtmlString(tagBuilder.ToString()).ToHtmlString());
        }
Exemplo n.º 2
0
        //Devolve uma string sem acentos
        public static MvcHtmlString showFlashMessage(this HtmlHelper helper, string typeMessage, string message)
        {
            var tagBuilder = new TagBuilder("div");

            tagBuilder.AddCssClass("alert");
            tagBuilder.AddCssClass(string.Concat("alert-", typeMessage));
            tagBuilder.AddCssClass("alert-dismissable");
            tagBuilder.InnerHtml += "<i class=\"fa " + FlashMessage.getIconMessage(typeMessage) + "\"></i>";
            tagBuilder.InnerHtml += ("<button type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">&times;</button> <b>" + FlashMessage.getTitleMessage(typeMessage) + "</b>!" + message);
            return(new MvcHtmlString(tagBuilder.ToString()));
        }