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

📄 addroomtypeui.cs

📁 真的很不错哦 用了c#开发 面向对象过程
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using ShowInfoLibrary;

namespace UI
{
	/// <summary>
	/// AddRoomTypeUI 的摘要说明。
	/// </summary>
	public class AddRoomTypeUI : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textType;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.TextBox textPriceByday;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox textPriceByHour;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox textNum;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.RadioButton radioButton1;
		private System.Windows.Forms.RadioButton radioButton2;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public AddRoomTypeUI()
		{
			//
			// 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.textType = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.textPriceByday = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.textPriceByHour = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.textNum = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.radioButton1 = new System.Windows.Forms.RadioButton();
			this.radioButton2 = new System.Windows.Forms.RadioButton();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(82, 36);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(72, 17);
			this.label1.TabIndex = 0;
			this.label1.Text = " 房间类型:";
			// 
			// textType
			// 
			this.textType.Location = new System.Drawing.Point(176, 32);
			this.textType.Name = "textType";
			this.textType.Size = new System.Drawing.Size(112, 21);
			this.textType.TabIndex = 1;
			this.textType.Text = "";
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(88, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(66, 17);
			this.label2.TabIndex = 0;
			this.label2.Text = "单价/ 天:";
			// 
			// textPriceByday
			// 
			this.textPriceByday.Location = new System.Drawing.Point(176, 72);
			this.textPriceByday.Name = "textPriceByday";
			this.textPriceByday.Size = new System.Drawing.Size(112, 21);
			this.textPriceByday.TabIndex = 1;
			this.textPriceByday.Text = "";
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(82, 112);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(72, 17);
			this.label3.TabIndex = 0;
			this.label3.Text = "单价/小时:";
			// 
			// textPriceByHour
			// 
			this.textPriceByHour.Location = new System.Drawing.Point(176, 112);
			this.textPriceByHour.Name = "textPriceByHour";
			this.textPriceByHour.Size = new System.Drawing.Size(112, 21);
			this.textPriceByHour.TabIndex = 1;
			this.textPriceByHour.Text = "";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(63, 152);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(91, 17);
			this.label4.TabIndex = 0;
			this.label4.Text = "可否钟点计费:";
			// 
			// textNum
			// 
			this.textNum.Location = new System.Drawing.Point(176, 196);
			this.textNum.Name = "textNum";
			this.textNum.Size = new System.Drawing.Size(112, 21);
			this.textNum.TabIndex = 1;
			this.textNum.Text = "";
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(100, 200);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(54, 17);
			this.label5.TabIndex = 0;
			this.label5.Text = "床位数:";
			// 
			// radioButton1
			// 
			this.radioButton1.Location = new System.Drawing.Point(184, 152);
			this.radioButton1.Name = "radioButton1";
			this.radioButton1.Size = new System.Drawing.Size(40, 24);
			this.radioButton1.TabIndex = 2;
			this.radioButton1.Text = "是";
			// 
			// radioButton2
			// 
			this.radioButton2.Location = new System.Drawing.Point(248, 152);
			this.radioButton2.Name = "radioButton2";
			this.radioButton2.Size = new System.Drawing.Size(40, 24);
			this.radioButton2.TabIndex = 3;
			this.radioButton2.Text = "否";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(80, 256);
			this.button1.Name = "button1";
			this.button1.TabIndex = 4;
			this.button1.Text = "增加";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(224, 256);
			this.button2.Name = "button2";
			this.button2.TabIndex = 4;
			this.button2.Text = "取消";
			// 
			// AddRoomTypeUI
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(408, 309);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.radioButton2);
			this.Controls.Add(this.radioButton1);
			this.Controls.Add(this.textType);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.label2);
			this.Controls.Add(this.textPriceByday);
			this.Controls.Add(this.label3);
			this.Controls.Add(this.textPriceByHour);
			this.Controls.Add(this.label4);
			this.Controls.Add(this.textNum);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.button2);
			this.Name = "AddRoomTypeUI";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "增加房间类型";
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			string type=this.textType.Text.Trim();
			string priceday=this.textPriceByday.Text.Trim();
			string pricehour=this.textPriceByHour.Text.Trim();
			string istimeroom="";
			if(this.radioButton1.Checked)
			{
				istimeroom="1";
			}
			else
			{
				istimeroom="0";
			}
			string setNum=this.textNum.Text.Trim();
			ShowAddRoomType add=new ShowAddRoomType();
			if(add.checkedRoomtype(type,priceday,pricehour,istimeroom,setNum))
			{
				if(add.AddRoomType(type,priceday,pricehour,istimeroom,setNum))
				{
					MessageBox.Show("添加成功");
				}
				else
				{
					MessageBox.Show("添加失败");
				}
			}

		}
	}
}

⌨️ 快捷键说明

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