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 SaleDiv : 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("SaleID", 0);
|
PrimaryKey.TryAdd("RowNo", 0);
|
|
}
|
}
|
|
#region ★★★★★ Function ★★★★★
|
|
private Timestamp ToTimestamp(DateTime dateTime)
|
{
|
return Timestamp.FromDateTime(DateTime.SpecifyKind(dateTime, DateTimeKind.Utc));
|
}
|
|
public bool CompareTo(SaleDiv item)
|
{
|
if (ID.CompareTo(item.ID) != 0
|
|| DetailID.CompareTo(item.DetailID) != 0
|
|| UseDate.CompareTo(item.UseDate) != 0
|
|| SaleID.CompareTo(item.SaleID) != 0
|
|| RowNo.CompareTo(item.RowNo) != 0
|
|| ReceiptID.CompareTo(item.ReceiptID) != 0
|
|| Price.CompareTo(item.Price) != 0
|
|| Amount.CompareTo(item.Amount) != 0
|
|| Summary.CompareTo(item.Summary) != 0
|
|| ServiceSummary.CompareTo(item.ServiceSummary) != 0
|
|| TaxSummary.CompareTo(item.TaxSummary) != 0
|
|| BathTaxSummary.CompareTo(item.BathTaxSummary) != 0
|
|| AccTaxSummary.CompareTo(item.AccTaxSummary) != 0
|
|| TotalSummary.CompareTo(item.TotalSummary) != 0
|
|| DiscountSummary.CompareTo(item.DiscountSummary) != 0
|
|| ReceiptPrtType.CompareTo(item.ReceiptPrtType) != 0
|
|| ReceiptPage.CompareTo(item.ReceiptPage) != 0
|
)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
|
public override void CopyTo(object dest)
|
{
|
SaleDiv item = dest as SaleDiv;
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.UseDate = UseDate;
|
item.SaleID = SaleID;
|
item.RowNo = RowNo;
|
item.ReceiptID = ReceiptID;
|
item.Price = Price;
|
item.Amount = Amount;
|
item.Summary = Summary;
|
item.ServiceSummary = ServiceSummary;
|
item.TaxSummary = TaxSummary;
|
item.BathTaxSummary = BathTaxSummary;
|
item.AccTaxSummary = AccTaxSummary;
|
item.TotalSummary = TotalSummary;
|
item.DiscountSummary = DiscountSummary;
|
item.ReceiptPrtType = ReceiptPrtType;
|
item.ReceiptPage = ReceiptPage;
|
|
}
|
|
public override void Clear()
|
{
|
ID = 0;
|
DetailID = 0;
|
UseDate = ToTimestamp(DateTime.MinValue);
|
SaleID = 0;
|
RowNo = 0;
|
ReceiptID = 0;
|
Price = 0;
|
Amount = 0;
|
Summary = 0;
|
ServiceSummary = 0;
|
TaxSummary = 0;
|
BathTaxSummary = 0;
|
AccTaxSummary = 0;
|
TotalSummary = 0;
|
DiscountSummary = 0;
|
ReceiptPrtType = 0;
|
ReceiptPage = 0;
|
|
}
|
|
public SaleDiv DeepClone()
|
{
|
SaleDiv item = new SaleDiv();
|
item.ID = ID;
|
item.DetailID = DetailID;
|
item.UseDate = UseDate;
|
item.SaleID = SaleID;
|
item.RowNo = RowNo;
|
item.ReceiptID = ReceiptID;
|
item.Price = Price;
|
item.Amount = Amount;
|
item.Summary = Summary;
|
item.ServiceSummary = ServiceSummary;
|
item.TaxSummary = TaxSummary;
|
item.BathTaxSummary = BathTaxSummary;
|
item.AccTaxSummary = AccTaxSummary;
|
item.TotalSummary = TotalSummary;
|
item.DiscountSummary = DiscountSummary;
|
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"]);
|
SaleID = CConvert.ToInt(row["SaleID"],SaleID);
|
RowNo = CConvert.ToInt(row["RowNo"],RowNo);
|
ReceiptID = CConvert.ToInt(row["ReceiptID"],ReceiptID);
|
Price = CConvert.ToDecimal(row["Price"]);
|
Amount = CConvert.ToInt(row["Amount"],Amount);
|
Summary = CConvert.ToDecimal(row["Summary"]);
|
ServiceSummary = CConvert.ToDecimal(row["ServiceSummary"]);
|
TaxSummary = CConvert.ToDecimal(row["TaxSummary"]);
|
BathTaxSummary = CConvert.ToDecimal(row["BathTaxSummary"]);
|
AccTaxSummary = CConvert.ToDecimal(row["AccTaxSummary"]);
|
TotalSummary = CConvert.ToDecimal(row["TotalSummary"]);
|
DiscountSummary = CConvert.ToDecimal(row["DiscountSummary"]);
|
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["SaleID"] = SaleID;
|
row["RowNo"] = RowNo;
|
row["ReceiptID"] = ReceiptID;
|
row["Price"] = Price;
|
row["Amount"] = Amount;
|
row["Summary"] = Summary;
|
row["ServiceSummary"] = ServiceSummary;
|
row["TaxSummary"] = TaxSummary;
|
row["BathTaxSummary"] = BathTaxSummary;
|
row["AccTaxSummary"] = AccTaxSummary;
|
row["TotalSummary"] = TotalSummary;
|
row["DiscountSummary"] = DiscountSummary;
|
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"]);
|
SaleID = CConvert.ToInt(row["SaleID"],SaleID);
|
RowNo = CConvert.ToInt(row["RowNo"],RowNo);
|
ReceiptID = CConvert.ToInt(row["ReceiptID"],ReceiptID);
|
Price = CConvert.ToDecimal(row["Price"]);
|
Amount = CConvert.ToInt(row["Amount"],Amount);
|
Summary = CConvert.ToDecimal(row["Summary"]);
|
ServiceSummary = CConvert.ToDecimal(row["ServiceSummary"]);
|
TaxSummary = CConvert.ToDecimal(row["TaxSummary"]);
|
BathTaxSummary = CConvert.ToDecimal(row["BathTaxSummary"]);
|
AccTaxSummary = CConvert.ToDecimal(row["AccTaxSummary"]);
|
TotalSummary = CConvert.ToDecimal(row["TotalSummary"]);
|
DiscountSummary = CConvert.ToDecimal(row["DiscountSummary"]);
|
ReceiptPrtType = CConvert.ToInt(row["ReceiptPrtType"],ReceiptPrtType);
|
ReceiptPage = CConvert.ToInt(row["ReceiptPage"],ReceiptPage);
|
|
}
|
|
public string AddSql()
|
{
|
return $@"INSERT INTO D_SaleDiv(ID,DetailID,UseDate,SaleID,RowNo,ReceiptID,Price,Amount,Summary,ServiceSummary,TaxSummary,BathTaxSummary,AccTaxSummary,TotalSummary,DiscountSummary,ReceiptPrtType,ReceiptPage) VALUES({ID},{DetailID},{CConvert.ToSqlValue(UseDate)},{SaleID},{RowNo},{ReceiptID},{Price},{Amount},{Summary},{ServiceSummary},{TaxSummary},{BathTaxSummary},{AccTaxSummary},{TotalSummary},{DiscountSummary},{ReceiptPrtType},{ReceiptPage});";
|
}
|
|
public string UpdateSql()
|
{
|
return $@"UPDATE D_SaleDiv SET ReceiptID = {ReceiptID},Price = {Price},Amount = {Amount},Summary = {Summary},ServiceSummary = {ServiceSummary},TaxSummary = {TaxSummary},BathTaxSummary = {BathTaxSummary},AccTaxSummary = {AccTaxSummary},TotalSummary = {TotalSummary},DiscountSummary = {DiscountSummary},ReceiptPrtType = {ReceiptPrtType},ReceiptPage = {ReceiptPage} WHERE ID = {ID} AND DetailID = {DetailID} AND UseDate = {CConvert.ToSqlValue(UseDate)} AND SaleID = {SaleID} 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("SaleID={0};", SaleID);
|
text.AppendFormat("RowNo={0};", RowNo);
|
text.AppendFormat("ReceiptID={0};", ReceiptID);
|
text.AppendFormat("Price={0};", Price);
|
text.AppendFormat("Amount={0};", Amount);
|
text.AppendFormat("Summary={0};", Summary);
|
text.AppendFormat("ServiceSummary={0};", ServiceSummary);
|
text.AppendFormat("TaxSummary={0};", TaxSummary);
|
text.AppendFormat("BathTaxSummary={0};", BathTaxSummary);
|
text.AppendFormat("AccTaxSummary={0};", AccTaxSummary);
|
text.AppendFormat("TotalSummary={0};", TotalSummary);
|
text.AppendFormat("DiscountSummary={0};", DiscountSummary);
|
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 == "SaleID") { return SaleID; }
|
else if (name == "RowNo") { return RowNo; }
|
else if (name == "ReceiptID") { return ReceiptID; }
|
else if (name == "Price") { return Price; }
|
else if (name == "Amount") { return Amount; }
|
else if (name == "Summary") { return Summary; }
|
else if (name == "ServiceSummary") { return ServiceSummary; }
|
else if (name == "TaxSummary") { return TaxSummary; }
|
else if (name == "BathTaxSummary") { return BathTaxSummary; }
|
else if (name == "AccTaxSummary") { return AccTaxSummary; }
|
else if (name == "TotalSummary") { return TotalSummary; }
|
else if (name == "DiscountSummary") { return DiscountSummary; }
|
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 == "SaleID") { SaleID = 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 == "Price") { Price = CConvert.ToDecimal(value); return true; }
|
else if (name == "Amount") { Amount = CConvert.ToInt(value); return true; }
|
else if (name == "Summary") { Summary = CConvert.ToDecimal(value); return true; }
|
else if (name == "ServiceSummary") { ServiceSummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "TaxSummary") { TaxSummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "BathTaxSummary") { BathTaxSummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "AccTaxSummary") { AccTaxSummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "TotalSummary") { TotalSummary = CConvert.ToDecimal(value); return true; }
|
else if (name == "DiscountSummary") { DiscountSummary = CConvert.ToDecimal(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
|
}
|
}
|