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);
        }
Beispiel #2
0
        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.AppendFormat("<i class=\"fa fa-info-circle\"></i> {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.AppendFormat("<i class=\"fa fa-times-circle\"></i> {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.AppendFormat("<i class=\"fa fa-exclamation-triangle\"></i> {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.AppendFormat("<i class=\"fa fa-check-circle\"></i> {0}", _Content).AppendLine();

                    sb.Append("</div>").AppendLine();
                }
                return(sb.ToString());
            }
            return(_Content);
        }