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

📄 roomtypemanage.cs

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


namespace HotelManage
{
	/// <summary>
	/// RoomTypeManage 的摘要说明。
	/// </summary>
	public class RoomTypeManage
	{
		private SqlConnection sqlConnection1=null;
		private SqlCommand sqlCommand1=null;
		//private SqlDataReader sqlDataReader1=null;
		private string selectStr=null;
	 
		
		public RoomTypeManage()
		{
			this.sqlConnection1=new SqlConnection(HotelManage.util.Connection.ConnString);
			this.sqlCommand1=new SqlCommand();
			this.sqlCommand1.CommandType=CommandType.Text;
			this.sqlCommand1.Connection=this.sqlConnection1;
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}

		public void RoomType_Add(string typename,int area,int bednum,float price,int telephone,int tv,int HasToilet,int aircondition)
		{
			this.selectStr="insert into RoomType values("+"'"+typename+"',"+area+","+bednum+","+price+","+aircondition+","+telephone+","+tv+","+HasToilet+")";
			this.sqlCommand1.CommandText=this.selectStr;
			try
			{
				this.sqlConnection1.Open();
				this.sqlCommand1.ExecuteNonQuery();				
			}
			catch(System.Exception E)
			{
				Console.WriteLine(E.ToString());
			}
			finally
			{
				this.sqlConnection1.Close();
			}

		}
		
		public void Room_Delete(string roomID)
		{
			this.selectStr="delete from Room where RoomID="+roomID;
			this.sqlCommand1.CommandText=this.selectStr;
			try
			{
				this.sqlConnection1.Open();
				this.sqlCommand1.ExecuteNonQuery();				
			}
			catch(System.Exception E)
			{
				Console.WriteLine(E.ToString());
			}
			finally
			{
				this.sqlConnection1.Close();
			}
		}
		
		public bool Room_Modify(string typename,int area,int bednum,float price,int telephone,int tv,int HasToilet,int aircondition)
		{
			this.selectStr="update RoomType set Area="+area+","+"BedNum="+bednum+","+"Price="+price+","+"HasToilet="+HasToilet+","+"AirCondition="+aircondition+","+"HasTelevision="+tv+","+"HasPhone="+telephone+" where RoomTypeName="+"'"+typename+"'";
			this.sqlCommand1.CommandText=this.selectStr;
			try
			{
				this.sqlConnection1.Open();
				this.sqlCommand1.ExecuteNonQuery();				
				return true;
			}
			catch(System.Exception E)
			{
				Console.WriteLine(E.ToString());
				return false;
			}
			finally
			{
				this.sqlConnection1.Close();
			}

		}

	}
}

⌨️ 快捷键说明

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