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

📄 frmyd1.cs

📁 一个酒店管理系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(128, 21);
			this.textBox2.TabIndex = 3;
			this.textBox2.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "客人姓名:";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.button4);
			this.groupBox2.Controls.Add(this.button3);
			this.groupBox2.Controls.Add(this.button2);
			this.groupBox2.Controls.Add(this.button1);
			this.groupBox2.Location = new System.Drawing.Point(432, 8);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(128, 192);
			this.groupBox2.TabIndex = 1;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "操作";
			// 
			// button4
			// 
			this.button4.Location = new System.Drawing.Point(16, 144);
			this.button4.Name = "button4";
			this.button4.Size = new System.Drawing.Size(104, 32);
			this.button4.TabIndex = 3;
			this.button4.Text = "退出";
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(16, 104);
			this.button3.Name = "button3";
			this.button3.Size = new System.Drawing.Size(104, 32);
			this.button3.TabIndex = 2;
			this.button3.Text = "客人预定退单";
			this.button3.Click += new System.EventHandler(this.button3_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(16, 64);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(104, 32);
			this.button2.TabIndex = 1;
			this.button2.Text = "修改客人预定";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(16, 24);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(104, 32);
			this.button1.TabIndex = 0;
			this.button1.Text = "添加客人预定";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// dataGrid1
			// 
			this.dataGrid1.BackgroundColor = System.Drawing.Color.White;
			this.dataGrid1.CaptionBackColor = System.Drawing.Color.Lavender;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.GridLineColor = System.Drawing.SystemColors.Desktop;
			this.dataGrid1.HeaderBackColor = System.Drawing.Color.Lavender;
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(0, 200);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(568, 232);
			this.dataGrid1.TabIndex = 2;
			this.dataGrid1.DoubleClick += new System.EventHandler(this.dataGrid1_DoubleClick);
			// 
			// frmyd1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(568, 429);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Name = "frmyd1";
			this.Text = "餐桌预约管理";
			this.Load += new System.EventHandler(this.frmyd1_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

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

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

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

			this.button2.Enabled=false;
			this.button3.Enabled=false;
			pus();
			
			this.comboBox2.Items.Clear();
			this.comboBox2.Items.Add("单人");
			this.comboBox2.Items.Add("全家");
			this.comboBox2.Items.Add("同事聚餐");
			this.comboBox2.Items.Add("旅行团队");
			this.comboBox2.Items.Add("朋友");
            
			biao();
            
		}

		private void button1_Click(object sender, System.EventArgs e)  //添加客人预约
		{
			
			if(this.textBox2.Text.Trim()!="" && this.textBox3.Text.Trim()!="" && this.comboBox1.Text.Trim()!="" && this.textBox5.Text.Trim()!="" && this.dateTimePicker1.Text.Trim()!="" && this.dateTimePicker2.Text.Trim()!="")
			{
				yuyue.insertyd(this.textBox2.Text,this.textBox3.Text,this.comboBox1.Text,this.textBox5.Text,this.comboBox2.Text,this.dateTimePicker1.Text,this.dateTimePicker2.Text);
				MessageBox.Show("添加预约已成功!");
				biao();
			}
			else
			{
			   MessageBox.Show("数据不能为空,请重新输入!");
			}
			
           this.textBox2.Text="";
		   this.textBox3.Text="";
           this.comboBox1.Text="";
		   this.textBox5.Text="";
		   this.comboBox2.Text="";

		}
		private void pus()  //对复选框付值
		{
			objset=typeload.settype();
			foreach(DataRow br in objset.Tables[0].Rows)
			{
				this.comboBox1.Items.Add(br[0].ToString());
			}
		}
		private void biao()  //显示数据报表
		{
			objset1=yuyue.selyd();
			this.dataGrid1.DataSource=objset1.Tables["BG_YD"].DefaultView;
		}

		private void button3_Click(object sender, System.EventArgs e)  // 删除客人预约
		{
			if(this.textBox5.Text.Trim()!="")
			{
				yuyue.deleteyd(this.textBox5.Text);
				MessageBox.Show("退约已成功!");
				objset1=yuyue.selyd();
				this.dataGrid1.DataSource=objset1.Tables["BG_YD"].DefaultView;
				this.button1.Enabled=true;
				this.textBox2.Text="";
				this.textBox3.Text="";
				this.comboBox1.Text="";
				this.textBox5.Text="";
				this.comboBox2.Text="";
			}
			else
			{
			   MessageBox.Show("餐桌号不能为空,请重新输入!");
			}
			
		}

		private void dataGrid1_DoubleClick(object sender, System.EventArgs e)//传值
		{
			int mm=this.dataGrid1.CurrentRowIndex;
			bianhao=this.dataGrid1[mm,0].ToString(); 
			this.textBox2.Text=this.dataGrid1[mm,1].ToString();
			this.textBox3.Text=this.dataGrid1[mm,2].ToString();
			this.comboBox1.Text=this.dataGrid1[mm,3].ToString();
			this.textBox5.Text=this.dataGrid1[mm,4].ToString();
			this.comboBox2.Text=this.dataGrid1[mm,5].ToString().Trim();
			this.dateTimePicker1.Text=this.dataGrid1[mm,6].ToString();
			this.dateTimePicker2.Text=this.dataGrid1[mm,7].ToString();
			this.button1.Enabled=false;
			this.button2.Enabled=true;
			this.button3.Enabled=true;
		}

		private void button2_Click(object sender, System.EventArgs e)   //修改客人预约
		{
			if(this.textBox5.Text.Trim()!="")
			{
				yuyue.updateyd(Convert.ToInt32(bianhao),this.textBox2.Text,this.textBox3.Text,this.comboBox1.Text,this.textBox5.Text,this.comboBox2.Text,this.dateTimePicker1.Text,this.dateTimePicker2.Text);
				MessageBox.Show("修改已成功!");
				biao();
				this.button1.Enabled=true;
				this.textBox2.Text="";
				this.textBox3.Text="";
				this.comboBox1.Text="";
				this.textBox5.Text="";
				this.comboBox2.Text="";
			}
			else
			{
			   MessageBox.Show("餐桌号不能为空,请重新输入!");
			}
		}

		private void textBox3_Leave(object sender, System.EventArgs e)  //判断
		{
			bggl.gong.zhipd pd=new bggl.gong.zhipd();
			if(pd.intjc(this.textBox3.Text.Trim())!=true)
			{
				MessageBox.Show("电话号码只能为数字!");
				this.textBox3.Text="";
			}
		}

		private void textBox5_Leave(object sender, System.EventArgs e)//判断 
		{
			bggl.gong.zhipd pd=new bggl.gong.zhipd();
			if(pd.intjc(this.textBox5.Text.Trim())!=true)
			{
				MessageBox.Show("餐桌号只能为数字!");
				this.textBox5.Text="";
			}
		}    
	}
}

⌨️ 快捷键说明

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