v9.8.2018.0605   由DataReader直接映射实体列表,以支持netstandard的MySql和SQLite,且提升性能
大石头 authored at 2018-06-05 00:45:23
1.21 KiB
X
using System;
using NewLife.Web;

namespace NewLife.Bootstrap
{
    /// <summary>Bootstrap脚本提供者</summary>
    public class BootstrapJs : Js
    {
        /// <summary>重载Alert实现</summary>
        /// <param name="message">消息内容</param>
        /// <param name="title">标题</param>
        /// <param name="msDelay">延迟指定毫秒数以后自动关闭,默认0表示不关闭</param>
        /// <param name="kind">种类,info/success/error等</param>
        /// <returns></returns>
        protected override void OnAlert(String message, String title, Int32 msDelay, String kind)
        {
            if (!message.IsNullOrEmpty()) message = Encode(message);
            if (!title.IsNullOrEmpty()) title = Encode(title);

            var js = "";
            if (msDelay > 0)
                js = String.Format("(parent[\"tips\"] || window[\"tips\"] || (function(msg){{alert(msg);}}))(\"{0}\",true,{1},\"close\");", message, msDelay);
            else
                js = String.Format("(parent[\"infoDialog\"] || window[\"infoDialog\"] || (function(title,msg){{alert(msg);}}))(\"{0}\",\"{1}\",true);", title, message);

            WriteScript(js, true);
        }
    }
}