using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using EnterpriseNET.BusinessLogicLayer;

public partial class _Default : System.Web.UI.Page
{
    public string n1Link, n1Title, n1Desc, n2Link, n2Title, n2Desc, n3Link, n3Title, n3Desc;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            try
            {
                string strSql = "";

                //绑定数据
                strSql = "";
                strSql = "select top 9 ProductID,ProductName,ProductModel,MajorID,MajorName,SubID,SubName,PicPathSmall,PicPathBig,AddTime from cai_V_Product2 where IsRecommended=1 order by ProductID desc";
                DataView dvlist_rp = Product2.QueryProducts(strSql);
                ProductListR.DataSource = dvlist_rp;
                ProductListR.DataBind();
 
                //绑定news
                strSql = "";
                strSql = "select top 10 NewsID,ClassID,NewsTitle,SeoDesc,PicPathSmall,AddTime from cai_News where len(PicPathSmall)>10 order by NewsID desc";
                DataView dvlist_news1 = News.QueryNews(strSql);
                rp_NewsList1.DataSource = dvlist_news1;
                rp_NewsList1.DataBind();

                //友情链接
                strSql = "";
                strSql = "select LinkID,LinkSortID,LinkKeyword,LinkUrl,LinkDesc,LinkPic,AddTime From cai_FriendLink order by LinkSortID";
                DataView dvlist1 = FriendLink.QueryFriendLink(strSql);
                FriendLinkList.DataSource = dvlist1;
                FriendLinkList.DataBind();

                Page.DataBind();
            }
            catch
            {
                Response.Write("发生错误.");
                Response.End();
            }
        }
    }

    protected string cutstr(string strChar, int intLength)
    {
        //取得自定义长度的字符串
        if (strChar.Length > intLength)
        {
            return strChar.Substring(0, intLength);
        }
        else
        {
            return strChar;
        }
    }


}
