Example #1
0
    void BindText()
    {
        string text = "淘宝的诚信自查系统昨天(7月24日)上线了,这是为净化网上购物大环境的一个举措,但是自查系统误查现象十分严重,有的卖家打电话到淘宝客服狠骂客服,一部分卖家自发成立反淘宝联盟发起反淘宝活动。昨日下午16:00左右,淘宝网客服部门收到“柠檬绿茶”、“双生儿香港评价店”等网店店主的举报,有人使用大量“马甲帐号”恶意拍下不买。在短时期内,有超过200个帐户几乎同一时刻拍下这些网店中的商品,但是,最终这些所谓的买家并没有付款,直接导致这些网店出现大量商品下架的情况,对这些店铺的交易产生了重大的影响。";

        ReplaceKeyValue[] rkv = new ReplaceKeyValue[] {
            new ReplaceKeyValue("淘宝", "<a href=\"http://www.taobao.com\">淘宝</a>"),
            new ReplaceKeyValue("狠骂", "**")
        };
        FastReplace fr = new FastReplace(rkv);

        divContent.InnerHtml = fr.ReplaceAll(text);
    }
Example #2
0
        /// <summary>
        /// 進行標點符號轉換
        /// </summary>
        /// <param name="origin">來源字串</param>
        /// <param name="mode">0: 半形轉全形 ; 1:全形轉半形</param>
        /// <returns></returns>
        public static string ConvertSymbol(string origin, int mode)
        {
            FastReplace fastReplace = new FastReplace(mode == 0 ? SymbolTable : (SymbolTable.ToLookup(pair => pair.Value, pair => pair.Key).ToDictionary(grp => grp.Key, grp => grp.ToArray()[0])));

            return(fastReplace.ReplaceAll(origin));
        }
Example #3
0
    private void BindData()
    {
        string articleIDStr = Request.QueryString["id"];

        if (!string.IsNullOrEmpty(articleIDStr))
        {
            int articleID;
            if (int.TryParse(HHOnline.Framework.GlobalSettings.Decrypt(articleIDStr), out articleID))
            {
                // 增加点击率
                //ArticleManager.IncreaseHitTimes(articleID);
                BaseViews views = ViewsFactory.GetViews(typeof(ArticleViews));
                views.AddViewCount(articleID);

                Article article = ArticleManager.GetArticle(articleID);
                if (article != null)
                {
                    lblAbstract.InnerHtml = article.Abstract;
                    lblAuthor.Text        = string.IsNullOrEmpty(article.Author) ? "匿名" : article.Author;
                    lblDate.Text          = article.Date.HasValue ? article.Date.Value.ToString() : DateTime.Now.ToString();
                    lblHitTimes.Text      = article.HitTimes.ToString();
                    lblTitle.Text         = article.Title;
                    lblSubTitle.Text      = article.SubTitle;
                    lblKeywords.Text      = string.IsNullOrEmpty(article.Keywords) ? "无" : article.Keywords;

                    // 获取所有产品
                    ProductQuery pq = new ProductQuery();
                    pq.HasPublished = true;
                    List <Product>         products = Products.GetProductList(pq);
                    List <ReplaceKeyValue> rkvs     = new List <ReplaceKeyValue>();

                    foreach (Product item in products)
                    {
                        ReplaceKeyValue rkv = new ReplaceKeyValue();
                        rkv.Key   = item.ProductName;
                        rkv.Value = "<a style='color: blue; text-decoration:underline;' href=\"view.aspx?product-product&ID=" + HHOnline.Framework.GlobalSettings.Encrypt(item.ProductID.ToString()) + "\">" + item.ProductName + "</a>";
                        rkvs.Add(rkv);
                    }

                    FastReplace fr = new FastReplace(rkvs.ToArray());
                    lblContent.InnerHtml = fr.ReplaceAll(article.Content);

                    // 查找分类
                    ArticleCategory ac = ArticleManager.GetArticleCategory(article.Category);
                    if (ac != null)
                    {
                        btnCategory.Text          = ac.Name;
                        btnCategory.OnClientClick = "window.location.href='view.aspx?news-newslist&cate=" + HHOnline.Framework.GlobalSettings.Encrypt(ac.ID.ToString()) + "';return false;";
                    }

                    if (!string.IsNullOrEmpty(article.CopyFrom))
                    {
                        lblCopyForm.Text    = "文章来源: " + article.CopyFrom;
                        lblCopyForm.Visible = true;
                    }
                    else
                    {
                        lblCopyForm.Visible = false;
                    }

                    // 获取附件
                    ArticleAttachment attachment = ArticleAttachments.GetAttachment(article.Image);
                    if (attachment != null)
                    {
                        if (attachment.IsRemote)
                        {
                            imgAttachment.ImageUrl = attachment.FileName;
                        }
                        else
                        {
                            imgAttachment.ImageUrl = attachment.GetDefaultImageUrl(100, 100);
                        }
                        imgAttachment.Visible = true;
                    }
                    else
                    {
                        imgAttachment.Visible = false;
                    }

                    this.ShortTitle = article.Title;
                }
                else
                {
                    imgAttachment.Visible = false;
                }
            }
            this.SetTitle();
        }
    }