Ejemplo n.º 1
0
        public static void ShowNotify(Control control, string strMessage, Enums.TypeMessage strType, string strTitle = "")
        {
            try
            {
                string strPageTitle = control.Page.Title;
                if (string.IsNullOrEmpty(strPageTitle))
                {
                    var title = control.Page.Master?.FindControl("TitleApp") as System.Web.UI.HtmlControls.HtmlTitle;
                    if (title != null)
                    {
                        strPageTitle = title.Text.Trim();
                    }
                    else
                    {
                        strPageTitle = "Mensaje";
                    }
                }

                ScriptManager.RegisterStartupScript(control, control.GetType(), "Message",
                                                    "$.notify({" +
                                                    "icon: '" + GetIconString(strType) + "'," +
                                                    "title: '<strong>" + HttpUtility.JavaScriptStringEncode((string.IsNullOrEmpty(strTitle) ? SiteMap.CurrentNode != null ? SiteMap.CurrentNode.Title : strPageTitle : strTitle)) + ":</strong>'," +
                                                    "message: '" + HttpUtility.JavaScriptStringEncode(strMessage.Trim()) + "'" +
                                                    "},{" +
                                                    "type: '" + GetTypeString(strType) + "'" +
                                                    "});"
                                                    , true);
            }
            catch { }
        }
Ejemplo n.º 2
0
        public static string GetIconString(Enums.TypeMessage typeMessage)
        {
            switch (typeMessage)
            {
            case Enums.TypeMessage.Notice:
                return("glyphicon glyphicon-info-sign");

            case Enums.TypeMessage.Success:
                return("glyphicon glyphicon-ok");

            case Enums.TypeMessage.Warning:
                return("glyphicon glyphicon-alert");

            default:
                return("glyphicon-exclamation-sign");
            }
        }
Ejemplo n.º 3
0
        public static string GetTypeString(Enums.TypeMessage typeMessage)
        {
            switch (typeMessage)
            {
            case Enums.TypeMessage.Notice:
                return("info");

            case Enums.TypeMessage.Success:
                return("success");

            case Enums.TypeMessage.Warning:
                return("warning");

            default:
                return("danger");
            }
        }
Ejemplo n.º 4
0
 public static void ShowNotify(Control control, Exception ex, Enums.TypeMessage strType, string strTitle = "")
 {
     ShowNotify(control, "Ocurrio un error: " + ex.Message, strType, strTitle);
 }