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

📄 roomfindform.cs

📁 本设备管理系统采用了三层结构的设计思想
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(568, 152);
			this.groupBox1.TabIndex = 20;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "输入查询条件";
			// 
			// button1
			// 
			this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.button1.Location = new System.Drawing.Point(304, 120);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(120, 24);
			this.button1.TabIndex = 24;
			this.button1.Text = "入住";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// comboFactPeopleNum
			// 
			this.comboFactPeopleNum.Items.AddRange(new object[] {
																	"0",
																	"1",
																	"2",
																	"3",
																	"4"});
			this.comboFactPeopleNum.Location = new System.Drawing.Point(200, 56);
			this.comboFactPeopleNum.Name = "comboFactPeopleNum";
			this.comboFactPeopleNum.Size = new System.Drawing.Size(88, 20);
			this.comboFactPeopleNum.TabIndex = 23;
			// 
			// comboPeopleNum
			// 
			this.comboPeopleNum.Items.AddRange(new object[] {
																"1",
																"2",
																"3",
																"4"});
			this.comboPeopleNum.Location = new System.Drawing.Point(72, 56);
			this.comboPeopleNum.Name = "comboPeopleNum";
			this.comboPeopleNum.Size = new System.Drawing.Size(72, 20);
			this.comboPeopleNum.TabIndex = 22;
			// 
			// comboRoomPosition
			// 
			this.comboRoomPosition.Items.AddRange(new object[] {
																   "一层",
																   "二层",
																   "三层",
																   "四层",
																   "五层"});
			this.comboRoomPosition.Location = new System.Drawing.Point(352, 24);
			this.comboRoomPosition.Name = "comboRoomPosition";
			this.comboRoomPosition.Size = new System.Drawing.Size(72, 20);
			this.comboRoomPosition.TabIndex = 21;
			// 
			// comboRoomType
			// 
			this.comboRoomType.Items.AddRange(new object[] {
															   "标准间",
															   "双人间",
															   "四人间",
															   "豪华间"});
			this.comboRoomType.Location = new System.Drawing.Point(200, 24);
			this.comboRoomType.Name = "comboRoomType";
			this.comboRoomType.Size = new System.Drawing.Size(88, 20);
			this.comboRoomType.TabIndex = 20;
			// 
			// textRemark
			// 
			this.textRemark.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textRemark.Location = new System.Drawing.Point(72, 88);
			this.textRemark.Multiline = true;
			this.textRemark.Name = "textRemark";
			this.textRemark.Size = new System.Drawing.Size(216, 56);
			this.textRemark.TabIndex = 18;
			this.textRemark.Text = "";
			// 
			// btnNotFull
			// 
			this.btnNotFull.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.btnNotFull.Location = new System.Drawing.Point(440, 56);
			this.btnNotFull.Name = "btnNotFull";
			this.btnNotFull.Size = new System.Drawing.Size(120, 23);
			this.btnNotFull.TabIndex = 22;
			this.btnNotFull.Text = "未满";
			// 
			// dataGrid1
			// 
			this.dataGrid1.BackgroundColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.dataGrid1.CaptionVisible = false;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(8, 176);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(568, 264);
			this.dataGrid1.TabIndex = 22;
			// 
			// RoomFindForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.AliceBlue;
			this.ClientSize = new System.Drawing.Size(592, 445);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.groupBox1);
			this.Name = "RoomFindForm";
			this.Text = "客房查询";
			this.Load += new System.EventHandler(this.RoomSearch_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void btnExit_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		/*private void btnCancel_Click(object sender, System.EventArgs e)
		{
			this.TextClear();

		}*/
		private void TextClear()
		{
			this.textRoomID.Clear();
			this.textRemark.Clear();
			this.comboRoomType.Text="";
			this.comboRoomPosition.Text="";
			this.comboPeopleNum.Text="";
			this.comboFactPeopleNum.Text="";
			
		}

		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			bool first=true;			
			this.selectStr="select RoomID 房间号,RoomTypeName 房间类型,RoomPosition 房间楼层,HoldPeopleNum 额定人数,FactPeopleNum 实际人数,Remark 备注 from Room where";
			if(this.textRoomID.Text!="")
			{
				this.selectStr=this.selectStr+" RoomID="+"'"+this.textRoomID.Text+"'";
				
			}
			else
			{
				if(this.comboRoomType.Text!="")
				{
					this.selectStr=this.selectStr+" RoomTypeName="+"'"+this.comboRoomType.Text+"'";
					first=false;
				}
				if(this.comboRoomPosition.Text!="")
				{
					if(first)
						this.selectStr=this.selectStr+" RoomPosition="+"'"+this.comboRoomPosition.Text+"'";
					else
						this.selectStr=this.selectStr+" and RoomPosition="+"'"+this.comboRoomPosition.Text+"'";
					first=false;
				}
				if(this.comboPeopleNum.Text!="")
				{
					if(first)
						this.selectStr=this.selectStr+" HoldPeopleNum="+Convert.ToInt16(this.comboPeopleNum.Text);
					else
						this.selectStr=this.selectStr+" and HoldPeopleNum="+Convert.ToInt16(this.comboPeopleNum.Text);
					first=false;
				}
				if(this.comboFactPeopleNum.Text!="")
				{
					if(first)
						this.selectStr=this.selectStr+" FactPeopleNum="+Convert.ToInt16(this.comboFactPeopleNum.Text);
					else
						this.selectStr=this.selectStr+" and FactPeopleNum="+Convert.ToInt16(this.comboFactPeopleNum.Text);
					first=false;
				}
				if(this.textRemark.Text!="")
				{
					if(first)
						this.selectStr=this.selectStr+" Remark="+"'"+this.textRemark.Text+"'";
					else
						this.selectStr=this.selectStr+" and Remark="+"'"+this.textRemark.Text+"'";
					first=false;
				}

			}
			this.FillDataGrid(this.selectStr);
			this.TextClear();
			
		
		}		
	

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

		private void btnEmptyRoom_Click(object sender, System.EventArgs e)
		{
			this.selectStr="select RoomID 房间号,RoomTypeName 房间类型,RoomPosition 房间楼层,HoldPeopleNum 额定人数,FactPeopleNum 实际人数,Remark 备注 from Room where FactPeopleNum=0";			
			this.FillDataGrid(this.selectStr);
			this.TextClear();
			
		
		}

		private void btnNotFull_Click(object sender, System.EventArgs e)
		{
			this.selectStr="select RoomID 房间号,RoomTypeName 房间类型,RoomPosition 房间楼层,HoldPeopleNum 额定人数,FactPeopleNum 实际人数,Remark 备注 from Room where HoldPeopleNum>FactPeopleNum";
			this.FillDataGrid(this.selectStr);
			this.TextClear();
			

		}
		private void FillDataGrid(string sql)
		{
			if(this.sqlConnection1.State==ConnectionState.Closed)this.sqlConnection1.Open();
			
			Console.WriteLine(sql);
			SqlDataAdapter adapter = new SqlDataAdapter(sql,sqlConnection1);
			ds = new DataSet("t_user");
			adapter.Fill(ds,"t_user");
			this.dataGrid1.SetDataBinding(ds,"t_user");
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			OrderForm cif=new OrderForm(dataGrid1[this.dataGrid1.CurrentCell.RowNumber,0].ToString());
			cif.ShowDialog();
		}	
	}
}

⌨️ 快捷键说明

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