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

using EnterpriseNET.BusinessLogicLayer;

public partial class UserControls_top : System.Web.UI.UserControl
{
    public string SiteConfigID, CompanyName, LogoPicUrl, LogoAlt;

    protected void Page_Load(object sender, EventArgs e)
    {      
        //加载
        if (!IsPostBack)
        {
            try
            {
                bindSiteConfig();
                bindData();
            }
            catch
            {
                Response.Write("发生错误.");
                Response.End();
            }
        }
    }

    void bindSiteConfig()
    {
        int siteConfigID = 1;

        SiteConfig siteConfig = new SiteConfig();
        siteConfig.LoadData(siteConfigID);

        if (siteConfig.exist)
        {
             //显示站点配置详细内容
            CompanyName = siteConfig.companyName;
            LogoPicUrl = siteConfig.logoPicUrl;
            LogoAlt = siteConfig.logoAlt;

            Page.DataBind();
        }
        else
        {
              Response.Write("数据不存在.");
              Response.End();
         }
    }

    void bindData()
    {
        DataView dvlist0 = MajorClass.QueryMajorClass();
        ShowMajorClass.DataSource = dvlist0;
        ShowMajorClass.DataBind();

        //strSql = "";
        //strSql = "select SubID,SubSortID,MajorID,MajorName,MajorNameEn,SubName,subNameEn,AddTime From cai_V_Major_Sub_Class where MajorID=26 order by SubSortID";

        //MenuSubClass1.DataSource = SubClass.QuerySubClass(strSql);
        //MenuSubClass1.DataBind();

        Page.DataBind();
    }


    protected void Button1_Click(object sender, EventArgs e)
    {
        string keywords = Convert.ToString(SearchKeyword.Value);
        Response.Redirect("/psearch_" + System.Web.HttpUtility.UrlEncode(keywords) + "_1.html");
    }
}
