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;
namespace baoge
{
	/// <summary>
	/// MovieView 的摘要说明。
	/// </summary>
	public class MovieView : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Soft_Name;
		protected System.Web.UI.WebControls.Image Image2;
		protected System.Web.UI.WebControls.Label Movie_Name;
		protected System.Web.UI.WebControls.Label Movie_zujiao;
		protected System.Web.UI.WebControls.Label Movie_daoyan;
		protected System.Web.UI.WebControls.Label Movie_language;
		protected System.Web.UI.WebControls.Label Movie_Address;
		protected System.Web.UI.WebControls.Label UpdateTime;
		protected System.Web.UI.WebControls.Label Movie_one;
		protected System.Web.UI.WebControls.Label Movie_two;
		protected System.Web.UI.WebControls.Label Movie_download;
		protected System.Web.UI.WebControls.Label Movie_downloadone;
		protected System.Web.UI.WebControls.Label Movie_Content;
		public int CID;
		public string ATitle;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!IsPostBack)
			{
				NewsBodyA();
				

			}
		}


		private void NewsBodyA()
		{
			
			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();

			//定义SQL语句
			string ACsql="select * from movie where Movie_ID="+CID;

			//创建Command对像
			OleDbCommand ACcomm=new OleDbCommand(ACsql,ACconn);
			//通过执行Command实例化DataReader类
			OleDbDataReader ACdr=ACcomm.ExecuteReader();
		
			
			if(ACdr.Read ())
			{
				this.Soft_Name.Text=ACdr["Movie_Name"].ToString();
				Movie_Name.Text=ACdr["Movie_Name"].ToString();
				
				this.Image2.ImageUrl="admin/loadmoviepic/"+ACdr["Movie_loadpic"]+"";
				this.Movie_zujiao.Text=ACdr["Movie_zujiao"].ToString();
				this.Movie_daoyan.Text=ACdr["Movie_daoyan"].ToString();
				this.Movie_language.Text=ACdr["Movie_language"].ToString();

				
				this.Movie_Address.Text=ACdr["Movie_Address"].ToString();
				this.UpdateTime.Text=ACdr["UpdateTime"].ToString();
				
//				this.Movie_one.Text="<a href=admin/uploadpic/"+ACdr["Soft_uploadsoft"]+" target=_blank>北方网通</a>";
				this.Movie_one.Text="<a href=lookmovie.aspx?movieid="+Server.UrlEncode(ACdr["Movie_ID"].ToString())+"&moviename="+Server.UrlEncode(ACdr["Movie_Name"].ToString())+"&look="+Server.UrlEncode(ACdr["Movie_one"].ToString())+" target=_blank>[1]</a>";
//				this.Movie_two.Text="<a href='"+ACdr["Movie_two"]+"' target=_blank>[2]</a>";
				if(ACdr["Movie_two"].ToString()!="")
				{
//					this.Movie_two.Text="<a href=lookmovie.aspx?movieid="+ACdr["Movie_ID"]+"&moviename="+ACdr["Movie_Name"]+"&look="+ACdr["Movie_two"]+" target=_blank>[2]</a>";
					this.Movie_two.Text="<a href=lookmovie.aspx?movieid="+Server.UrlEncode(ACdr["Movie_ID"].ToString())+"&moviename="+Server.UrlEncode(ACdr["Movie_Name"].ToString())+"&look="+Server.UrlEncode(ACdr["Movie_two"].ToString())+" target=_blank>[2]</a>";
					//				this.Soft_WWW.NavigateUrl="<"+ACdr["Soft_WWW"]+"' target=_blank>开发商主页</a>";
					//                this.Soft_WWWtest.NavigateUrl="<a href='"+ACdr["Soft_WWWtest"]+"' target=_blank>程序演示</a>";
				}
				this.Movie_download.Text="<a href="+ACdr["Movie_download"]+" target=_blank>北方网通</a>";
				this.Movie_downloadone.Text="<a href="+ACdr["Movie_download"]+" target=_blank>南方电信</a>";
				//               this.HyperLink1.NavigateUrl="<a href='admin/uploadpic/"+ACdr["Soft_uploadsoft"]+"' target=_blank>北方网通</a>";
				//               this.HyperLink2.NavigateUrl="<a href='admin/uploadpic/"+ACdr["Soft_uploadsoft"]+"' target=_blank>南方电信</a>";


				this.UpdateTime.Text=ACdr["UpdateTime"].ToString().Substring(0,10);
				
				this.Movie_Content.Text=ACdr["Movie_Content"].ToString();
				
//				this.hits.Text=ACdr["hits"].ToString();
				

				ATitle=this.Soft_Name.Text.ToString();
			}
			ACdr.Close ();//切记一定要关闭阅读器

			ACcomm.CommandText="update movie set hits=hits+1 where Movie_ID="+CID;
			//			OleDbDataReader ACdrr=ACcomm.ExecuteReader();
			//			if(ACdrr.Read ())
			//			{
			//				ATitle=Label2.Text.ToString();
			//				this.Label8.Text=ACdr["Hits"].ToString();
			//			}
			//			ACdrr.Close ();//切
			ACcomm.ExecuteNonQuery();
			ACconn.Close();

		}

		#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
	}
}
