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

📄 frmreserve.cs

📁 酒店管理,主要从事酒店管理都可以.这可是北大青鸟的程序
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(80, 24);
			this.label5.TabIndex = 8;
			this.label5.Text = "是否优费:";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.Location = new System.Drawing.Point(248, 72);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(80, 24);
			this.label4.TabIndex = 7;
			this.label4.Text = "价格:";
			// 
			// comRoomNum
			// 
			this.comRoomNum.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.comRoomNum.Location = new System.Drawing.Point(96, 72);
			this.comRoomNum.Name = "comRoomNum";
			this.comRoomNum.Size = new System.Drawing.Size(136, 22);
			this.comRoomNum.TabIndex = 6;
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.Location = new System.Drawing.Point(16, 72);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(80, 24);
			this.label3.TabIndex = 5;
			this.label3.Text = "房间数量:";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(248, 32);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(80, 24);
			this.label2.TabIndex = 4;
			this.label2.Text = "结束日期:";
			// 
			// dateTimePicker2
			// 
			this.dateTimePicker2.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.dateTimePicker2.Location = new System.Drawing.Point(344, 32);
			this.dateTimePicker2.Name = "dateTimePicker2";
			this.dateTimePicker2.Size = new System.Drawing.Size(136, 23);
			this.dateTimePicker2.TabIndex = 3;
			this.dateTimePicker2.ValueChanged += new System.EventHandler(this.dateTimePicker2_ValueChanged);
			// 
			// dateTimePicker1
			// 
			this.dateTimePicker1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.dateTimePicker1.Location = new System.Drawing.Point(96, 32);
			this.dateTimePicker1.Name = "dateTimePicker1";
			this.dateTimePicker1.Size = new System.Drawing.Size(136, 23);
			this.dateTimePicker1.TabIndex = 2;
			this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
			// 
			// txtPrice
			// 
			this.txtPrice.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.txtPrice.Location = new System.Drawing.Point(344, 72);
			this.txtPrice.Name = "txtPrice";
			this.txtPrice.Size = new System.Drawing.Size(136, 23);
			this.txtPrice.TabIndex = 1;
			this.txtPrice.Text = "";
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(16, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(80, 24);
			this.label1.TabIndex = 0;
			this.label1.Text = "起始日期:";
			// 
			// frmReserve
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(536, 261);
			this.Controls.Add(this.groupBox1);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "frmReserve";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "预定房间添加";
			this.Closing += new System.ComponentModel.CancelEventHandler(this.frmReserve_Closing);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion
		
		private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
		{
			this.refreshRoomNum();
		}
		private void refreshRoomNum()
		{
			int intTotal=this.getRoomNum()+i_number;
			this.comRoomNum.Items.Clear();
			for(int i=1;i<=intTotal;i++)
			{
				this.comRoomNum.Items.Add(i.ToString());
			}
		}
		public int getRoomNum()
		{
			String beginDate=this.dateTimePicker1.Value.ToString();
			String endDate=this.dateTimePicker2.Value.ToString();
			//String roomid="1";
			DBService_2 dbs=new DBService_2();
			String selSQL="select sum(roomnum) from roomavailable where roomID='"+roomid+"' and not (begindate >= '"+endDate+"' or enddate <= '"+beginDate+"')";
			DataSet ds=dbs.executeBySQL(selSQL);
			String sel_SQL="select roomnum from guestroom where roomid='"+roomid+"'";
			DataSet d_s=dbs.executeBySQL(sel_SQL);
			int count_i=Convert.ToInt32(ds.Tables[0].Rows[0][0]);
			int count_j=Convert.ToInt32(d_s.Tables[0].Rows[0][0]);
			return count_j-count_i;
		}

		private void dateTimePicker2_ValueChanged(object sender, System.EventArgs e)
		{
			this.refreshRoomNum();
		}

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

		private void button1_Click_1(object sender, System.EventArgs e)
		{
			execute();
		}
		
		private void button2_Click(object sender, System.EventArgs e)
		{
			init();
		}
		private void init()
		{
			this.txtPrice.Text="";
			this.comRoomNum.Text="";
			this.dateTimePicker1.Value=System.DateTime.Now;
			this.dateTimePicker2.Value=System.DateTime.Now;
			this.radioYes.Checked=true;
		}

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

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			this.execute();
		}
		public void execute()
		{
			String beginDate=this.dateTimePicker1.Value.ToString();
			if(this.dateTimePicker1.Value.Date<System.DateTime.Now.Date)
			{
				MessageBox.Show("起始日期要大于当前日期!");
				return;
			}
			String endDate=this.dateTimePicker2.Value.ToString();
			if(this.dateTimePicker2.Value.Date<this.dateTimePicker1.Value.Date)
			{
				MessageBox.Show("结束日期要大于/等于起始日期!");
				return;
			}
			//String roomid="1";
			String roomnum=this.comRoomNum.Text;
			String price=this.txtPrice.Text;
			if(roomnum.Equals(""))
			{
				MessageBox.Show("请输入房间数量!");
				return;
			}
			if(price.Equals(""))
			{
				MessageBox.Show("请输入价格!");
				return;
			}
			
			String ispro=null;
			if(this.radioYes.Checked)
			{
				ispro="1";
			}
			else
			{
				ispro="0";
			}
			String insSQL=null;
			if(this.id!=null)
			{
				insSQL="update roomavailable set roomnum='"+roomnum+"',begindate='"+beginDate+"',enddate='"+endDate+"'";
				insSQL+=",price='"+price+"',lastupdate=now(),isPromotion='"+ispro+"' where id='"+id+"'";
				
			}
			else
			{
				insSQL="insert into roomavailable(roomid,roomnum,begindate,enddate,price,lastupdate,isPromotion) values('"+roomid+"','";
				insSQL+=roomnum+"','"+beginDate+"','"+endDate+"','"+price+"',now(),'"+ispro+"')";
			}
			DBService_2 dbs=new DBService_2();
			int i=dbs.ExecuteNonQuery(insSQL);
			if(i!=0)
			{
				MessageBox.Show("执行成功!");
				if(id==null)
				{
					init();
				}
			}
			else
			{
				MessageBox.Show("执行错误!");
				this.txtPrice.Focus();
			}
		}

		private void frmReserve_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			this.frmMain.Show();
			//this.frmMain.
		}

	}
}

⌨️ 快捷键说明

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