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>
	/// SoftView 的摘要说明。
	/// </summary>
	public class SoftView : System.Web.UI.Page
	{
		public int CID;
		protected System.Web.UI.WebControls.Label Soft_Name;
		protected System.Web.UI.WebControls.Label Soft_daxiao;
		protected System.Web.UI.WebControls.Image Image1;
		protected System.Web.UI.WebControls.Label Soft_admin;
		protected System.Web.UI.WebControls.Label Soft_language;
		protected System.Web.UI.WebControls.Label Soft_huanjin;
		protected System.Web.UI.WebControls.Label Soft_WebSiteName;
		protected System.Web.UI.WebControls.Label Soft_Mail;
		protected System.Web.UI.WebControls.Label UpdateTime;
		protected System.Web.UI.WebControls.Label Soft_pass;
		protected System.Web.UI.WebControls.Label Soft_jibie;
		protected System.Web.UI.WebControls.Label hits;
		protected System.Web.UI.WebControls.Label Soft_jianjie;
		protected System.Web.UI.WebControls.Image Image2;
		protected System.Web.UI.WebControls.Label Soft_WWW;
		protected System.Web.UI.WebControls.Label Soft_WWWtest;
		protected System.Web.UI.WebControls.Label Soft_uploadsoft001;
		protected System.Web.UI.WebControls.Label Soft_uploadsoft002;
		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 soft where Soft_ID="+CID;

			//创建Command对像
			OleDbCommand ACcomm=new OleDbCommand(ACsql,ACconn);
			//通过执行Command实例化DataReader类
			OleDbDataReader ACdr=ACcomm.ExecuteReader();
		
			
			if(ACdr.Read ())
			{
				this.Soft_Name.Text=ACdr["Soft_Name"].ToString();
				Soft_daxiao.Text=ACdr["Soft_daxiao"].ToString();
				this.Image1.ImageUrl="img/Star"+ACdr["Soft_star"]+".gif";
				this.Image2.ImageUrl="admin/uploadpic/"+ACdr["Soft_uploadpic"]+"";
				this.Soft_admin.Text=ACdr["Soft_admin"].ToString();
				this.Soft_language.Text=ACdr["Soft_language"].ToString();
				this.Soft_huanjin.Text=ACdr["Soft_huanjin"].ToString();

				
				this.Soft_WebSiteName.Text=ACdr["Soft_WebSiteName"].ToString();
				this.Soft_Mail.Text="<A href='mailto:"+ACdr["Soft_Mail"]+"'>Email</a>";
				
                 this.Soft_WWW.Text="<a href="+ACdr["Soft_WWW"]+" target=_blank>开发商主页</a>";
				this.Soft_WWWtest.Text="<a href='"+ACdr["Soft_WWWtest"]+"' target=_blank>程序演示</a>";
//				this.Soft_WWW.NavigateUrl="<"+ACdr["Soft_WWW"]+"' target=_blank>开发商主页</a>";
//                this.Soft_WWWtest.NavigateUrl="<a href='"+ACdr["Soft_WWWtest"]+"' target=_blank>程序演示</a>";

				this.Soft_uploadsoft001.Text="<a href=admin/uploadpic/"+ACdr["Soft_uploadsoft"]+" target=_blank>北方网通</a>";
				this.Soft_uploadsoft002.Text="<a href=admin/uploadpic/"+ACdr["Soft_uploadsoft"]+" 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.Soft_pass.Text=ACdr["Soft_pass"].ToString();
				this.Soft_jibie.Text=ACdr["Soft_jibie"].ToString();
				this.hits.Text=ACdr["hits"].ToString();
				this.Soft_jianjie.Text=ACdr["Soft_jianjie"].ToString();

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

			ACcomm.CommandText="update soft set Hits=Hits+1 where Soft_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
	}
}
