⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hoteldescquery.aspx.cs

📁 酒店管理,主要从事酒店管理都可以.这可是北大青鸟的程序
💻 CS
字号:
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 HotelHome;

namespace HotelHome
{
	/// <summary>
	/// HotelDescQuery 的摘要说明。
	/// </summary>
	public class HotelDescQuery : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.ImageButton ImageButton1;
		protected System.Web.UI.WebControls.DataGrid DataGrid1;
		protected System.Web.UI.WebControls.Label lblName;
		protected System.Web.UI.WebControls.Label lblAddr;
		protected System.Web.UI.WebControls.Label lblWz;
		protected System.Web.UI.WebControls.Label lblJb;
		protected System.Web.UI.WebControls.Label lblXx;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.WebControls.TextBox txtID;
		private void Page_Load(object sender, System.EventArgs e)
		{
			if(!this.IsPostBack)
			{
				this.Button1.Attributes.Add("onclick","javascript:history.back();return false;");//使按钮不改变数据返回到上一个页面

				int hotelID=Convert.ToInt32(Request["HotelID"]);
				DBService dbs=new DBService();
				string selSql="select * from hotel where hotelID="+hotelID.ToString();
				DataSet ds=new DataSet();
				ds=dbs.executeBySQL(selSql);
				if (ds.Tables[0].Rows.Count>0)
				{
					this.txtID.Text=ds.Tables[0].Rows[0][0].ToString();
				
					this.lblName.Text=ds.Tables[0].Rows[0][1].ToString();
					this.lblAddr.Text=ds.Tables[0].Rows[0][2].ToString();
					this.lblWz.Text=ds.Tables[0].Rows[0][3].ToString();
					this.lblJb.Text=ds.Tables[0].Rows[0][4].ToString();
					this.lblXx.Text=ds.Tables[0].Rows[0][5].ToString();
					this.ImageButton1.ImageUrl="imageview.aspx?hotelID="+hotelID.ToString();
				}
				string selectSQL="select b.typename ,a.roomNum ,a.roomPrice,a.roomid from guestroom a,roomtype b where a.roomtype=b.typeid and a.hotelID="+hotelID.ToString();
				ds=dbs.executeBySQL(selectSQL);
				this.DataGrid1.DataSource=ds.Tables[0].DefaultView;
				this.DataGrid1.DataBind();
			}
		}

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

		}
		#endregion

		private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if(e.Item.ItemType==ListItemType.Item||e.Item.ItemType==ListItemType.AlternatingItem)
			{
				HyperLink link=(HyperLink)e.Item.Cells[0].Controls[0];
				DataRowView dv=(DataRowView)e.Item.DataItem;
				link.NavigateUrl="../room/room_Detail.aspx?RoomID="+dv["roomID"].ToString();
			}
		}

		private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
		
		}

		private void txtID_TextChanged(object sender, System.EventArgs e)
		{
		
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -