using System;
using System.Data;
using System.Configuration;
using System.Collections;
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 sql;

public partial class WebSiteShow : System.Web.UI.Page
{
    SqlDB sqldb = new SqlDB();
    Operation operate = new Operation();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string sqlStr = "select * from WebSiteType";
            operate.DataListBind(DataList2, sqlStr);
            InitNews();
        }
    }
    /// <summary>
    /// 页面初始化或首页传入参数时执行
    /// </summary>
    private void InitNews()
    {
        string WebSiteId = "";
        if (Request.QueryString["WebSiteId"] == null)
        {
            //WebSiteId = "1";
            Response.Redirect("err.aspx");
        }
        else
        {
            WebSiteId = Request.QueryString["WebSiteId"];
        }
        string strSql = "select WebSitetypeid from WebSite where WebSiteId=" + WebSiteId;
        //绑定文档表中的文档名和文档时间
        DataListBind(WebSiteId);
        //绑定所有lt
        string WebSiteTypeId = sqldb.ExecuteScalar(strSql);
        strSql = "select * from WebSitetype where WebSiteTypeId=" + WebSiteTypeId;
        DataSet ds = sqldb.GetDS(strSql);
        ltWebSiteTypeName.Text = ds.Tables[0].Rows[0][1].ToString();
        img_WebSiteTypeSport.Src = "images/WebSite/" + ds.Tables[0].Rows[0][2].ToString();
        img_WebSiteTypeLogo.Src = "images/WebSite/" + ds.Tables[0].Rows[0][3].ToString();
        ltWebSiteTypeTitle.Text = ds.Tables[0].Rows[0][4].ToString();
        //显示服务类型名导航
        lblWebSiteTypeName.Text = ltWebSiteTypeName.Text;
        ds.Clear();
        //显示服务名导航
        strSql = "select WebSiteName from WebSite where WebSiteId=" + WebSiteId;
        lblWebSiteName.Text = sqldb.ExecuteScalar(strSql);
        ds.Clear();
    }
    private void DataListBind(string id)
    {
        string sqlStr = "select * from WebSiteDoc where WebSiteId=" + id;
        operate.DataListBind(DataListItems, sqlStr);
    }
}
