慧云科技 > 首页 > 文章详情

奥杰cms源码 - ArticleTopList

本文来源:网站建设-网站制作|网络营销专家慧云科技-

抢滩登陆

2009-7-17 16:58:04

using System;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using BoyunBase;
using SiteCore;

public partial class Part_ArticleList : System.Web.UI.UserControl
{
    private PartAccess pAcs = null;
    protected void Page_Load( object sender, EventArgs e )
    {
        try {
            if( IsPostBack ) return;

            pAcs = new PartAccess( this );
            if( pAcs.IsReady )
                PartShow();

        } catch( Exception ex ) {
            Todo.DebugOut( "加载 Part_ArticleList 出现异常:" + ex.Message );
        }
    }

    protected void PartShow()//显示内容
    {
        ContentAccess ca = new ContentAccess( this, "TableName" );
        int topValue = pAcs.GetSettingInt( "topValue", 8 );
        DataTable dt = ca.Read( "[@top " + topValue + "]", "name" );
        if( dt == null || dt.Rows.Count < 1 ) {
            Todo.DebugOut( "Part_ArticleList 没有读取到数据" );
            return;
        }
        //路径
        string contentPage = pAcs.GetSetting( "contentPage" );
        if( contentPage != "" )
            contentPage += "?aid=";
        else
            contentPage = "";
        //是否显示时间
        bool isTimeVisable = pAcs.GetSettingBool( "isTimeVisable" );
        string timeFormat = "";
        if( isTimeVisable ) {
            timeFormat = pAcs.GetSetting( "timeFormat" );
        }
        //是否在新窗口打开
        bool isOpenNew = pAcs.GetSettingBool( "isOpenNew" );
        string Target = "";
        if( isOpenNew ) Target = "_blank";
        else Target = "_self";

        Todo.AddDataCol( "Target", dt );
        Todo.AddDataCol( "IssueTimeStr", dt );
        Todo.AddDataCol( "LinkUrl", dt );
        for( int i = 0; i < dt.Rows.Count; i++ ) {
            DataRow dr = dt.Rows[i];
            if( contentPage != "" )
                dr["LinkUrl"] = contentPage + Todo.Get( "ID", dr );
            else
                dr["LinkUrl"] = "";
            dr["Target"] = Target;
            if( isTimeVisable )
                dr["IssueTimeStr"] = Todo.TimeFormat( Todo.Get( "IssueTime", dr ), timeFormat );
        }

        rptList.DataSource = dt;
        rptList.DataBind();
    }
}


RSS订阅| 关于我们| 网站地图| 加入项目| 法律条款| 友情链接| Firefox| Sitemap| 网站统计

全国免费咨询热线:400-600-6495 优惠活动咨询电话:021-62278496 Email:ajaxcms@yahoo.cn

上海慧云信息科技有限公司版权所有 2006-2009 沪ICP备09038165号

本站关键词:网站建设 高品质网站建设