using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using JuSNS.Config;

namespace JuSNS.UI
{
    public class WebHint
    {
        /// <summary>
        /// 页面错误提示信息
        /// </summary>
        /// <param name="ErrMsg">错误信息</param>
        /// <param name="Url">返回管理员地址  默认可以填写:""或"0"</param>
        static public void ShowError(string rooDir, string ErrMsg, string Url, bool returnUrl)
        {
            //string tmStr = "Error";
            //string s = JuSNS.Home.ParseTemplate.replaceTemplate(tmStr);
            //s = s.Replace("[@MSGStr]", ErrMsg);
            //s = s.Replace("{GetHtmlHead}", this.GetHtmlHead());
            //s = s.Replace("{GetHtmlFoot}", this.GetHtmlFoot());

            //HttpContext.Current.Response.Write(s);
            //HttpContext.Current.Response.End();
            string disurl = "" + rooDir + "/inc/ErrorPage.aspx?r=" + JuSNS.Common.Input.URLEncode(ErrMsg) + "";
            if (!string.IsNullOrEmpty(Url))
            {
                disurl += "&u=" + Url;
            }
            HttpContext.Current.Response.Redirect(disurl);
            //HttpContext.Current.Response.Write("<script language=\"javascript\">window.parent.location.href=\"" + disurl + "\";</script>");
            HttpContext.Current.Response.End();
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="StrUrl"></param>
        /// <returns></returns>
        static private string UserUrl(string StrUrl)
        {
            if (StrUrl.Trim() != string.Empty && StrUrl.Trim().Length > 5)
            {
                StrUrl = "<a href=\"" + StrUrl + "\"><font color=\"red\">返回管理</font></a>";
            }
            return StrUrl;
        }

    }
}
