ホテル管理システム
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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
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
    }
}