Example #1
0
 /// <summary>
 ///     JS弹出框
 /// </summary>
 /// <param name="message">提示内容</param>
 /// <param name="gotoUrl">跳转页面URL</param>
 public void Alert(string message, string gotoUrl = "")
 {
     if (string.IsNullOrWhiteSpace(gotoUrl))
     {
         gotoUrl = string.Empty;
     }
     if (gotoUrl.StartsWith("?"))
     {
         gotoUrl = Req.GetPageName() + gotoUrl;
     }
     gotoUrl = string.IsNullOrWhiteSpace(gotoUrl) ? "window.history.back();" : "location.href='" + gotoUrl + "';";
     Echo("<script language='javascript'>alert('" + message.Replace("'", @"\'").Replace("<br />", "\\r") + "');" +
          gotoUrl + "</script>");
     End();
 }
 /// <summary>
 ///     刷新当前页
 /// </summary>
 protected void Refresh()
 {
     GoToUrl("{0}?{1}", Req.GetPageName(), Req.GetParams());
 }
Example #3
0
        /// <summary>
        ///     输出指定的提示信息
        /// </summary>
        /// <param name="message">提示内容</param>
        /// <param name="title">标题</param>
        /// <param name="links">链拉 例:是,yes.htm|否,no.htm</param>
        /// <param name="url">跳转页面URL</param>
        /// <param name="showback">是否显示返回链接</param>
        public void Throw(string message, string title = "", string links = "", string url = "",
                          bool showback = true)
        {
            HttpContext.Current.Response.ContentType = "text/html";

            if (!string.IsNullOrWhiteSpace(links) && links.StartsWith("?"))
            {
                links = Req.GetPageName() + links;
            }

            var sb = new StringBuilder(template);

            sb.Replace("{$Message}", message);
            sb.Replace("{$Title}", string.IsNullOrWhiteSpace(title) ? "System Tips" : title);

            if (!string.IsNullOrWhiteSpace(links))
            {
                var arr1 = links.Split('|');
                foreach (var str in arr1)
                {
                    var arr2 = str.Split(',');
                    if (arr2.Length <= 1)
                    {
                        continue;
                    }
                    if (arr2[1].Trim() == "RefHref")
                    {
                        arr2[1] = Req.GetPrevious();
                        arr2[1] = Req.GetUrl();
                    }
                    if (string.IsNullOrWhiteSpace(arr2[1]))
                    {
                        continue;
                    }

                    var s = ("<li><a href='" + arr2[1] + "'");
                    if (arr2.Length == 3)
                    {
                        s += (" target='" + arr2[2].Trim() + "'");
                    }

                    if (arr2[0].Trim() == "RefText")
                    {
                        arr2[0] = Htmls.HtmlEncode(Req.GetPrevious());
                    }

                    s += (">" + arr2[0].Trim() + "</a></li>\r\n\t\t\t\t");
                    sb.Replace("{$Links}", s + "{$Links}");
                }
            }

            if (!string.IsNullOrWhiteSpace(url))
            {
                var s = url == "back" ? "javascript:history.back()" : url;
                sb.Replace("{$AutoJump}", "<meta http-equiv='refresh' content='3; url=" + s + "' />");
            }
            else
            {
                sb.Replace("{$AutoJump}", "<!-- no jump -->");
            }

            sb.Replace("{$Links}",
                       showback ? "<li><a href='javascript:history.back()'>Back Page</a></li>" : "<!-- no back -->");

            Echo(sb.ToString());
            End();
        }
Example #4
0
 /// <summary>
 ///     刷新当前页
 /// </summary>
 public void Refresh()
 {
     GoToUrl("{0}?{1}", Req.GetPageName(), Req.GetParams());
 }