Beispiel #1
0
        /// <summary>
        /// 向页面注册提示信息
        /// </summary>
        public String Post(Page p)
        {
            if (HttpContext.Current.Session[SessionName()] != null)
            {
                String s = Convert.ToString(HttpContext.Current.Session[SessionName()]);
                if (!String.IsNullOrEmpty(s))
                {
                    MessageTips mt = ConvertTo.Deserialize <MessageTips>(s);
                    if (mt != null && (mt.IsPostBack || !p.IsPostBack))
                    {
                        HttpContext.Current.Session.Remove(SessionName());
                        this._Content = mt.Content;
                        this._MsgType = mt.MsgType;
                        this._GoUrl   = mt.GoUrl;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_Content))
            {
                //System.Text.StringBuilder sb = new System.Text.StringBuilder();
                //sb.Append("<script type=\"text/javascript\">");
                //sb.AppendFormat("asyncbox.tips('{0}','{1}');", _Content, EnumHelper.GetEnumTextVal((Int32)_MsgType, typeof(EnumTips)));
                //sb.Append("</script>");
                //Pmb.Page.RegisterStartupScript("asyncbox.tips", sb.ToString());
            }
            return(_Content);
        }
        public String PostHtml(Page p)
        {
            if (HttpContext.Current.Session[SessionName()] != null)
            {
                String s = Convert.ToString(HttpContext.Current.Session[SessionName()]);
                if (!String.IsNullOrEmpty(s))
                {
                    MessageTips mt = ConvertTo.Deserialize <MessageTips>(s);
                    if (mt != null && (mt.IsPostBack || !p.IsPostBack))
                    {
                        HttpContext.Current.Session.Remove(SessionName());
                        this._Content = mt.Content;
                        this._MsgType = mt.MsgType;
                        this._GoUrl   = mt.GoUrl;
                    }
                }
            }

            if (!String.IsNullOrEmpty(_Content))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                if (MsgType == EnumTips.Alert)
                {
                    sb.Append("<div class=\"alert alert-info\">").AppendLine();
                    sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine();
                    sb.Append("<i class=\"fa fa-info-circle\"></i>").AppendLine();
                    sb.AppendFormat("<strong>Heads up!</strong> {0}", _Content).AppendLine();
                    sb.Append("</div>").AppendLine();
                }
                else if (MsgType == EnumTips.Error)
                {
                    sb.Append("<div class=\"alert alert-danger\">").AppendLine();
                    sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine();
                    sb.Append("<i class=\"fa fa-times-circle\"></i>").AppendLine();
                    sb.AppendFormat("<strong>Oh snap!</strong> {0}", _Content).AppendLine();
                    sb.Append("</div>").AppendLine();
                }
                else if (MsgType == EnumTips.Warning)
                {
                    sb.Append("<div class=\"alert alert-warning\">").AppendLine();
                    sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine();
                    sb.Append("<i class=\"fa fa-exclamation-triangle\"></i>").AppendLine();
                    sb.AppendFormat("<strong>Warning!</strong> {0}", _Content).AppendLine();
                    sb.Append("</div>").AppendLine();
                }
                else if (MsgType == EnumTips.Success)
                {
                    sb.Append("<div class=\"alert alert-success\">").AppendLine();
                    sb.Append("<button data-dismiss=\"alert\" class=\"close\">×</button>").AppendLine();
                    sb.Append("<i class=\"fa fa-check-circle\"></i>").AppendLine();
                    sb.AppendFormat("<strong>Well done!</strong> {0}", _Content).AppendLine();
                    sb.Append("</div>").AppendLine();
                }
                return(sb.ToString());
            }
            return(_Content);
        }
Beispiel #3
0
        /// <summary>
        /// 载入提示信息(带提交)
        /// </summary>
        /// <param name="key"></param>
        /// <param name="__MsgType"></param>
        public void LoadMessage(String key, EnumTips __MsgType, DotNetNuke.Entities.Modules.PortalModuleBase Pmb, params object[] args)
        {
            _MsgType = __MsgType;

            key = key.Replace(".Message", "");

            _Content = Localization.GetString(String.Format("{0}.Message", key), Localization.GetResourceFile(Pmb, "Message.ascx.resx"));
            if (!String.IsNullOrEmpty(_Content) && args != null && args.Length > 0)
            {
                _Content = String.Format(_Content, args);
            }
            Put();
        }
        public String EventHtml(Page p)
        {
            if (HttpContext.Current.Session[SessionName()] != null)
            {
                String s = Convert.ToString(HttpContext.Current.Session[SessionName()]);
                if (!String.IsNullOrEmpty(s))
                {
                    MessageTips mt = ConvertTo.Deserialize <MessageTips>(s);
                    if (mt != null && (mt.IsPostBack || !p.IsPostBack))
                    {
                        HttpContext.Current.Session.Remove(SessionName());
                        this._Content = mt.Content;
                        this._MsgType = mt.MsgType;
                        this._GoUrl   = mt.GoUrl;
                    }
                }
            }


            return(ViewContentToHtml(_Content));
        }
Beispiel #5
0
 /// <summary>
 ///  载入提示信息(带提交)
 /// </summary>
 /// <param name="key"></param>
 /// <param name="__MsgType"></param>
 public void LoadMessage(String key, EnumTips __MsgType, DotNetNuke.Entities.Modules.PortalModuleBase Pmb)
 {
     _MsgType = __MsgType;
     LoadMessage(key, _MsgType, Pmb, new String[] { "" });
 }