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

📄 qtywcl.cs

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

namespace bggl.fm
{
	/// <summary>
	/// qtywcl 的摘要说明。
	/// </summary>
	public class qtywcl : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TabControl tabControl1;
		private System.Windows.Forms.TabPage tabPage1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public qtywcl()
		{
			//
			// 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.tabControl1 = new System.Windows.Forms.TabControl();
			this.tabPage1 = new System.Windows.Forms.TabPage();
			this.label9 = new System.Windows.Forms.Label();
			this.label10 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.label6 = new System.Windows.Forms.Label();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.label1 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.tabControl1.SuspendLayout();
			this.tabPage1.SuspendLayout();
			this.SuspendLayout();
			// 
			// tabControl1
			// 
			this.tabControl1.Controls.Add(this.tabPage1);
			this.tabControl1.Location = new System.Drawing.Point(8, 8);
			this.tabControl1.Name = "tabControl1";
			this.tabControl1.SelectedIndex = 0;
			this.tabControl1.Size = new System.Drawing.Size(408, 152);
			this.tabControl1.TabIndex = 0;
			// 
			// tabPage1
			// 
			this.tabPage1.Controls.Add(this.label9);
			this.tabPage1.Controls.Add(this.label10);
			this.tabPage1.Controls.Add(this.label7);
			this.tabPage1.Controls.Add(this.label8);
			this.tabPage1.Controls.Add(this.label4);
			this.tabPage1.Controls.Add(this.label6);
			this.tabPage1.Controls.Add(this.textBox1);
			this.tabPage1.Controls.Add(this.label5);
			this.tabPage1.Controls.Add(this.label3);
			this.tabPage1.Controls.Add(this.label2);
			this.tabPage1.Controls.Add(this.comboBox1);
			this.tabPage1.Controls.Add(this.label1);
			this.tabPage1.Location = new System.Drawing.Point(4, 21);
			this.tabPage1.Name = "tabPage1";
			this.tabPage1.Size = new System.Drawing.Size(400, 127);
			this.tabPage1.TabIndex = 0;
			this.tabPage1.Text = "押金添加";
			// 
			// label9
			// 
			this.label9.Location = new System.Drawing.Point(296, 24);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(88, 16);
			this.label9.TabIndex = 11;
			// 
			// label10
			// 
			this.label10.Location = new System.Drawing.Point(224, 24);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(72, 16);
			this.label10.TabIndex = 10;
			this.label10.Text = "欠费:";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(104, 24);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(88, 16);
			this.label7.TabIndex = 9;
			// 
			// label8
			// 
			this.label8.Location = new System.Drawing.Point(24, 24);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(72, 16);
			this.label8.TabIndex = 8;
			this.label8.Text = "房间费用:";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(296, 88);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(88, 16);
			this.label4.TabIndex = 7;
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(224, 88);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(72, 16);
			this.label6.TabIndex = 6;
			this.label6.Text = "加后押金:";
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(104, 88);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(104, 21);
			this.textBox1.TabIndex = 5;
			this.textBox1.Text = "";
			this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(24, 88);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(72, 16);
			this.label5.TabIndex = 4;
			this.label5.Text = "添加押金:";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(296, 56);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(88, 16);
			this.label3.TabIndex = 3;
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(224, 56);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(72, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "现有押金:";
			// 
			// comboBox1
			// 
			this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBox1.Location = new System.Drawing.Point(104, 56);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(104, 20);
			this.comboBox1.TabIndex = 1;
			this.comboBox1.SelectionChangeCommitted += new System.EventHandler(this.comboBox1_SelectionChangeCommitted);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(24, 56);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(48, 16);
			this.label1.TabIndex = 0;
			this.label1.Text = "房间号:";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(56, 168);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(80, 24);
			this.button1.TabIndex = 8;
			this.button1.Text = "保存";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(280, 168);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(80, 24);
			this.button2.TabIndex = 9;
			this.button2.Text = "取消";
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// qtywcl
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(424, 205);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.tabControl1);
			this.Controls.Add(this.button1);
			this.MaximizeBox = false;
			this.Name = "qtywcl";
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
			this.Text = "qtywcl";
			this.Load += new System.EventHandler(this.qtywcl_Load);
			this.tabControl1.ResumeLayout(false);
			this.tabPage1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void comboBox1_SelectionChangeCommitted(object sender, System.EventArgs e)
		{
			cs.kfsql kfsq=new bggl.cs.kfsql();
			DataSet objset1=kfsq.selectexeshu();
			foreach(DataRow dr in objset1.Tables[0].Rows)
			{
				float cj=0;
				if(dr["kid"].ToString().Trim()==this.comboBox1.Text.Trim())
				{
					if(dr["kzd"].ToString().Trim()=="1")
					{
						TimeSpan cha=System.DateTime.Now-DateTime.Parse(dr["krzsj"].ToString());
						int z=Convert.ToInt32(cha.TotalHours)+1;
						cs.fjlx fjlxsq=new bggl.cs.fjlx();
						string qian=fjlxsq.jq(dr["klx"].ToString().Trim(),dr["kzd"].ToString().Trim()).ToString();
						float yjfy=z*float.Parse(qian)*float.Parse(dr["kzk"].ToString());
						this.label7.Text=yjfy.ToString();
						this.label3.Text=dr["kyj"].ToString().Trim();
							cj=yjfy-float.Parse(dr["kyj"].ToString());
							this.label9.Text=cj.ToString();
							
					}
					else
					{
						TimeSpan cha=System.DateTime.Now-DateTime.Parse(dr["krzsj"].ToString());
						int z=Convert.ToInt32(cha.TotalDays)+1;;
						cs.fjlx fjlxsq=new bggl.cs.fjlx();
						string qian=fjlxsq.jq(dr["klx"].ToString().Trim(),dr["kzd"].ToString().Trim()).ToString();
						float yjfy=z*float.Parse(qian.Trim())*float.Parse(dr["kzk"].ToString());
						this.label7.Text=yjfy.ToString();

							this.label3.Text=dr["kyj"].ToString().Trim();
							cj=yjfy-float.Parse(dr["kyj"].ToString());
							this.label9.Text=cj.ToString();
						
	
					}
				}
			}
		}

		private void qtywcl_Load(object sender, System.EventArgs e)
		{
			cs.kfsql kfsq=new bggl.cs.kfsql();
			
			DataSet objset=kfsq.selectexeshu();
			this.comboBox1.Items.Clear();
			foreach(DataRow dr in objset.Tables[0].Rows){
				if(dr["kname"].ToString().Trim()!=""){
					this.comboBox1.Items.Add(dr["kid"].ToString().Trim());
				}
			
			}
		}
		private void fzcb1(){
			
		}

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

		private void button1_Click(object sender, System.EventArgs e)
		{
			if(this.tabControl1.SelectedIndex==0){
				cs.kfsql kfsq=new bggl.cs.kfsql();

				if(kfsq.updateexey(this.comboBox1.Text,this.label4.Text))
				{
					MessageBox.Show("添加成功!");
				}
				else{
					MessageBox.Show("失败,请重新添加");
				}
			}
		}

		private void textBox1_TextChanged(object sender, System.EventArgs e)
		{
			try
			{
				float z=float.Parse(this.textBox1.Text)+float.Parse(this.label3.Text);
				this.label4.Text=z.ToString();
				float y=float.Parse(this.label7.Text)-float.Parse(this.label4.Text);
				this.label9.Text=y.ToString();
			}
			catch(Exception){
				MessageBox.Show("只能输入数字");
				this.textBox1.Text="";
			}
		}

	}
}

⌨️ 快捷键说明

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