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

📄 housetype.cs

📁 本系统是二手房交易系统 采用asp.net技术 开发环境是vs2003+sqlServer2000
💻 CS
字号:
using System;
using System.Data;
using System.Data.SqlClient;
using HouseSystem.SQLDAL;

namespace HouseSystem.Components
{
	/// <summary>
	/// HouseType 的摘要说明。
	/// </summary>
	public class HouseType
	{
		public static int AddHouseType(string Ht_Name, int Ht_OrderID)
		{
			if (Ht_Name.Trim() == string.Empty)
			{
				throw new Exception("Ht_Name\u53c2\u6570\u4e0d\u80fd\u4e3a\u7a7a\uff01");
			}
			if (HouseType.IsExistHouseType(Ht_Name))
			{
				return -1;
			}
			object[] objArray1 = new object[5] { "INSERT INTO [HouseType] ([Ht_Name],[Ht_OrderID]) VALUES ('", Tools.CheckStrInput(Ht_Name), "',", Ht_OrderID, ")" } ;
			string text1 = string.Concat(objArray1);
			return SQLHelper.ExecuteNonQuery(text1);
		}
 
		public static int DeleteHouseType(int Ht_ID)
		{
			string text1 = "";
			if (Config.GetDbType == DbType.Access)
			{
				text1 = "DELETE * FROM [HouseType] WHERE Ht_ID=" + Ht_ID;
			}
			else
			{
				text1 = "DELETE FROM [HouseType] WHERE Ht_ID=" + Ht_ID;
			}
			return SQLHelper.ExecuteNonQuery(text1);
		}
 
		public static DataTable GetAllHouseTypeList()
		{
			string text1 = "SELECT Ht_ID, Ht_Name, Ht_OrderID FROM HouseType ORDER BY Ht_OrderID;";
			string text2 = Config.GetConnectionString();
			DataSet set1 = SQLHelper.ExecuteDataset(text2, CommandType.Text, text1, new SqlParameter[0]);
			if (set1.Tables.Count > 0)
			{
				return set1.Tables[0];
			}
			return null;
		}
 
		public static string GetHouseTypeByID(int Ht_ID)
		{
			string text1 = "SELECT Ht_Name FROM HouseType WHERE Ht_ID=" + Ht_ID + "";
			object obj1 = SQLHelper.ExecuteScalar(text1);
			if (obj1 != null)
			{
				return obj1.ToString();
			}
			return "";
		}
 
		public static bool IsExistHouseType(string Ht_Name)
		{
			string text1 = Config.GetConnectionString();
			string text2 = "SELECT COUNT(*) AS T FROM HouseType WHERE Ht_Name= '" + Ht_Name + "';";
			int num1 = (int) SQLHelper.ExecuteScalar(text1, CommandType.Text, text2, new SqlParameter[0]);
			if (num1 > 0)
			{
				return true;
			}
			return false;
		}
 
		public static bool IsExistHouseType(string Ht_Name, int Ht_ID)
		{
			string text1 = Config.GetConnectionString();
			object[] objArray1 = new object[5] { "SELECT COUNT(*) AS T FROM HouseType WHERE Ht_ID <> ", Ht_ID, " AND Ht_Name= '", Ht_Name, "';" } ;
			string text2 = string.Concat(objArray1);
			int num1 = (int) SQLHelper.ExecuteScalar(text1, CommandType.Text, text2, new SqlParameter[0]);
			if (num1 > 0)
			{
				return true;
			}
			return false;
		}
 
		public static int UpdateHouseType(string Ht_Name, int Ht_OrderID, int Ht_ID)
		{
			object[] objArray1 = new object[6] { "UPDATE [HouseType] SET [Ht_Name] = '", Tools.CheckStrInput(Ht_Name), "',[Ht_OrderID] = ", Ht_OrderID, " WHERE Ht_ID=", Ht_ID } ;
			string text1 = string.Concat(objArray1);
			return SQLHelper.ExecuteNonQuery(text1);
		}
 

	}
}

⌨️ 快捷键说明

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