ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
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
    }
}