63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Data;
|
|
using System.Data.Common;
|
|
using System.ComponentModel;
|
|
using WebLib;
|
|
|
|
namespace 報到系統
|
|
{
|
|
[DataObject]
|
|
public class DAC_BPAA : DAC
|
|
{
|
|
public DAC_BPAA()
|
|
{ }
|
|
|
|
public DAC_BPAA(DbConnection conn)
|
|
: base(conn)
|
|
{ }
|
|
|
|
/// <summary>
|
|
/// 搜尋專案 - 用於自動完成
|
|
/// </summary>
|
|
[DataObjectMethod(DataObjectMethodType.Select)]
|
|
public NameValueList Select(string keyword)
|
|
{
|
|
if (string.IsNullOrEmpty(keyword))
|
|
return new NameValueList();
|
|
|
|
DbCommand cmdSelect = NewCommand();
|
|
cmdSelect.CommandText =
|
|
@"select BPPYN as Value, BPPYM as Name
|
|
from BPAA
|
|
where (BPPYN like @BPPYN or BPPYM like @BPPYM)";
|
|
|
|
AddParam(cmdSelect, "BPPYN", $"%{keyword}%");
|
|
AddParam(cmdSelect, "BPPYM", $"%{keyword}%");
|
|
|
|
cmdSelect.CommandText += " order by BPPYN";
|
|
|
|
var result = new NameValueList();
|
|
var list = result as IDataList;
|
|
Select(cmdSelect, ref list);
|
|
return result;
|
|
}
|
|
|
|
public string SelectProjectName(string value)
|
|
{
|
|
if (string.IsNullOrEmpty(value))
|
|
return string.Empty;
|
|
|
|
DbCommand cmdSelect = NewCommand();
|
|
cmdSelect.CommandText =
|
|
@"select BPPYM as Name
|
|
from BPAA
|
|
where BPPYN = @BPPYN";
|
|
AddParam(cmdSelect, "BPPYN", value);
|
|
ExecuteScalar(cmdSelect, out string name);
|
|
return name;
|
|
}
|
|
}
|
|
}
|