using System.Collections.Generic;
using ChatworkBulkSender.Utils;
using ChatworkBulkSender.Dtos;
using System.Data;
using System;
namespace ChatworkBulkSender.Daos
{
class SenderMasterDao
{
private readonly DBAccess _dB = new DBAccess();
public List<SenderMasterDto> GetAll()
{
string sql = $@"
SELECT
TOP 1
*
FROM dbo.送信者情報マスタ";
DataTable dt = _dB.ExecQuery(sql);
var list = new List<SenderMasterDto>();
foreach (DataRow row in dt.Rows)
{
var dto = new SenderMasterDto
{
SenderInfoId = row.Field<int>("送信者情報ID"),
SenderApiToken = row.Field<string>("C_APIトークン"),
TestRoomId = row.Field<string>("C_テストルームID"),
SenderAccountName = row.Field<string>("送信用アカウント名"),
CreatedDate = row.Field<DateTime?>("登録日時"),
CreatedBy = row.Field<string>("登録ユーザ"),
UpdatedDate = row.Field<DateTime?>("更新日時"),
UpdatedBy = row.Field<string>("更新ユーザ")
,
};
list.Add(dto);
}
return list;
}
}
}