예제 #1
0
    /// <summary>
    /// 绑定站点公告
    /// </summary>
    private void GetSiteAffiches()
    {
        string    CacheKey = "SiteAffiches";
        DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_SiteAffiches().Open("top 10 *", "SiteID = " + _Site.ID.ToString(), "[DateTime] desc");
            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);
                return;
            }
        }

        DataRow[] drs = dt.Select("isCommend=1", "DateTime DESC");
        if (drs.Length > 0)
        {
            SiteAffiches = "<a href=\"NewDetail.aspx?SiteId=" + drs[0]["ID"].ToString() + "\" target=\"_blank\" style=\"font-size:16px;\" title=\"" + drs[0]["Title"].ToString() + "\">" + Shove._String.Cut(drs[0]["Title"].ToString(), 23) + "</a>";
        }
        Shove._Web.Cache.SetCache(CacheKey, dt, 600);

        RepSiteAffiches.DataSource = dt;
        RepSiteAffiches.DataBind();
    }
예제 #2
0
    /// <summary>
    /// 绑定站点公告
    /// </summary>
    private void GetSiteAffiches()
    {
        string    CacheKey = "SiteAffichesIndex";
        DataTable dt       = Shove._Web.Cache.GetCacheAsDataTable(CacheKey);

        if (dt == null)
        {
            dt = new DAL.Tables.T_SiteAffiches().Open("top 3 *", "SiteID = " + _Site.ID.ToString(), "[DateTime] desc");
            if (dt == null)
            {
                PF.GoError(ErrorNumber.DataReadWrite, "数据库繁忙,请重试", this.GetType().BaseType.FullName);
                return;
            }
        }
        RepSiteAffiches.DataSource = dt;
        RepSiteAffiches.DataBind();
        Shove._Web.Cache.SetCache(CacheKey, dt, 600);
    }