chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Configuration;
|
||||
using System.Data.Common;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Wellan.Data;
|
||||
using Wellan.Common;
|
||||
using System.Transactions;
|
||||
using System.ComponentModel;
|
||||
|
||||
/// <summary>
|
||||
/// 外部人員帳號資料檔
|
||||
/// </summary>
|
||||
[DataObject]
|
||||
public class BpapDAC : Wellan.Data.WDAC
|
||||
{
|
||||
private string _select =
|
||||
@" SELECT BPENO, BPNME, BPPWD, BPEML, BPZON, BPBRH, TRDAT, TRMOD, TRUSR FROM BPAP ";
|
||||
private string _insert =
|
||||
@"INSERT INTO dbo.BPAP
|
||||
(BPENO, BPNME, BPPWD, BPEML, BPZON, BPBRH, TRDAT, TRMOD, TRUSR)
|
||||
VALUES
|
||||
(@BPENO, @BPNME, @BPPWD, @BPEML, @BPZON, @BPBRH, GETDATE(), 'INSERT', @TRUSR)";
|
||||
private string _update =
|
||||
@"UPDATE BPAP SET
|
||||
BPNME = @BPNME,
|
||||
BPEML = @BPEML,
|
||||
BPZON = @BPZON,
|
||||
BPBRH = @BPBRH,
|
||||
TRDAT = GETDATE(),
|
||||
TRMOD = 'UPDATE',
|
||||
TRUSR = @TRUSR
|
||||
WHERE BPENO = @OLD_BPENO";
|
||||
private string _delete =
|
||||
@"DELETE FROM BPAP
|
||||
WHERE BPENO = @OLD_BPENO";
|
||||
|
||||
public BpapDAC()
|
||||
{
|
||||
}
|
||||
|
||||
public BpapDAC(string connectionConfig, string connectionConfigName)
|
||||
: this()
|
||||
{
|
||||
this._connectionConfig = connectionConfig;
|
||||
this._connectionConfigName = connectionConfigName;
|
||||
}
|
||||
|
||||
public BpapDAC(WQuery query)
|
||||
{
|
||||
this._query = query;
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public DataTable SelectAll()
|
||||
{
|
||||
DbCommand cmd = Query.NewCommand();
|
||||
cmd.CommandText = _select + " ORDER BY BPENO ";
|
||||
return Query.Select(cmd);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public DataTable SelectOne(string BPENO)
|
||||
{
|
||||
DbCommand cmd = Query.NewCommand();
|
||||
cmd.CommandText = _select + " WHERE BPENO=@BPENO ";
|
||||
AddParam(cmd, "BPENO", BPENO);
|
||||
return Query.Select(cmd);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert)]
|
||||
public void InsertOne(string BPNME, string BPEML, string BPZON, string BPBRH, string TRUSR)
|
||||
{
|
||||
string BPENO = WGuard1.WNextRen(DateTime.UtcNow.AddHours(8).Date, "BPAP", "BPENO", "\"Z\"<999>", "");
|
||||
|
||||
DbCommand cmd = Query.NewCommand();
|
||||
cmd.CommandText = _insert;
|
||||
AddParam(cmd, "BPENO", BPENO);
|
||||
AddParam(cmd, "BPNME", BPNME);
|
||||
AddParam(cmd, "BPPWD", WGuard1.KeyEnc(BPENO));
|
||||
AddParam(cmd, "BPEML", BPEML);
|
||||
AddParam(cmd, "BPZON", BPZON);
|
||||
AddParam(cmd, "BPBRH", BPBRH);
|
||||
AddParam(cmd, "TRUSR", TRUSR);
|
||||
Query.ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Update)]
|
||||
public void UpdateOne(string OLD_BPENO, string BPENO, string BPNME, string BPEML, string BPZON, string BPBRH, string TRUSR)
|
||||
{
|
||||
DbCommand cmd = Query.NewCommand();
|
||||
cmd.CommandText = _update;
|
||||
AddParam(cmd, "BPNME", BPNME);
|
||||
AddParam(cmd, "BPEML", BPEML);
|
||||
AddParam(cmd, "BPZON", BPZON);
|
||||
AddParam(cmd, "BPBRH", BPBRH);
|
||||
AddParam(cmd, "TRUSR", TRUSR);
|
||||
AddParam(cmd, "OLD_BPENO", OLD_BPENO);
|
||||
Query.ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Delete)]
|
||||
public void DeleteOne(string OLD_BPENO)
|
||||
{
|
||||
DbCommand cmd = Query.NewCommand();
|
||||
cmd.CommandText = _delete;
|
||||
AddParam(cmd, "OLD_BPENO", OLD_BPENO);
|
||||
Query.ExecuteNonQuery(cmd);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 取得人員電子郵件
|
||||
/// </summary>
|
||||
/// <param name="bpeno"></param>
|
||||
/// <returns></returns>
|
||||
public string GetEmail(string bpeno)
|
||||
{
|
||||
DbCommand cmd = Query.NewCommand(@"
|
||||
SELECT BPEML
|
||||
FROM BPAP
|
||||
WHERE BPENO=@BPENO");
|
||||
AddParam(cmd, "BPENO", bpeno);
|
||||
return GetStringValue(Query.ExecuteScalar(cmd));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user