namespace baoge
{
	using System;
	using System.Collections;
	using System.ComponentModel;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.SessionState;
	using System.Web.UI;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using System.Data.OleDb;

	/// <summary>
	///		headerClassPhoto 的摘要说明。
	/// </summary>
	public class headerClassPhoto : System.Web.UI.UserControl
	{
        public int CID,classid;
		public string WebName,WebUrl,WebLogo,WebEmail,CAddress,CTel,CQQ,Webcopyright;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if (!IsPostBack)
			{
				
				
				Naviget();
				Naviget001();
			}
		}


		public string Naviget001()
		{
			int CID=Convert.ToInt32(Request.QueryString["ID"]);
			//取得数据库路径
			string dbPath=System.Configuration.ConfigurationSettings.AppSettings["dbPath"];
			//定义连接字符串
			string ACconnStr="Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath(dbPath);
			//创建数据库对像
			OleDbConnection ACconn=new OleDbConnection(ACconnStr);

			ACconn.Open();
			

			string Naviget001=null;//新闻主体
			//定义SQL语句
			string ACsql="select * from Channel where ChannelID="+CID;

			//创建Command对像
			OleDbCommand ACcomm=new OleDbCommand(ACsql,ACconn);
			
			//通过执行Command实例化DataReader类
			OleDbDataReader ACdr=ACcomm.ExecuteReader();
			string j="栏目首页";
			string i=j;
			
			while(ACdr.Read ())//循环读取
			{
				i=(string)ACdr["ChannelName"];
				Naviget001+=" "+" "+"|"+" "+" ";
				Naviget001+="<a class=Na href='listChanelPhoto.aspx?id="+ACdr["ChannelID"]+"'>"+j+"</a>";
			}
			
			ACdr.Close();//切记一定要关闭阅读器
			ACconn.Close();
			return Naviget001;
			

		}



		public string Naviget()
		{
			int CID=Convert.ToInt32(Request.QueryString["ID"]);
			//取得数据库路径
			string dbPath=System.Configuration.ConfigurationSettings.AppSettings["dbPath"];
			//定义连接字符串
			string ACconnStr="Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath(dbPath);
			//创建数据库对像
			OleDbConnection ACconn=new OleDbConnection(ACconnStr);


			ACconn.Open();

			string Naviget=null;//新闻主体
			//定义SQL语句
			string ACsql="select * from Class  where ChannelID="+CID;

			//创建Command对像
			OleDbCommand ACcomm=new OleDbCommand(ACsql,ACconn);
			//通过执行Command实例化DataReader类
			OleDbDataReader ACdr=ACcomm.ExecuteReader();
		
			
			while(ACdr.Read ())//循环读取
			{
				//				if(int.Parse(ACdr["ChannelID"].ToString())==13)
				//				{
				Naviget+=" "+" "+"|"+" "+" ";
				Naviget+="<a class=Na href='ListClassPhoto.aspx?id="+ACdr["ChannelID"]+"&classID="+ACdr["ClassID"]+"'>"+ACdr["ClassName"]+"</a>";
				//				}
				//				if(int.Parse(ACdr["ChannelID"].ToString())==14)
				//				{
				//					Naviget+=" "+" "+"|"+" "+" ";
				//					Naviget+="<a class=Na href='ListClass.aspx?id="+ACdr["ChannelID"]+"&classID="+ACdr["ClassID"]+"' target=_blank>"+ACdr["ClassName"]+"</a>";
				//				}
				//				if(int.Parse(ACdr["ChannelID"].ToString())==21)
				//				{
				//					Naviget+=" "+" "+"|"+" "+" ";
				//					Naviget+="<a class=Na href='ListClass.aspx?id="+ACdr["ChannelID"]+"&classID="+ACdr["ClassID"]+"' target=_blank>"+ACdr["ClassName"]+"</a>";
				//				}
			}
			ACdr.Close ();//切记一定要关闭阅读器
			ACconn.Close();
			return Naviget;
			

		}
		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		设计器支持所需的方法 - 不要使用代码编辑器
		///		修改此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}
