using HotelPms.Share.Util;
|
using System;
|
using System.Collections.Generic;
|
using System.Data;
|
using System.Diagnostics;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading.Tasks;
|
|
namespace HotelPms.Data.Master
|
{
|
public partial class RoomCellTable
|
{
|
/// <summary>
|
/// 自動データテーブル生成
|
/// </summary>
|
/// <returns></returns>
|
public DataTable ToDataTable()
|
{
|
DataTable dataTable = new DataTable();
|
dataTable.TableName = Name;
|
PropertyInfo[] myInfo = typeof(RoomCell).GetProperties(BindingFlags.Public | BindingFlags.Instance);
|
foreach (PropertyInfo item in myInfo)
|
{
|
System.Diagnostics.Debug.WriteLine(item.Name);
|
|
Attribute attribute = item.GetCustomAttribute(typeof(DebuggerNonUserCodeAttribute));
|
if (attribute == null) { continue; }
|
dataTable.Columns.Add(item.Name, item.PropertyType);
|
}
|
|
//データ
|
foreach (RoomCell row in Rows)
|
{
|
DataRow dtRow = dataTable.NewRow();
|
row.ToDataRow(dtRow);
|
dataTable.Rows.Add(dtRow);
|
}
|
return dataTable;
|
}
|
}
|
}
|