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 SoftwareShow : 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 softwareType";
            operate.DataListBind(DataList2, sqlStr);
            InitNews();
        }
    }
    /// <summary>
    /// 页面初始化或首页传入参数时执行
    /// </summary>
    private void InitNews()
    {
        string softwareId = "";
        if (Request.QueryString["softwareId"] == null)
        {
            //softwareId = "1";
            Response.Redirect("err.aspx");
        }
        else
        {
            softwareId = Request.QueryString["softwareId"];
        }
        string strSql = "select softwaretypeid from software where softwareId=" + softwareId;
        //绑定文档表中的文档名和文档时间
        DataListBind(softwareId);
        //绑定所有lt
        string softwareTypeId = sqldb.ExecuteScalar(strSql);
        strSql = "select * from softwaretype where softwareTypeId=" + softwareTypeId;
        DataSet ds = sqldb.GetDS(strSql);
        ltsoftwareTypeName.Text = ds.Tables[0].Rows[0][1].ToString();
        img_softwareTypeSport.Src = "images/software/" + ds.Tables[0].Rows[0][2].ToString();
        img_softwareTypeLogo.Src = "images/software/" + ds.Tables[0].Rows[0][3].ToString();
        ltsoftwareTypeTitle.Text = ds.Tables[0].Rows[0][4].ToString();
        //显示服务类型名导航
        lblsoftwareTypeName.Text = ltsoftwareTypeName.Text;
        ds.Clear();
        //显示服务名导航
        strSql = "select softwareName from software where softwareId=" + softwareId;
        lblsoftwareName.Text = sqldb.ExecuteScalar(strSql);
        ds.Clear();
    }
    private void DataListBind(string id)
    {
        string sqlStr = "select * from softwareDoc where softwareId=" + id;
        operate.DataListBind(DataListItems, sqlStr);
    }
}
