/// <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);
        }
Exemple #3
0
        /// <summary>
        /// 读取数据项参数
        /// </summary>
        /// <param name="DataItem">数据项</param>
        /// <param name="Name">参数名</param>
        /// <param name="DefaultValue">默认值</param>
        /// <returns></returns>
        public object ViewItemSetting(DNNGo_LayerGallery_Content DataItem, String Name, object DefaultValue)
        {
            object o = DefaultValue;

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options))
            {
                try
                {
                    List <KeyValueEntity> ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(DataItem.Options);
                    KeyValueEntity        KeyValue     = ItemSettings.Find(r1 => r1.Key.ToLower() == Name.ToLower());
                    if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key))
                    {
                        o = KeyValue.Value;
                    }
                }
                catch
                {
                }
            }
            return(o);
        }