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

📄 roomform.cs

📁 酒店管理系统是个不错的 系统 自己做的毕业设计 里面功能齐全
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label7.TabIndex = 10;
			this.label7.Text = "输入房间号";
			// 
			// btnStart
			// 
			this.btnStart.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnStart.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnStart.Image = ((System.Drawing.Image)(resources.GetObject("btnStart.Image")));
			this.btnStart.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnStart.Location = new System.Drawing.Point(20, 85);
			this.btnStart.Name = "btnStart";
			this.btnStart.Size = new System.Drawing.Size(56, 23);
			this.btnStart.TabIndex = 9;
			this.btnStart.Text = "开始";
			this.btnStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
			// 
			// btnClose
			// 
			this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnClose.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnClose.Image = ((System.Drawing.Image)(resources.GetObject("btnClose.Image")));
			this.btnClose.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnClose.Location = new System.Drawing.Point(16, 392);
			this.btnClose.Name = "btnClose";
			this.btnClose.Size = new System.Drawing.Size(56, 23);
			this.btnClose.TabIndex = 6;
			this.btnClose.Text = "退出";
			this.btnClose.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// btnSave
			// 
			this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnSave.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnSave.Image = ((System.Drawing.Image)(resources.GetObject("btnSave.Image")));
			this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnSave.Location = new System.Drawing.Point(16, 288);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(56, 23);
			this.btnSave.TabIndex = 5;
			this.btnSave.Text = "保存";
			this.btnSave.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnCancel.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnCancel.Image = ((System.Drawing.Image)(resources.GetObject("btnCancel.Image")));
			this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnCancel.Location = new System.Drawing.Point(16, 248);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(56, 23);
			this.btnCancel.TabIndex = 4;
			this.btnCancel.Text = "取消";
			this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnSearch
			// 
			this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnSearch.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
			this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnSearch.Location = new System.Drawing.Point(16, 80);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new System.Drawing.Size(56, 23);
			this.btnSearch.TabIndex = 2;
			this.btnSearch.Text = "查找";
			this.btnSearch.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
			// 
			// btnDelete
			// 
			this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnDelete.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnDelete.Image = ((System.Drawing.Image)(resources.GetObject("btnDelete.Image")));
			this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnDelete.Location = new System.Drawing.Point(16, 48);
			this.btnDelete.Name = "btnDelete";
			this.btnDelete.Size = new System.Drawing.Size(56, 23);
			this.btnDelete.TabIndex = 1;
			this.btnDelete.Text = "删除";
			this.btnDelete.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
			// 
			// btnNew
			// 
			this.btnNew.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnNew.ForeColor = System.Drawing.SystemColors.Desktop;
			this.btnNew.Image = ((System.Drawing.Image)(resources.GetObject("btnNew.Image")));
			this.btnNew.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
			this.btnNew.Location = new System.Drawing.Point(16, 16);
			this.btnNew.Name = "btnNew";
			this.btnNew.Size = new System.Drawing.Size(56, 23);
			this.btnNew.TabIndex = 0;
			this.btnNew.Text = "新建";
			this.btnNew.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
			this.btnNew.Click += new System.EventHandler(this.btnNew_Click);
			// 
			// listView1
			// 
			this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| 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(16, 136);
			this.listView1.MultiSelect = false;
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(488, 304);
			this.listView1.TabIndex = 5;
			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 = "额定人数";
			// 
			// columnHeader5
			// 
			this.columnHeader5.Text = "额定床数";
			// 
			// columnHeader6
			// 
			this.columnHeader6.Text = "备注";
			this.columnHeader6.Width = 140;
			// 
			// RoomForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.SystemColors.ControlLightLight;
			this.ClientSize = new System.Drawing.Size(616, 446);
			this.Controls.Add(this.listView1);
			this.Controls.Add(this.panel2);
			this.Controls.Add(this.panel1);
			this.Name = "RoomForm";
			this.Text = "房间信息";
			this.Load += new System.EventHandler(this.RoomForm_Load);
			this.panel1.ResumeLayout(false);
			this.panel2.ResumeLayout(false);
			this.panel3.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

	

		private void RoomForm_Load(object sender, System.EventArgs e)
		{
		this.bindlist();
		}
		private void bindlist()
		{
		 
			Room Rm=new Room(this.listView1);
			Room.bindlist(Rm);
			if(this.listView1.Items.Count>0)
			{
			int  i=0;
				this.ChangeText(i);
			}
		}
		private void ChangeText(int i)
		{
			if(i>this.listView1.Items.Count)
			{
			 i=0;
			}
			if(this.listView1.Items.Count>0)
			{
				this.txtRoomID.Text=this.listView1.Items[i].SubItems[0].Text;
				this.cmbRoomType.Text=this.listView1.Items[i].SubItems[1].Text;
				this.cmbRoomPosition.Text=this.listView1.Items[i].SubItems[2].Text;
				this.cmbPeopleNum.Text=this.listView1.Items[i].SubItems[3].Text;
				this.cmbBedNum.Text=this.listView1.Items[i].SubItems[4].Text;
				this.txtRemark.Text=this.listView1.Items[i].SubItems[5].Text;
			}
			else
			{
			 MessageBox.Show("没有记录");
			}

		}

		private void listView1_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			foreach(int i in this.listView1.SelectedIndices)
			{
			 this.ChangeText(i);
				break;
			}
	    }
		private void btnEnable(bool bl)
		{
		 this.btnCancel.Enabled=bl;
			this.btnSave.Enabled=bl;
		}
		private void btnNew_Click(object sender, System.EventArgs e)
		{
		  this.result=true;
			this.txtRoomID.Enabled=true;
			this.ClearText();
         this.btnEnable(true);
		}

		private void btnDelete_Click(object sender, System.EventArgs e)
		{
			if(this.txtRoomID.Text!="")
			{
				DialogResult dg=MessageBox.Show("确定要删除么?","删除提示",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
				if(dg==DialogResult.Yes)
				{
					if(Room.RmDelete(this.txtRoomID.Text))
					{
						MessageBox.Show("删除成功");
					}
					else
					{
						MessageBox.Show("删除失败");
					}
				}
			}
			else
			{
			  MessageBox.Show("请选择要删除的房间ID");
			}
		   this.bindlist();
		}
		private void ClearText()
		{
			this.txtRoomID.Text="";
			this.cmbRoomType.Text="";
			this.cmbRoomPosition.Text="";
			this.cmbPeopleNum.Text="";
			this.cmbBedNum.Text="";
			this.txtRemark.Text="";
		}
		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			this.panel3.Visible=true;
			this.ClearText();
		}

		private void btnStart_Click(object sender, System.EventArgs e)
		{
			if(this.txtSearch.Text!="")
			{
				Room Rm=new Room(this.listView1);
				if(Room.RmSearch(Rm,this.txtSearch.Text))
				{
					int  i=0;
					this.ChangeText(i);
				}
				else
				{
				  MessageBox.Show("没找到符合条件的查询");
				}
			}
			else
			{
			 MessageBox.Show("请填写查询条件");
			}
			this.panel3.Visible=false;
		 }

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			Room Rm=new Room(this.txtRoomID.Text,this.cmbRoomType.Text,this.cmbRoomPosition.Text,Convert.ToInt32(this.cmbPeopleNum.Text),Convert.ToInt32(this.cmbBedNum.Text),this.txtRemark.Text);
			if(this.result)
			{
				
				if(Room.RmAdd(Rm))
				{
					MessageBox.Show("新建成功");
				}
				else
				{
					MessageBox.Show("新建失败");
				}
				
			}
			else
			{
				if(Room.RmUpdate(Rm))
				{
					MessageBox.Show("修改成功");
				}
				else
				{
				 MessageBox.Show("修改失败");
				}
			}
			this.result=false;
			this.bindlist();
		}

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

		private void btnCancel_Click(object sender, System.EventArgs e)
		{
		this.panel3.Visible=false;
		}





	}
}

⌨️ 快捷键说明

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