chore: 首次簽入 Thinkyu ASP.NET 專案
- 加入 Visual Studio / ASP.NET .gitignore - 排除建置輸出、IDE 設定、NuGet packages、大型 MSI 安裝檔
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using WebLib;
|
||||
|
||||
namespace 報到系統
|
||||
{
|
||||
public class DAC_BWEH: DAC
|
||||
{
|
||||
[DataObjectMethod(DataObjectMethodType.Select)]
|
||||
public NameValueList SelectByGroupId(string groupId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(groupId))
|
||||
return null;
|
||||
|
||||
DbCommand cmdSelect = NewCommand();
|
||||
cmdSelect.CommandText =
|
||||
@"select A.BPENO as Value, B.BPNME as Name
|
||||
from BWEH A
|
||||
join BPSNView B on A.BPENO=B.BPENO and B.BPEDY is null
|
||||
where A.BPGLP=@BPGLP
|
||||
order by A.BPENO";
|
||||
AddParam(cmdSelect, "BPGLP", groupId);
|
||||
cmdSelect.CommandText += " ";
|
||||
|
||||
var result = new NameValueList();
|
||||
var list = result as IDataList;
|
||||
Select(cmdSelect, ref list);
|
||||
return result;
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Insert)]
|
||||
public bool AddMemberToGroup(string groupId, string employeeId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(groupId) || string.IsNullOrEmpty(employeeId))
|
||||
return false;
|
||||
|
||||
DbCommand cmd = NewCommand();
|
||||
cmd.CommandText = @"
|
||||
IF NOT EXISTS (SELECT 1 FROM BWEH WHERE BPGLP=@BPGLP AND BPENO=@BPENO)
|
||||
BEGIN
|
||||
INSERT INTO BWEH (BPGLP, BPENO) VALUES (@BPGLP, @BPENO)
|
||||
END";
|
||||
AddParam(cmd, "BPGLP", groupId);
|
||||
AddParam(cmd, "BPENO", employeeId);
|
||||
|
||||
int result = ExecuteNonQuery(cmd);
|
||||
return result >= 0;
|
||||
}
|
||||
|
||||
[DataObjectMethod(DataObjectMethodType.Delete)]
|
||||
public bool RemoveMemberFromGroup(string groupId, string employeeId)
|
||||
{
|
||||
if (string.IsNullOrEmpty(groupId) || string.IsNullOrEmpty(employeeId))
|
||||
return false;
|
||||
|
||||
DbCommand cmd = NewCommand();
|
||||
cmd.CommandText = @"DELETE FROM BWEH WHERE BPGLP=@BPGLP AND BPENO=@BPENO";
|
||||
AddParam(cmd, "BPGLP", groupId);
|
||||
AddParam(cmd, "BPENO", employeeId);
|
||||
|
||||
int result = ExecuteNonQuery(cmd);
|
||||
return result > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user