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

📄 clientcheckmanage.cs

📁 宾馆信息管理系统: 采用C#编写
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;


namespace HotelManage
{
	/// <summary>
	/// ClientCheckManage 的摘要说明。
	/// </summary>
	public class ClientCheckManage
	{
		private string selectStr;
		private SqlCommand sqlCommand1=null;
		private SqlCommand sqlCommand2=null;
		private SqlDataReader sqlDataReader1=null;
		private SqlConnection sqlConnection1;

		public ClientCheckManage()
		{
			this.sqlConnection1=new SqlConnection(HotelManage.Connection.ConnString);
			this.sqlCommand1=new SqlCommand();			
			this.sqlCommand1.CommandType=CommandType.Text;
			this.sqlCommand1.Connection=this.sqlConnection1;	
			this.sqlCommand2=new SqlCommand();
			this.sqlCommand2.CommandType=CommandType.StoredProcedure;
			this.sqlCommand2.Connection=this.sqlConnection1;
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		public bool ClientCheck(string clientID,string roomID,string bookinDate,float totalMoney)
		{
			this.selectStr="update ClientRecord set TotalMoney="+totalMoney+",CheckDate="+"'"+System.DateTime.Now.Date.ToString()+"'"+" where ClientID="+"'"+clientID+"'";
			this.sqlCommand1.CommandText=this.selectStr;
			try
			{
				if(this.sqlConnection1.State==ConnectionState.Closed)this.sqlConnection1.Open();
				this.sqlCommand1.ExecuteNonQuery();
				this.RoomPeopleNum_Minus(roomID);
				return true;
			}
			catch(System.Exception E)
			{
				Console.WriteLine(E.ToString());
				return false;
			}
			finally
			{				
				this.sqlConnection1.Close();
			}
		}

		private  void RoomPeopleNum_Minus(string roomID)
		{
			this.sqlCommand2.CommandText="dbo.StoredProcedureMinusClient";
			this.sqlCommand2.Parameters.Add(new SqlParameter("@roomID",SqlDbType.Char,4));
			this.sqlCommand2.Parameters["@roomID"].Value=roomID;
			try
			{
				if(this.sqlConnection1.State==ConnectionState.Closed)this.sqlConnection1.Open();
				this.sqlCommand2.ExecuteNonQuery();
			}
			catch(Exception E)
			{
				Console.WriteLine(E.ToString());
			
			}
			finally
			{
				this.sqlConnection1.Close();
			}			
		}
	}
}

⌨️ 快捷键说明

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