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

📄 orderform.cs

📁 本设备管理系统采用了三层结构的设计思想
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace HotelManage
{
	/// <summary>
	/// ClientOrder 的摘要说明。
	/// </summary>
	public class OrderForm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		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 System.Windows.Forms.TextBox textClientID;
		private System.Windows.Forms.TextBox textClientName;
		private System.Windows.Forms.ComboBox comboSex;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.Button btnReset;
		private System.Windows.Forms.DateTimePicker dateTimePicker1;
		private System.Windows.Forms.Label label7;		
		private HotelManage.ClientOrderManage clientOrder;
		private System.Windows.Forms.ComboBox comboNativePlace;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public OrderForm(string roomID)
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			this.textRoomID.Text=roomID;			
			this.clientOrder=new ClientOrderManage();

			//
			// 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.textRoomID = new System.Windows.Forms.TextBox();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label7 = new System.Windows.Forms.Label();
			this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
			this.textRemark = new System.Windows.Forms.TextBox();
			this.textClientID = new System.Windows.Forms.TextBox();
			this.textClientName = new System.Windows.Forms.TextBox();
			this.comboSex = new System.Windows.Forms.ComboBox();
			this.comboNativePlace = new System.Windows.Forms.ComboBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.btnSave = new System.Windows.Forms.Button();
			this.btnReset = new System.Windows.Forms.Button();
			this.groupBox1.SuspendLayout();
			this.SuspendLayout();
			// 
			// textRoomID
			// 
			this.textRoomID.AcceptsTab = true;
			this.textRoomID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textRoomID.Location = new System.Drawing.Point(72, 24);
			this.textRoomID.Name = "textRoomID";
			this.textRoomID.ReadOnly = true;
			this.textRoomID.Size = new System.Drawing.Size(144, 21);
			this.textRoomID.TabIndex = 0;
			this.textRoomID.Text = "";
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.label7);
			this.groupBox1.Controls.Add(this.dateTimePicker1);
			this.groupBox1.Controls.Add(this.textRemark);
			this.groupBox1.Controls.Add(this.textClientID);
			this.groupBox1.Controls.Add(this.textClientName);
			this.groupBox1.Controls.Add(this.comboSex);
			this.groupBox1.Controls.Add(this.comboNativePlace);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label6);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.textRoomID);
			this.groupBox1.Controls.Add(this.btnReset);
			this.groupBox1.Controls.Add(this.btnSave);
			this.groupBox1.ForeColor = System.Drawing.SystemColors.Desktop;
			this.groupBox1.Location = new System.Drawing.Point(16, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(488, 192);
			this.groupBox1.TabIndex = 22;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "客户入住";
			// 
			// label7
			// 
			this.label7.BackColor = System.Drawing.Color.White;
			this.label7.Location = new System.Drawing.Point(8, 152);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(60, 25);
			this.label7.TabIndex = 27;
			this.label7.Text = "入住日期";
			this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// dateTimePicker1
			// 
			this.dateTimePicker1.AllowDrop = true;
			this.dateTimePicker1.Location = new System.Drawing.Point(72, 152);
			this.dateTimePicker1.Name = "dateTimePicker1";
			this.dateTimePicker1.Size = new System.Drawing.Size(144, 21);
			this.dateTimePicker1.TabIndex = 26;
			// 
			// textRemark
			// 
			this.textRemark.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textRemark.Location = new System.Drawing.Point(240, 32);
			this.textRemark.Multiline = true;
			this.textRemark.Name = "textRemark";
			this.textRemark.Size = new System.Drawing.Size(224, 96);
			this.textRemark.TabIndex = 25;
			this.textRemark.Text = "";
			// 
			// textClientID
			// 
			this.textClientID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textClientID.Cursor = System.Windows.Forms.Cursors.No;
			this.textClientID.Location = new System.Drawing.Point(72, 88);
			this.textClientID.Name = "textClientID";
			this.textClientID.Size = new System.Drawing.Size(144, 21);
			this.textClientID.TabIndex = 24;
			this.textClientID.Text = "";
			// 
			// textClientName
			// 
			this.textClientName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.textClientName.Location = new System.Drawing.Point(72, 120);
			this.textClientName.Name = "textClientName";
			this.textClientName.Size = new System.Drawing.Size(144, 21);
			this.textClientName.TabIndex = 23;
			this.textClientName.Text = "";
			// 
			// comboSex
			// 
			this.comboSex.Items.AddRange(new object[] {
														  "男",
														  "女"});
			this.comboSex.Location = new System.Drawing.Point(72, 56);
			this.comboSex.Name = "comboSex";
			this.comboSex.Size = new System.Drawing.Size(40, 20);
			this.comboSex.TabIndex = 22;
			// 
			// comboNativePlace
			// 
			this.comboNativePlace.Items.AddRange(new object[] {
																  "北京市",
																  "上海市",
																  "天津市",
																  "河北省",
																  "广东省",
																  "四川省",
																  "河南省"});
			this.comboNativePlace.Location = new System.Drawing.Point(168, 56);
			this.comboNativePlace.Name = "comboNativePlace";
			this.comboNativePlace.Size = new System.Drawing.Size(48, 20);
			this.comboNativePlace.TabIndex = 21;
			// 
			// label5
			// 
			this.label5.BackColor = System.Drawing.Color.White;
			this.label5.Location = new System.Drawing.Point(240, 8);
			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(112, 56);
			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(8, 56);
			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;
			// 
			// label6
			// 
			this.label6.BackColor = System.Drawing.Color.White;
			this.label6.Location = new System.Drawing.Point(8, 120);
			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(16, 88);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(48, 25);
			this.label2.TabIndex = 2;
			this.label2.Text = "顾客ID";
			this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// label1
			// 
			this.label1.BackColor = System.Drawing.Color.White;
			this.label1.Location = new System.Drawing.Point(16, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 25);
			this.label1.TabIndex = 1;
			this.label1.Text = "房间号";
			this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// btnSave
			// 
			this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnSave.ForeColor = System.Drawing.SystemColors.InfoText;
			this.btnSave.Location = new System.Drawing.Point(344, 152);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(56, 24);
			this.btnSave.TabIndex = 23;
			this.btnSave.Text = "保存";
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			// 
			// btnReset
			// 
			this.btnReset.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnReset.ForeColor = System.Drawing.SystemColors.InfoText;
			this.btnReset.Location = new System.Drawing.Point(264, 152);
			this.btnReset.Name = "btnReset";
			this.btnReset.Size = new System.Drawing.Size(56, 23);
			this.btnReset.TabIndex = 25;
			this.btnReset.Text = "重置";
			this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
			// 
			// OrderForm
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.Color.AliceBlue;
			this.ClientSize = new System.Drawing.Size(512, 213);
			this.Controls.Add(this.groupBox1);
			this.Name = "OrderForm";
			this.Text = "客户入住";
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			string CustomerID=this.textClientID.Text;
			string CustomerName=this.textClientName.Text;
			string CustomerSex=this.comboSex.Text;
			string CustomerNativePlace=this.comboNativePlace.Text;
			string roomID=this.textRoomID.Text;
			System.DateTime OrderDate=this.dateTimePicker1.Value;
			string remark=this.textRemark.Text;
			if(this.clientOrder.Client_Add(CustomerID,CustomerName,CustomerSex,CustomerNativePlace)==true)
			{
				MessageBox.Show("入住成功");

			}
			else
			{
				MessageBox.Show("入住失败");
				return;
			}
			if(this.clientOrder.ClientOrder_Add(CustomerID,roomID,OrderDate,remark)==true)
			{
				
				this.Close();				

			}
		}	

		private void btnReset_Click(object sender, System.EventArgs e)
		{
			this.textClientID.Clear();
			this.textClientName.Clear();
			this.textRemark.Clear();
			this.comboNativePlace.Text="";
			this.comboSex.Text="";
		
		}

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

	}
}

⌨️ 快捷键说明

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