chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using System.Data.Common;
|
||||
using WebLib;
|
||||
|
||||
namespace 報到系統
|
||||
{
|
||||
/// <summary>
|
||||
/// BWEX 系統設定資料存取類別
|
||||
/// </summary>
|
||||
public class DAC_BWEX : DAC
|
||||
{
|
||||
public DAC_BWEX() : base() { }
|
||||
|
||||
public DAC_BWEX(DbConnection conn) : base(conn) { }
|
||||
|
||||
/// <summary>依 KeyName 取得 KeyValue</summary>
|
||||
public string GetKeyValue(string keyName)
|
||||
{
|
||||
DbCommand cmd = NewCommand();
|
||||
cmd.CommandText = "select [BSNAM] from [BWEX] where [BSNUM] = @KeyName and [BSITM] = ' 1'";
|
||||
AddParam(cmd, "KeyName", keyName);
|
||||
string result;
|
||||
ExecuteScalar(cmd, out result);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>更新 KeyValue(若不存在則 INSERT)</summary>
|
||||
public void SetKeyValue(string keyName, string keyValue)
|
||||
{
|
||||
DbCommand cmd = NewCommand();
|
||||
cmd.CommandText =
|
||||
"if exists (select 1 from [BWEX] where [BSNUM] = @KeyName and [BSITM] = ' 1') " +
|
||||
" update [BWEX] set [BSNAM] = @KeyValue where [BSNUM] = @KeyName and [BSITM] = ' 1'" +
|
||||
"else " +
|
||||
" insert into [BWEX] ([BSNUM], [BSITM], [BSNAM]) values (@KeyName, ' 1', @KeyValue)";
|
||||
AddParam(cmd, "KeyName", keyName);
|
||||
AddParam(cmd, "KeyValue", keyValue);
|
||||
ExecuteNonQuery(cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user