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 ServiceShow : 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 ServiceType";
            operate.DataListBind(DataList2, sqlStr);
            InitNews();
        }
    }
    /// <summary>
    /// 页面初始化或首页传入参数时执行
    /// </summary>
    private void InitNews()
    {
        string serviceId = "";
        if (Request.QueryString["ServiceId"] == null)
        {
            //serviceId = "1";
            Response.Redirect("err.aspx");
        }
        else
        {
            serviceId = Request.QueryString["ServiceId"];
        }
        string strSql = "select servicetypeid from Service where serviceId=" + serviceId;
        //绑定文档表中的文档名和文档时间
        DataListBind(serviceId);
        //绑定所有lt
        string serviceTypeId = sqldb.ExecuteScalar(strSql);
        strSql = "select * from servicetype where serviceTypeId=" + serviceTypeId;
        DataSet ds = sqldb.GetDS(strSql);
        ltServiceTypeName.Text = ds.Tables[0].Rows[0][1].ToString();
        img_serviceTypeSport.Src = "images/service/" + ds.Tables[0].Rows[0][2].ToString();
        img_serviceTypeLogo.Src = "images/service/" + ds.Tables[0].Rows[0][3].ToString();
        ltServiceTypeTitle.Text = ds.Tables[0].Rows[0][4].ToString();
        //显示服务类型名导航
        lblServiceTypeName.Text = ltServiceTypeName.Text;
        ds.Clear();
        //显示服务名导航
        strSql = "select serviceName from Service where serviceId=" + serviceId;
        lblServiceName.Text = sqldb.ExecuteScalar(strSql);        
        ds.Clear();
    }
    private void DataListBind(string id)
    {
        string sqlStr = "select * from ServiceDoc where serviceId=" + id;
        operate.DataListBind(DataListItems, sqlStr);
    }
}
