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

📄 roomtype.cs

📁 酒店管理系统是个不错的 系统 自己做的毕业设计 里面功能齐全
💻 CS
字号:
using System;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using HotelsManage.DateLevel;
namespace HotelsManage.BusinessLevel
{
	/// <summary>
	/// RoomType 的摘要说明。
	/// </summary>
	public class RoomType
	{
         

		string RTname;
		string Area;
		string BedNum;
		string Price;
		int AirCondition;
		int Phone;
		int Television;
		int Toilet;
        
		ListView listview;
		public RoomType(ListView listview)
		{
			this.listview=listview;
		}
		public RoomType(string RTname,string Area,string BedNum, string Price,int AirCondition,int Phone,int Television,int Toilet)
		{
			this.RTname=RTname;
			this.Area=Area;
			this.BedNum=BedNum;
			this.Price=Price;
			this.AirCondition=AirCondition;
			this.Phone=Phone;
			this.Television=Television;
			this.Toilet=Toilet;

			
			//
			// TODO: 在此处添加构造函数逻辑
			//
		}
		private static bool Incommon(string storeName,RoomType Rt)
		{
			bool result=false;
			SqlParameter[] paras=new SqlParameter[8];

			paras[0]=new SqlParameter("@RTname",SqlDbType.VarChar,20);
			paras[0].Value=Rt.RTname;

			paras[1]=new SqlParameter("@Area",SqlDbType.SmallInt);
			paras[1].Value=Rt.Area;

			paras[2]=new SqlParameter("@BedNum",SqlDbType.SmallInt);
			paras[2].Value=Rt.BedNum;

			paras[3]=new SqlParameter("@Price",SqlDbType.VarChar,10);
			paras[3].Value=Rt.Price;

			paras[4]=new SqlParameter("@AirCondition",SqlDbType.Bit);
			paras[4].Value=Rt.AirCondition;

			paras[5]=new SqlParameter("@Phone",SqlDbType.Bit);
			paras[5].Value=Rt.Phone;

			paras[6]=new SqlParameter("@Television",SqlDbType.Bit);
			paras[6].Value=Rt.Television;

			paras[7]=new SqlParameter("@Toilet",SqlDbType.Bit);
			paras[7].Value=Rt.Toilet;
            
			result=DB.ExequlNon(storeName,paras);
			return result;

		}
		private static void  list(SqlDataReader sdr,RoomType Rt)
	{
			while(sdr.Read())
			{
				ListViewItem lvi=new ListViewItem();
				lvi.SubItems.Clear();
				lvi.SubItems[0].Text=sdr["RTname"].ToString();
				lvi.SubItems.Add(sdr["Area"].ToString());
				lvi.SubItems.Add(sdr["BedNum"].ToString());
				lvi.SubItems.Add(sdr["Price"].ToString());
				if(Convert.ToBoolean(sdr["AirCondition"]))
				{
					lvi.SubItems.Add("是");
				}
				else
				{
					lvi.SubItems.Add("否");
				}
				if(Convert.ToBoolean(sdr["Phone"]))
				{
					lvi.SubItems.Add("是");
				}
				else
				{
					lvi.SubItems.Add("否");
				}
				if(Convert.ToBoolean(sdr["Television"]))
				{
					lvi.SubItems.Add("是");
				}
				else
				{
					lvi.SubItems.Add("否");
				}
				if(Convert.ToBoolean(sdr["Toilet"]))
				{
					lvi.SubItems.Add("是");
				}
				else
				{
					lvi.SubItems.Add("否");
				}
				Rt.listview.Items.Add(lvi);
			}
			if(Rt.listview.Items.Count==0)
			{
				MessageBox.Show("没有记录存在","没有记录",MessageBoxButtons.OK,MessageBoxIcon.Information);
			}
	}
		private static void bindListview(RoomType Rt,string storeName)
		{
			
			Rt.listview.Items.Clear();
			Rt.listview.Refresh();
			SqlDataReader sdr=DB.ExequlReader(storeName);
			RoomType.list(sdr,Rt);
//						if(DB.ExequlReader()
			//			{
//			while(sdr.Read())
//			{
//				ListViewItem lvi=new ListViewItem();
//				lvi.SubItems.Clear();
//				lvi.SubItems[0].Text=sdr["RTname"].ToString();
//				lvi.SubItems.Add(sdr["Area"].ToString());
//				lvi.SubItems.Add(sdr["BedNum"].ToString());
//				lvi.SubItems.Add(sdr["Price"].ToString());
//				if(Convert.ToBoolean(sdr["AirCondition"]))
//				{
//					lvi.SubItems.Add("是");
//				}
//				else
//				{
//					lvi.SubItems.Add("否");
//				}
//				if(Convert.ToBoolean(sdr["Phone"]))
//				{
//					lvi.SubItems.Add("是");
//				}
//				else
//				{
//					lvi.SubItems.Add("否");
//				}
//				if(Convert.ToBoolean(sdr["Television"]))
//				{
//					lvi.SubItems.Add("是");
//				}
//				else
//				{
//					lvi.SubItems.Add("否");
//				}
//				if(Convert.ToBoolean(sdr["Toilet"]))
//				{
//					lvi.SubItems.Add("是");
//				}
//				else
//				{
//					lvi.SubItems.Add("否");
//				}
//				Rt.listview.Items.Add(lvi);
//				
//			}
			//			}
//			if(Rt.listview.Items.Count==0)
//			{
//				MessageBox.Show("没有记录存在","没有记录",MessageBoxButtons.OK,MessageBoxIcon.Information);
//			}
		    
		}
		public static void FillListview(RoomType Rt)
		{
			RoomType.bindListview(Rt,"proc_RoomType_Information");
		}
		public static bool RtSearch(RoomType Rt,string txtRoomNum)
		{
			bool result=false;
			SqlParameter[] paras=new SqlParameter[1];
			paras[0]=new SqlParameter("@RoomID",SqlDbType.Char,4);
			paras[0].Value=txtRoomNum;
			try
			{
				Rt.listview.Items.Clear();
				Rt.listview.Refresh();
				SqlDataReader sdr=DB.ExequlReader("proc_Room_SearchRoomType",paras);
				RoomType.list(sdr,Rt);
				result=true;
			}	
			catch{}
			return result;
		}
		public static bool RtAdd(RoomType Rt)
		{
			bool result=false;
			result=RoomType.Incommon("proc_RoomType_Add",Rt);
			return result;
		}
		public static bool RtUpdate(RoomType Rt)
		{
			bool result=false;
			result=RoomType.Incommon("proc_RoomType_Update",Rt);
			return result;
		}
		public static bool RtDelete(string txtRTname)
		{
			bool result=false;
			SqlParameter[] paras=new SqlParameter[1];
			paras[0]=new SqlParameter("@RTname",SqlDbType.VarChar,20);
			paras[0].Value=txtRTname;
            
			result=DB.ExequlNon("proc_RoomType_Delete",paras);
			return result;
		}

	}
}

⌨️ 快捷键说明

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