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;
|
|
namespace HotelPms.Data.UseInfo
|
{
|
/// ****************************** Description *******************************
|
/// ◇システム名称
|
/// ホテルPMS
|
/// ◇概要
|
///
|
/// ◇履歴
|
/// 2021/05/14 コード作成ツール 自動作成
|
/// ****************************** Declarations ******************************
|
[Serializable()]
|
public partial class PayDiv : 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("UseDate", 0);
|
PrimaryKey.TryAdd("PayID", 0);
|
PrimaryKey.TryAdd("RowNo", 0);
|
|
}
|
}
|
|
#region ★★★★★ Function ★★★★★
|
|
private Timestamp ToTimestamp(DateTime dateTime)
|
{
|
return Timestamp.FromDateTime(DateTime.SpecifyKind(dateTime, DateTimeKind.Utc));
|
}
|
|
public bool CompareTo(PayDiv item)
|
{
|
if (ID.CompareTo(item.ID) != 0
|
|| DetailID.CompareTo(item.DetailID) != 0
|
|| UseDate.CompareTo(item.UseDate) != 0
|
|| PayID.CompareTo(item.PayID) != 0
|
|| RowNo.CompareTo(item.RowNo) != 0
|
|| ReceiptID.CompareTo(item.ReceiptID) != 0
|
|| PaySummary.CompareTo(item.PaySummary) != 0
|
|| SaleRowNo.CompareTo(item.SaleRowNo) != 0
|
|| ReceiptPrtType.CompareTo(item.ReceiptPrtType) != 0
|
|| ReceiptPage.CompareTo(item.ReceiptPage) != 0
|
)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
|
public override void CopyTo(object dest)
|
{
|
PayDiv item = dest as PayDiv;
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.UseDate = UseDate;
|
item.PayID = PayID;
|
item.RowNo = RowNo;
|
item.ReceiptID = ReceiptID;
|
item.PaySummary = PaySummary;
|
item.SaleRowNo = SaleRowNo;
|
item.ReceiptPrtType = ReceiptPrtType;
|
item.ReceiptPage = ReceiptPage;
|
|
}
|
|
public override void Clear()
|
{
|
ID = 0;
|
DetailID = 0;
|
UseDate = ToTimestamp(DateTime.MinValue);
|
PayID = 0;
|
RowNo = 0;
|
ReceiptID = 0;
|
PaySummary = 0;
|
SaleRowNo = 0;
|
ReceiptPrtType = 0;
|
ReceiptPage = 0;
|
|
}
|
|
public PayDiv DeepClone()
|
{
|
PayDiv item = new PayDiv();
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.UseDate = UseDate;
|
item.PayID = PayID;
|
item.RowNo = RowNo;
|
item.ReceiptID = ReceiptID;
|
item.PaySummary = PaySummary;
|
item.SaleRowNo = SaleRowNo;
|
item.ReceiptPrtType = ReceiptPrtType;
|
item.ReceiptPage = ReceiptPage;
|
|
return item;
|
}
|
|
public override bool ConvertDataRow(System.Data.DataRow row)
|
{
|
ID = CConvert.ToInt(row["ID"],ID);
|
DetailID = CConvert.ToInt(row["DetailID"],DetailID);
|
UseDate = ToTimestamp(row.IsNull("UseDate") ? DateTime.MinValue : (System.DateTime)row["UseDate"]);
|
PayID = CConvert.ToInt(row["PayID"],PayID);
|
RowNo = CConvert.ToInt(row["RowNo"],RowNo);
|
ReceiptID = CConvert.ToInt(row["ReceiptID"],ReceiptID);
|
PaySummary = CConvert.ToDecimal(row["PaySummary"]);
|
SaleRowNo = CConvert.ToInt(row["SaleRowNo"],SaleRowNo);
|
ReceiptPrtType = CConvert.ToInt(row["ReceiptPrtType"],ReceiptPrtType);
|
ReceiptPage = CConvert.ToInt(row["ReceiptPage"],ReceiptPage);
|
|
return true;
|
}
|
|
public void ToDataRow(System.Data.DataRow row)
|
{
|
row["ID"] = ID;
|
row["DetailID"] = DetailID;
|
row["UseDate"] = UseDate;
|
row["PayID"] = PayID;
|
row["RowNo"] = RowNo;
|
row["ReceiptID"] = ReceiptID;
|
row["PaySummary"] = PaySummary;
|
row["SaleRowNo"] = SaleRowNo;
|
row["ReceiptPrtType"] = ReceiptPrtType;
|
row["ReceiptPage"] = ReceiptPage;
|
|
}
|
|
public void ConvertReader(SqlDataReader row)
|
{
|
ID = CConvert.ToInt(row["ID"],ID);
|
DetailID = CConvert.ToInt(row["DetailID"],DetailID);
|
UseDate = ToTimestamp(row.IsNull("UseDate") ? DateTime.MinValue : (System.DateTime)row["UseDate"]);
|
PayID = CConvert.ToInt(row["PayID"],PayID);
|
RowNo = CConvert.ToInt(row["RowNo"],RowNo);
|
ReceiptID = CConvert.ToInt(row["ReceiptID"],ReceiptID);
|
PaySummary = CConvert.ToDecimal(row["PaySummary"]);
|
SaleRowNo = CConvert.ToInt(row["SaleRowNo"],SaleRowNo);
|
ReceiptPrtType = CConvert.ToInt(row["ReceiptPrtType"],ReceiptPrtType);
|
ReceiptPage = CConvert.ToInt(row["ReceiptPage"],ReceiptPage);
|
|
}
|
|
public string AddSql()
|
{
|
return $@"INSERT INTO D_PayDiv(ID,DetailID,UseDate,PayID,RowNo,ReceiptID,PaySummary,SaleRowNo,ReceiptPrtType,ReceiptPage) VALUES({ID},{DetailID},{CConvert.ToSqlValue(UseDate)},{PayID},{RowNo},{ReceiptID},{PaySummary},{SaleRowNo},{ReceiptPrtType},{ReceiptPage});";
|
}
|
|
public string UpdateSql()
|
{
|
return $@"UPDATE D_PayDiv SET ReceiptID = {ReceiptID},PaySummary = {PaySummary},SaleRowNo = {SaleRowNo},ReceiptPrtType = {ReceiptPrtType},ReceiptPage = {ReceiptPage} WHERE ID = {ID} AND DetailID = {DetailID} AND UseDate = {CConvert.ToSqlValue(UseDate)} AND PayID = {PayID} AND RowNo = {RowNo};";
|
}
|
|
public string ToText()
|
{
|
StringBuilder text = new StringBuilder();
|
text.AppendFormat("ID={0};", ID);
|
text.AppendFormat("DetailID={0};", DetailID);
|
text.AppendFormat("UseDate={0};", UseDate);
|
text.AppendFormat("PayID={0};", PayID);
|
text.AppendFormat("RowNo={0};", RowNo);
|
text.AppendFormat("ReceiptID={0};", ReceiptID);
|
text.AppendFormat("PaySummary={0};", PaySummary);
|
text.AppendFormat("SaleRowNo={0};", SaleRowNo);
|
text.AppendFormat("ReceiptPrtType={0};", ReceiptPrtType);
|
text.AppendFormat("ReceiptPage={0};", ReceiptPage);
|
|
return text.ToString();
|
}
|
|
public override object GetField(string name)
|
{
|
|
if (name == "ID") { return ID; }
|
else if (name == "DetailID") { return DetailID; }
|
else if (name == "UseDate") { return UseDate; }
|
else if (name == "PayID") { return PayID; }
|
else if (name == "RowNo") { return RowNo; }
|
else if (name == "ReceiptID") { return ReceiptID; }
|
else if (name == "PaySummary") { return PaySummary; }
|
else if (name == "SaleRowNo") { return SaleRowNo; }
|
else if (name == "ReceiptPrtType") { return ReceiptPrtType; }
|
else if (name == "ReceiptPage") { return ReceiptPage; }
|
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 == "UseDate") { UseDate = ToTimestamp(CConvert.ToDateTime(value)); return true; }
|
else if (name == "PayID") { PayID = CConvert.ToInt(value); return true; }
|
else if (name == "RowNo") { RowNo = CConvert.ToInt(value); return true; }
|
else if (name == "ReceiptID") { ReceiptID = CConvert.ToInt(value); return true; }
|
else if (name == "PaySummary") { PaySummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "SaleRowNo") { SaleRowNo = CConvert.ToInt(value); return true; }
|
else if (name == "ReceiptPrtType") { ReceiptPrtType = CConvert.ToInt(value); return true; }
|
else if (name == "ReceiptPage") { ReceiptPage = CConvert.ToInt(value); return true; }
|
else { return false; }
|
}
|
|
#endregion
|
}
|
}
|