using System;
|
using System.Collections.Concurrent;
|
using System.Collections.Generic;
|
using System.Data.SqlClient;
|
using System.Text;
|
using HotelPms.Share.Data;
|
using HotelPms.Share.Util;
|
using Google.Protobuf.WellKnownTypes;
|
using customTypes;
|
using System.Data.Common;
|
|
namespace HotelPms.Data.UseInfo;
|
|
/// ****************************** Description *******************************
|
/// ◇システム名称
|
/// ホテルPMS
|
/// ◇概要
|
///
|
/// ◇履歴
|
/// 2021/05/14 コード作成ツール 自動作成
|
/// ****************************** Declarations ******************************
|
[Serializable()]
|
public partial class UseMemo : RecordBase
|
{
|
#region ★★★★★ Property ★★★★★
|
|
public static ConcurrentDictionary<string, int> PrimaryKey { get; } = new ConcurrentDictionary<string, int>();
|
|
#endregion
|
|
partial void OnConstruction()
|
{
|
if (PrimaryKey.Count == 0)
|
{
|
PrimaryKey.TryAdd("ID", 0);
|
PrimaryKey.TryAdd("DetailID", 0);
|
PrimaryKey.TryAdd("TypeID", 0);
|
|
}
|
}
|
|
#region ★★★★★ Function ★★★★★
|
|
public bool CompareTo(UseMemo item)
|
{
|
if (ID.CompareTo(item.ID) != 0
|
|| DetailID.CompareTo(item.DetailID) != 0
|
|| TypeID.CompareTo(item.TypeID) != 0
|
|| Context.CompareTo(item.Context) != 0
|
|| Alert.CompareTo(item.Alert) != 0
|
)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
|
public override void CopyTo(object dest)
|
{
|
UseMemo item = dest as UseMemo;
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.TypeID = TypeID;
|
item.Context = Context;
|
item.Alert = Alert;
|
|
}
|
|
public override void Clear()
|
{
|
ID = 0;
|
DetailID = 0;
|
TypeID = 0;
|
Context = string.Empty;
|
Alert = false;
|
|
}
|
|
public UseMemo DeepClone()
|
{
|
UseMemo item = new UseMemo();
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.TypeID = TypeID;
|
item.Context = Context;
|
item.Alert = Alert;
|
|
return item;
|
}
|
|
public override bool ConvertDataRow(System.Data.DataRow row)
|
{
|
ID = CConvert.ToInt(row["ID"],ID);
|
DetailID = CConvert.ToInt(row["DetailID"],DetailID);
|
TypeID = CConvert.ToInt(row["TypeID"],TypeID);
|
Context = row["Context"].ToString();
|
Alert = CConvert.ToBool(row["Alert"]);
|
|
return true;
|
}
|
|
public void ToDataRow(System.Data.DataRow row)
|
{
|
row["ID"] = ID;
|
row["DetailID"] = DetailID;
|
row["TypeID"] = TypeID;
|
row["Context"] = Context;
|
row["Alert"] = Alert;
|
|
}
|
|
public void ConvertReader(DbDataReader row)
|
{
|
int i = 0;
|
ID = (int)(row.IsDBNull(i) ? 0 : row.GetInt32(i)); i++;
|
DetailID = (int)(row.IsDBNull(i) ? 0 : row.GetInt32(i)); i++;
|
TypeID = (byte)(row.IsDBNull(i) ? 0x00 : row.GetByte(i)); i++;
|
Context = (row.IsDBNull(i) ? string.Empty : row.GetString(i)); i++;
|
Alert = (bool)(row.IsDBNull(i) ? false : row.GetBoolean(i)); i++;
|
|
}
|
|
public string AddSql()
|
{
|
return $@"INSERT INTO D_UseMemo(ID,DetailID,TypeID,Context,Alert) VALUES({ID},{DetailID},{TypeID},N'{Context}',{(Alert ? 1 : 0)});";
|
}
|
|
public string UpdateSql()
|
{
|
return $@"UPDATE D_UseMemo SET Context = N'{Context}',Alert = {(Alert ? 1 : 0)} WHERE ID = {ID} AND DetailID = {DetailID} AND TypeID = {TypeID};";
|
}
|
|
public string ToText()
|
{
|
StringBuilder text = new StringBuilder();
|
text.AppendFormat("ID={0};", ID);
|
text.AppendFormat("DetailID={0};", DetailID);
|
text.AppendFormat("TypeID={0};", TypeID);
|
text.AppendFormat("Context={0};", Context);
|
text.AppendFormat("Alert={0};", Alert);
|
|
return text.ToString();
|
}
|
|
public override object GetField(string name)
|
{
|
|
if (name == "ID") { return ID; }
|
else if (name == "DetailID") { return DetailID; }
|
else if (name == "TypeID") { return TypeID; }
|
else if (name == "Context") { return Context; }
|
else if (name == "Alert") { return Alert; }
|
else { return null; }
|
}
|
|
public override bool SetField(string name, object value)
|
{
|
|
if (name == "ID") { ID = CConvert.ToInt(value); return true; }
|
else if (name == "DetailID") { DetailID = CConvert.ToInt(value); return true; }
|
else if (name == "TypeID") { TypeID = CConvert.ToInt(value); return true; }
|
else if (name == "Context") { Context = value.ToString(); return true; }
|
else if (name == "Alert") { Alert = CConvert.ToBool(value); return true; }
|
else { return false; }
|
}
|
|
#endregion
|
}
|