public static HtmlString PageNotification(this HtmlHelper htmlHelper, string message, PageNotificationType type, bool showIcon = false) { StringBuilder stringBuilder = new StringBuilder(); //stringBuilder.Append("<div class=\"ui-widget\">"); var template = "<div class=\"alert {0}\">{2}<a class=\"close\" onclick=\"fogbugzpd.web.closeAlert();return false;\" href=\"#\">×</a><p>{1}</p></div>"; var result = ""; //string style = ""; //string icon = ""; //string title = ""; //string color = ""; switch (type) { case PageNotificationType.Error: result = String.Format(template, "alert-error", message, ""); //style = "<div class=\"ui-state-error ui-corner-all\" style=\"padding: 0pt 07.em;\">"; //icon = "<providern class=\"ui-icon ui-icon-alert\" style=\"float: left; margin-right: 0.3em;\"></providern>"; //title = "<strong>Alert:</strong> "; break; case PageNotificationType.Progress: result = String.Format(template, "alert-block", message, showIcon ? "<span class=\"icon-progress\" style=\"float: left; margin-right: 0.3em;\"></span>" : ""); //style = "<div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0pt 07.em;\">"; //icon = "<providern class=\"ui-icon-progress\" style=\"float: left; margin-right: 0.3em;\"></providern>"; //title = "<strong style=\"color:#000000;\">Progress:</strong> "; //color = "color:#000000;"; break; case PageNotificationType.Success: result = String.Format(template, "alert-success", message, ""); //style = "<div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0pt 07.em;\">"; //icon = "<providern class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: 0.3em;\"></providern>"; //title = ""; break; default: result = String.Format(template, "alert-info", message, ""); //style = "<div class=\"ui-state-highlight ui-corner-all\" style=\"padding: 0pt 07.em;\">"; //icon = "<providern class=\"ui-icon ui-icon-info\" style=\"float: left; margin-right: 0.3em;\"></providern>"; //title = ""; break; } //stringBuilder.Append(style); //stringBuilder.Append("<p style=\"margin-top:0px; margin-bottom:0px; " + color + "\">"); //stringBuilder.Append(icon); //stringBuilder.Append(title); //stringBuilder.Append(message); //stringBuilder.Append("</p>"); //stringBuilder.Append("</div>"); //stringBuilder.Append("</div>"); stringBuilder.Append(result); return stringBuilder.ToHtmlString(); }
public static void SetNotification(PageNotificationType type, string message) { PageNotification = new PageNotification { Type = type, Message = message }; }
public PageNotification(PageNotificationType type, string message) { Type = type; Message = message; }