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

📄 fjsbgl.cs

📁 一个酒店管理系统
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace bggl.fm
{
	/// <summary>
	/// fjsbgl 的摘要说明。
	/// </summary>
	public class fjsbgl : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.ComboBox comboBox2;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.ListView listView1;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.Windows.Forms.ColumnHeader columnHeader2;
		private System.Windows.Forms.ColumnHeader columnHeader3;
		string z="";
		private System.Windows.Forms.ComboBox comboBox3;
		private System.Windows.Forms.Label label3;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public fjsbgl()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// 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()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.comboBox2 = new System.Windows.Forms.ComboBox();
			this.label2 = new System.Windows.Forms.Label();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			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.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.comboBox3 = new System.Windows.Forms.ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(64, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "房间类型:";
			// 
			// comboBox1
			// 
			this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBox1.Location = new System.Drawing.Point(96, 22);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(96, 20);
			this.comboBox1.TabIndex = 1;
			this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.comboBox1_SelectionChangeCommitted);
			// 
			// comboBox2
			// 
			this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBox2.Location = new System.Drawing.Point(96, 64);
			this.comboBox2.Name = "comboBox2";
			this.comboBox2.Size = new System.Drawing.Size(96, 20);
			this.comboBox2.TabIndex = 3;
			this.comboBox2.SelectionChangeCommitted += new System.EventHandler(this.comboBox2_SelectionChangeCommitted);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(16, 64);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(64, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "设备类型:";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.listView1);
			this.groupBox1.Location = new System.Drawing.Point(8, 136);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(304, 136);
			this.groupBox1.TabIndex = 4;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "显示";
			// 
			// listView1
			// 
			this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																						this.columnHeader1,
																						this.columnHeader2,
																						this.columnHeader3});
			this.listView1.FullRowSelect = true;
			this.listView1.GridLines = true;
			this.listView1.Location = new System.Drawing.Point(8, 24);
			this.listView1.Name = "listView1";
			this.listView1.Size = new System.Drawing.Size(288, 104);
			this.listView1.TabIndex = 0;
			this.listView1.View = System.Windows.Forms.View.Details;
			this.listView1.Click += new System.EventHandler(this.listView1_Click);
			// 
			// columnHeader1
			// 
			this.columnHeader1.Text = "管理ID";
			this.columnHeader1.Width = 80;
			// 
			// columnHeader2
			// 
			this.columnHeader2.Text = "房间类型";
			this.columnHeader2.Width = 100;
			// 
			// columnHeader3
			// 
			this.columnHeader3.Text = "房间设备";
			this.columnHeader3.Width = 100;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(224, 16);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(72, 24);
			this.button1.TabIndex = 5;
			this.button1.Text = "添加";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(224, 56);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(72, 24);
			this.button2.TabIndex = 6;
			this.button2.Text = "移除";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// comboBox3
			// 
			this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBox3.Location = new System.Drawing.Point(96, 104);
			this.comboBox3.Name = "comboBox3";
			this.comboBox3.Size = new System.Drawing.Size(96, 20);
			this.comboBox3.TabIndex = 8;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 104);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(64, 16);
			this.label3.TabIndex = 7;
			this.label3.Text = "设备名:";
			// 
			// fjsbgl
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(320, 277);
			this.Controls.Add(this.comboBox3);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.comboBox2);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.label1);
			this.Name = "fjsbgl";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "房间设备管理";
			this.Load += new System.EventHandler(this.fjsbgl_Load);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void fjsbgl_Load(object sender, System.EventArgs e)
		{
			setcb1();
			setcb2();
		
		}
		private void setcb1(){
			cs.fjlx flsql=new bggl.cs.fjlx();
			DataSet fjobjset=flsql.selectexe();
			this.comboBox1.Items.Clear();
			foreach(DataRow dr in fjobjset.Tables[0].Rows)
			{
				this.comboBox1.Items.Add(dr["xname"].ToString());
			}
		}
		private void setcb2()
		{
			cs.sbbsql sbsql=new bggl.cs.sbbsql();
			DataSet sbobjset=sbsql.selectexeshu();
			foreach(DataRow dr in sbobjset.Tables[0].Rows)
			{
				this.comboBox2.Items.Add(dr["slx"].ToString());
			}
		}

		private void comboBox1_SelectionChangeCommitted(object sender, System.EventArgs e)
		{
			lv();

		}
		private void lv(){
			cs.fjsbsql fjsbsq=new bggl.cs.fjsbsql();
			DataSet objset=fjsbsq.selectexe();
			this.listView1.Items.Clear();
			foreach(DataRow dr in objset.Tables[0].Rows)
			{
				if(this.comboBox1.Text.Trim()==dr["fslx"].ToString().Trim())
				{
					ListViewItem lst=new ListViewItem();
					lst.SubItems.Clear();
					lst.SubItems[0].Text=dr[0].ToString();
					lst.SubItems.Add(dr[1].ToString());
					lst.SubItems.Add(dr[2].ToString());
					this.listView1.Items.Add(lst);
					
				}
			}
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			cs.fjsbsql fjsbsq=new bggl.cs.fjsbsql();
			DataSet objset=fjsbsq.selectexe();
			bool y=true;
			foreach(DataRow dr in objset.Tables[0].Rows)
			{
				if(this.comboBox1.Text.Trim()==dr["fslx"].ToString().Trim()&&this.comboBox3.Text.Trim()==dr["fssb"].ToString().Trim())
				{
					y=false;
					
				}
				else{
					y=true;
				}
			}
			if(y==true)
			{
				if(fjsbsq.insertexe(this.comboBox1.Text,this.comboBox3.Text))
				{
					MessageBox.Show("添加成功");
					lv();
				}
				else{
					MessageBox.Show("添加失败");
					lv();
				}
			
			}
			else{
				MessageBox.Show("这个房间类型已经有这个设备了");
			}
			
		}

		private void listView1_Click(object sender, System.EventArgs e)
		{
			z=this.listView1.SelectedItems[0].SubItems[0].Text;
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			if(z.Trim()!="")
			{
				DialogResult panduan=new DialogResult();
				panduan=MessageBox.Show("您确定移除当前设备吗?","确认",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
				if(panduan==DialogResult.Yes)
				{
					cs.fjsbsql fjsb=new bggl.cs.fjsbsql();
					if(fjsb.delexe(z.Trim()))
					{
						MessageBox.Show("移除成功");
						lv();
					}
					else
					{
						MessageBox.Show("移除失败");
						lv();
					}
				}
			}
			else{
				MessageBox.Show("请选择您要移除的设备");
			}
		}

		private void comboBox2_SelectionChangeCommitted(object sender, System.EventArgs e)
		{
			cs.sbbsql sbsq=new bggl.cs.sbbsql();
			DataSet objset=sbsq.selectexe();
			this.comboBox3.Items.Clear();
			foreach(DataRow dr in objset.Tables[0].Rows)
			{
				if(this.comboBox2.Text.Trim()==dr["slx"].ToString().Trim()){
					this.comboBox3.Items.Add(dr["sname"].ToString().Trim());
					this.comboBox3.SelectedIndex=0;
				}
			}
		}
	}
}

⌨️ 快捷键说明

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