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

📄 room.cs

📁 宾馆信息管理系统: 采用C#编写
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;


namespace HotelManage
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Room : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		private System.Windows.Forms.ColumnHeader columnHeader4;
		private System.Windows.Forms.ColumnHeader columnHeader5;
		private System.Windows.Forms.ColumnHeader columnHeader6;
		private System.Windows.Forms.Panel panel1;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.TextBox textRemark;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textRoomID;		
		private string selectStr;
		private SqlCommand sqlCommand1=null;
		private SqlDataReader sqlDataReader1=null;
		private SqlConnection sqlConnection1=null;
		private bool add=false;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.Button btnStart;
		private System.Windows.Forms.TextBox textSearch;
		private System.Windows.Forms.Button btnSearch;
		private System.Windows.Forms.Button btnDelete;
		private System.Windows.Forms.Button btnNew;
		private System.Windows.Forms.Button btnExit;		
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.ComboBox comboRoomPosition;
		private System.Windows.Forms.ComboBox comboBedNum;
		private System.Windows.Forms.ComboBox comboPeopleNum;
		private System.Windows.Forms.ComboBox comboRoomType;
		HotelManage.RoomManage  roomManage=new RoomManage();
		

		public Room()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			this.sqlConnection1=new SqlConnection(HotelManage.Connection.ConnString);
			this.sqlCommand1=new SqlCommand();
			this.sqlCommand1.CommandType=CommandType.Text;
			this.sqlCommand1.Connection=this.sqlConnection1;

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Room));
			this.listView1 = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader2 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader3 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader4 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader5 = new System.Windows.Forms.ColumnHeader();
			this.columnHeader6 = new System.Windows.Forms.ColumnHeader();
			this.panel1 = new System.Windows.Forms.Panel();
			this.comboPeopleNum = new System.Windows.Forms.ComboBox();
			this.comboBedNum = new System.Windows.Forms.ComboBox();
			this.comboRoomPosition = new System.Windows.Forms.ComboBox();
			this.textRemark = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.comboRoomType = new System.Windows.Forms.ComboBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.textRoomID = new System.Windows.Forms.TextBox();
			this.btnCancel = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			this.btnExit = new System.Windows.Forms.Button();
			this.btnStart = new System.Windows.Forms.Button();
			this.label7 = new System.Windows.Forms.Label();
			this.textSearch = new System.Windows.Forms.TextBox();
			this.btnSearch = new System.Windows.Forms.Button();
			this.btnDelete = new System.Windows.Forms.Button();
			this.btnNew = new System.Windows.Forms.Button();
			this.panel1.SuspendLayout();
			this.SuspendLayout();
			// 
			// listView1
			// 
			this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
			this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						this.columnHeader1,
																						this.columnHeader2,
																						this.columnHeader3,
																						this.columnHeader4,
																						this.columnHeader5,
																						this.columnHeader6});
			this.listView1.ForeColor = System.Drawing.SystemColors.Desktop;
			this.listView1.FullRowSelect = true;
			this.listView1.GridLines = true;
			this.listView1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
			this.listView1.Location = new System.Drawing.Point(48, 66);
			this.listView1.MultiSelect = false;
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(562, 192);
			this.listView1.TabIndex = 3;
			this.listView1.View = System.Windows.Forms.View.Details;
			this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "房间号";
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "房间类型";
			this.columnHeader2.Width = 80;
			// 
			// columnHeader3
			// 
			this.columnHeader3.Text = "房间楼层";
			// 
			// columnHeader4
			// 
			this.columnHeader4.Text = "额定人数";
			this.columnHeader4.Width = 82;
			// 
			// columnHeader5
			// 
			this.columnHeader5.Text = "额定床数";
			// 
			// columnHeader6
			// 
			this.columnHeader6.Text = "备注";
			this.columnHeader6.Width = 140;
			// 
			// panel1
			// 
			this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
			this.panel1.BackColor = System.Drawing.Color.White;
			this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.panel1.Controls.Add(this.comboPeopleNum);
			this.panel1.Controls.Add(this.comboBedNum);
			this.panel1.Controls.Add(this.comboRoomPosition);
			this.panel1.Controls.Add(this.textRemark);
			this.panel1.Controls.Add(this.label5);
			this.panel1.Controls.Add(this.label4);
			this.panel1.Controls.Add(this.label3);
			this.panel1.Controls.Add(this.comboRoomType);
			this.panel1.Controls.Add(this.label6);
			this.panel1.Controls.Add(this.label2);
			this.panel1.Controls.Add(this.label1);
			this.panel1.Controls.Add(this.textRoomID);
			this.panel1.ForeColor = System.Drawing.SystemColors.Desktop;
			this.panel1.Location = new System.Drawing.Point(40, 322);
			this.panel1.Name = "panel1";
			this.panel1.Size = new System.Drawing.Size(562, 120);
			this.panel1.TabIndex = 2;
			// 
			// comboPeopleNum
			// 
			this.comboPeopleNum.AllowDrop = true;
			this.comboPeopleNum.BackColor = System.Drawing.Color.White;
			this.comboPeopleNum.ForeColor = System.Drawing.SystemColors.Desktop;
			this.comboPeopleNum.IntegralHeight = false;
			this.comboPeopleNum.Items.AddRange(new object[] {
																"1",
																"2",
																"3",
																"4"});
			this.comboPeopleNum.Location = new System.Drawing.Point(72, 52);
			this.comboPeopleNum.Name = "comboPeopleNum";
			this.comboPeopleNum.Size = new System.Drawing.Size(76, 20);
			this.comboPeopleNum.Sorted = true;
			this.comboPeopleNum.TabIndex = 17;
			this.comboPeopleNum.Text = "选择";
			// 
			// comboBedNum
			// 
			this.comboBedNum.AllowDrop = true;
			this.comboBedNum.BackColor = System.Drawing.Color.White;
			this.comboBedNum.ForeColor = System.Drawing.SystemColors.Desktop;
			this.comboBedNum.IntegralHeight = false;
			this.comboBedNum.Items.AddRange(new object[] {
															 "1",
															 "2",
															 "3",
															 "4"});
			this.comboBedNum.Location = new System.Drawing.Point(216, 52);
			this.comboBedNum.Name = "comboBedNum";
			this.comboBedNum.Size = new System.Drawing.Size(88, 20);
			this.comboBedNum.Sorted = true;
			this.comboBedNum.TabIndex = 16;
			this.comboBedNum.Text = "选择";
			// 
			// comboRoomPosition
			// 
			this.comboRoomPosition.AllowDrop = true;
			this.comboRoomPosition.BackColor = System.Drawing.Color.White;
			this.comboRoomPosition.ForeColor = System.Drawing.SystemColors.Desktop;
			this.comboRoomPosition.IntegralHeight = false;
			this.comboRoomPosition.Items.AddRange(new object[] {
																   "二层",
																   "三层",
																   "四层",
																   "一层"});
			this.comboRoomPosition.Location = new System.Drawing.Point(356, 12);
			this.comboRoomPosition.Name = "comboRoomPosition";
			this.comboRoomPosition.Size = new System.Drawing.Size(84, 20);
			this.comboRoomPosition.Sorted = true;
			this.comboRoomPosition.TabIndex = 15;
			this.comboRoomPosition.Text = "选择";
			// 
			// textRemark
			// 
			this.textRemark.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textRemark.Location = new System.Drawing.Point(56, 88);
			this.textRemark.Multiline = true;
			this.textRemark.Name = "textRemark";
			this.textRemark.Size = new System.Drawing.Size(364, 20);
			this.textRemark.TabIndex = 14;
			this.textRemark.Text = "";
			// 
			// label5
			// 
			this.label5.BackColor = System.Drawing.Color.White;
			this.label5.Location = new System.Drawing.Point(4, 84);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(56, 25);
			this.label5.TabIndex = 11;
			this.label5.Text = "备注";
			this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label4
			// 
			this.label4.BackColor = System.Drawing.Color.White;
			this.label4.Location = new System.Drawing.Point(152, 48);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 25);
			this.label4.TabIndex = 10;
			this.label4.Text = "额定床数";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label3
			// 
			this.label3.BackColor = System.Drawing.Color.White;
			this.label3.Location = new System.Drawing.Point(12, 48);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(60, 25);
			this.label3.TabIndex = 9;
			this.label3.Text = "额定人数";
			this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// comboRoomType
			// 
			this.comboRoomType.AllowDrop = true;
			this.comboRoomType.BackColor = System.Drawing.Color.White;
			this.comboRoomType.ForeColor = System.Drawing.SystemColors.Desktop;
			this.comboRoomType.IntegralHeight = false;
			this.comboRoomType.Items.AddRange(new object[] {
															   "标准间",
															   "双人间",
															   "四人间"});
			this.comboRoomType.Location = new System.Drawing.Point(208, 12);
			this.comboRoomType.Name = "comboRoomType";
			this.comboRoomType.Size = new System.Drawing.Size(88, 20);
			this.comboRoomType.Sorted = true;
			this.comboRoomType.TabIndex = 7;
			this.comboRoomType.Text = "选择";
			// 
			// label6
			// 
			this.label6.BackColor = System.Drawing.Color.White;
			this.label6.Location = new System.Drawing.Point(300, 12);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(60, 25);
			this.label6.TabIndex = 6;
			this.label6.Text = "房间楼层";
			this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label2
			// 
			this.label2.BackColor = System.Drawing.Color.White;
			this.label2.Location = new System.Drawing.Point(140, 8);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(64, 25);
			this.label2.TabIndex = 2;
			this.label2.Text = "房间类型";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.White;
			this.label1.Location = new System.Drawing.Point(8, 8);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(60, 25);
			this.label1.TabIndex = 1;
			this.label1.Text = "房间号";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// textRoomID
			// 
			this.textRoomID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textRoomID.Enabled = false;
			this.textRoomID.Location = new System.Drawing.Point(68, 12);
			this.textRoomID.Multiline = true;
			this.textRoomID.Name = "textRoomID";
			this.textRoomID.Size = new System.Drawing.Size(68, 20);
			this.textRoomID.TabIndex = 0;
			this.textRoomID.Text = "";
			// 
			// btnCancel
			// 
			this.btnCancel.BackColor = System.Drawing.Color.LightGray;
			this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnCancel.Location = new System.Drawing.Point(296, 280);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(56, 23);
			this.btnCancel.TabIndex = 16;
			this.btnCancel.Text = "取消";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnSave
			// 
			this.btnSave.BackColor = System.Drawing.Color.LightGray;
			this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnSave.Location = new System.Drawing.Point(376, 280);

⌨️ 快捷键说明

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