예제 #1
0
        public UmbracoDriverWrapper WaitForNotification(BootstrapAlertType expectedType, string expectedHeadline)
        {
            var notification = WaitForNotification();

            Assert.AreEqual(expectedType, notification.AlertType);
            Assert.AreEqual(expectedHeadline, notification.Headline);
            return(this);
        }
예제 #2
0
        public static MvcHtmlString BootstrapAlert(this HtmlHelper html, BootstrapAlertType type, string message)
        {
            var cssClass = type.ToString().ToLower();

            return(MvcHtmlString.Create($@"<div class='alert alert-{cssClass} alert-dismissible' role='alert'>
                        <button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span></button>
                        <strong>Warning!</strong> {message}
                    </div>"));
        }
예제 #3
0
 private void AlertMessage(BootstrapAlertType type, string title, string message, bool closeButton = true, bool headerSeparator = false)
 {
     TempData.Add("AlertVisible", true);
     TempData.Add("AlertType", (int)type);
     TempData.Add("AlertTitle", title);
     TempData.Add("AlertMessage", message);
     TempData.Add("CloseButton", closeButton);
     TempData.Add("HeaderSeparator", headerSeparator);
 }
예제 #4
0
        public static void BootstrapAlert(Label MsgLabel, String Message, BootstrapAlertType MessageType = BootstrapAlertType.Plain, bool Dismissable = true)
        {
            string style = "";
            string icon  = "";

            switch (MessageType)
            {
            case BootstrapAlertType.Plain:
                style = "default";
                icon  = "";
                break;

            case BootstrapAlertType.Success:
                style = "success";
                icon  = "check";
                break;

            case BootstrapAlertType.Information:
                style = "info";
                icon  = "info-circle";
                break;

            case BootstrapAlertType.Warning:
                style = "warning";
                icon  = "warning";
                break;

            case BootstrapAlertType.Danger:
                style = "danger";
                icon  = "remove";
                break;

            case BootstrapAlertType.Primary:
                style = "primary";
                icon  = "info";
                break;
            }
            if ((!MsgLabel.Page.IsPostBack || MsgLabel.Page.IsPostBack) && Message == "")
            {
                MsgLabel.Visible = false;
            }
            else
            {
                MsgLabel.Visible  = true;
                MsgLabel.CssClass = "alert alert-" + style + " alert-dismissible fade show";
                MsgLabel.Text     = "<i class='fa fa-" + icon + "'></i>" + Message;
                if (Dismissable == true)
                {
                    MsgLabel.Text += "<button type='button' class='close' data-dismiss='alert' aria-label='Close'><span aria-hidden='true'>&times;</span>";
                }
            }
        }
예제 #5
0
        private IActionResult ViewAlertMessage <T>(string viewName, T model, BootstrapAlertType type, string title, string message, bool closeButton = true, bool headerSeparator = false)
        {
            this.AlertMessage(type, title, message, closeButton, headerSeparator);

            if (string.IsNullOrEmpty(viewName))
            {
                return(View(model));
            }
            else
            {
                return(View(viewName, model));
            }
        }
예제 #6
0
        /// <summary>Adiciona un mensaje al contenedor principal de mensajes</summary>
        /// <param name="title">Titulo</param>
        /// <param name="message">Mensaje</param>
        /// <param name="Type">Tipo</param>
        /// <param name="isSticky">Indica si el mensaje permanece visible</param>
        public ToastMessage AddToastMessage(string title, string message, BootstrapAlertType Type, bool isSticky = false)
        {
            ToastType TipoToast = ToastType.Success;

            switch (Type)
            {
            case BootstrapAlertType.info:
                TipoToast = ToastType.Info; break;

            case BootstrapAlertType.warning:
                TipoToast = ToastType.Warning; break;

            case BootstrapAlertType.danger:
                TipoToast = ToastType.Error; break;
            }

            return(Toastr.AddToastMessage(title, message, TipoToast, isSticky));
        }
예제 #7
0
        public static string ConvertAlertTypeToString(BootstrapAlertType type)
        {
            switch (type)
            {
            case BootstrapAlertType.DANGER:
                return("alert-danger");

            case BootstrapAlertType.INFO:
                return("alert-info");

            case BootstrapAlertType.WARNING:
                return("alert-warning");

            case BootstrapAlertType.SUCCESS:
                return("alert-success");

            default:
            case BootstrapAlertType.UNKNOWN:
                return(string.Empty);
            }
        }
예제 #8
0
        public static void SetBootstrapPageAlert(this Controller ctrl, string message, BootstrapAlertType alertType)
        {
            BootstrapPageAlertViewModel alertModel = new BootstrapPageAlertViewModel()
            {
                AlertType = alertType,
                Message   = message
            };

            ctrl.TempData.Add("pageAlertMessage", JsonConvert.SerializeObject(alertModel));
        }
예제 #9
0
        public static void BootstrapAlertMessage(System.Web.UI.HtmlControls.HtmlGenericControl dvMsg, string strMessage, BootstrapAlertType MessageType)
        {
            dvMsg.Style.Add("display", "block");
            dvMsg.Attributes.Remove("class");
            string style = "";

            switch (MessageType)
            {
            case BootstrapAlertType.Plain:
                style = "alert alert-info alert-dismissable";
                break;

            case BootstrapAlertType.Success:
                style = "alert alert-success alert-dismissable";
                break;

            case BootstrapAlertType.Information:
                style = "alert alert-info alert-dismissable";
                break;

            case BootstrapAlertType.Warning:
                style = "alert alert-warning alert-dismissable";
                break;

            case BootstrapAlertType.Danger:
                style = "alert alert-danger alert-dismissable";
                break;

            case BootstrapAlertType.Primary:
                style = "alert alert-info alert-dismissable";
                break;

            case BootstrapAlertType.Duplicate:
                style = "alert alert-warning alert-dismissable";
                break;
            }
            dvMsg.Attributes.Add("class", style);
            dvMsg.InnerHtml = "";
            string divcontent = "";

            divcontent = "<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>" + MessageType + "!</strong> <span> " + strMessage;
            string myScript = "\n<script type=\"text/javascript\">\n";

            myScript       += "setTimeout(function () { $(\"#" + dvMsg.ClientID + "\").fadeTo(500, 0).slideUp(500) }, 3000);";
            myScript       += "\n\n </script>";
            dvMsg.InnerHtml = divcontent;
            ScriptManager.RegisterClientScriptBlock(dvMsg.Page, dvMsg.Page.GetType(), DateTime.Today.Ticks.ToString(), myScript.ToString(), false);


            //"A file with the same name already exists.<br />Your file was saved as " + fileName;
        }
예제 #10
0
        private IActionResult RedirectAlertMessage(string actionName, BootstrapAlertType type, string title, string message, bool closeButton = true, bool headerSeparator = false)
        {
            this.AlertMessage(type, title, message, closeButton, headerSeparator);

            return(Redirect(actionName));
        }
 protected void ShowMessage(string Message, BootstrapAlertType type)
 {
     ScriptManager.RegisterStartupScript(this, GetType(), Guid.NewGuid().ToString(), "ShowMessage('" + Message + "','" + type + "');", true);
 }
예제 #12
0
 public UmbracoNotification(BootstrapAlertType alertType, string headline, string message)
 {
     AlertType = alertType;
     Headline  = headline;
     Message   = message;
 }
예제 #13
0
        public void DisplayMessage(System.Web.UI.HtmlControls.HtmlGenericControl dvMsg, string strMessage, BootstrapAlertType MessageType)
        {
            dvMsg.Style.Add("display", "block");
            dvMsg.Attributes.Remove("class");
            string style = "";

            switch (MessageType)
            {
            case BootstrapAlertType.Plain:
                style = "alert alert-info alert-dismissable";
                break;

            case BootstrapAlertType.Success:
                style = "alert alert-success alert-dismissable";
                break;

            case BootstrapAlertType.Information:
                style = "alert alert-info alert-dismissable";
                break;

            case BootstrapAlertType.Warning:
                style = "alert alert-warning alert-dismissable";
                break;

            case BootstrapAlertType.Danger:
                style = "alert alert-danger alert-dismissable";
                break;

            case BootstrapAlertType.Primary:
                style = "alert alert-info alert-dismissable";
                break;
            }
            dvMsg.Attributes.Add("class", style);
            dvMsg.InnerHtml = "<a href='#' class='close' data-dismiss='alert' aria-label='close'>&times;</a><strong>" + MessageType + "!</strong> <span> " + strMessage;
            //"A file with the same name already exists.<br />Your file was saved as " + fileName;
        }