?? city.cs
字號:
using System;
using System.Data;
using System.Collections;
using HRManager.DataAccessLayer;
using HRManager.DataAccessHelper;
namespace HRManager.BusinessLogicLayer
{
/// <summary>
/// 職位城市類
/// </summary>
public class City
{
#region 私有成員
private int _cityId; //城市ID
private string _cityName; //城市名
private bool _exist; //是否存在標志
#endregion 私有成員
#region 屬性
public int CityID
{
set
{
this._cityId=value;
}
get
{
return this._cityId;
}
}
public string CityName
{
set
{
this._cityName=value;
}
get
{
return this._cityName;
}
}
public bool Exist
{
get
{
return this._exist;
}
}
#endregion 屬性
#region 方法
/// <summary>
/// 根據參數cityId,獲取城市詳細信息
/// </summary>
/// <param name="cityId">城市ID</param>
public void LoadData(int cityId)
{
Database db = new Database(); //實例化一個Database類
string sql = "";
sql = "Select * from [City] where cityId = " + cityId;
DataRow dr = db.GetDataRow(sql); //利用Database類的GetDataRow方法查詢數據
//根據查詢得到的數據,對成員賦值
if (dr != null)
{
this._cityId = GetSafeData.ValidateDataRow_N(dr, "CityId");
this._cityName = GetSafeData.ValidateDataRow_S(dr, "CityName");
this._exist = true;
}
else
{
this._exist = false;
}
}
/// <summary>
/// 根據查詢條件哈希表,查詢數據
/// </summary>
/// <param name="queryItems">查詢條件哈希表</param>
/// <returns>查詢結果數據DataTable</returns>
public static DataTable Query(Hashtable queryItems)
{
string where=SqlStringConstructor.GetConditionClause(queryItems);
string sql="Select * From [City]"+where;
Database db = new Database();
return db.GetDataTable(sql);
}
#endregion 方法
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -