ホテル管理システム
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
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;
 
namespace HotelPms.Data.Master
{
    /// ****************************** Description *******************************
    /// ◇システム名称
    ///  ホテルPMS
    /// ◇概要
    ///  
    /// ◇履歴
    ///  2021/05/14  コード作成ツール    自動作成
    /// ****************************** Declarations ******************************
    [Serializable()]
    public partial class Hotel : 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); 
 
            }
        }
 
        #region  ★★★★★ Function ★★★★★
 
        public bool CompareTo(Hotel item)
        {
            if (ID.CompareTo(item.ID) != 0
                || Name.CompareTo(item.Name) != 0
                || HotelDate.CompareTo(item.HotelDate) != 0
                || RoomCount.CompareTo(item.RoomCount) != 0
                || ZipCode.CompareTo(item.ZipCode) != 0
                || Prefecture.CompareTo(item.Prefecture) != 0
                || Address2.CompareTo(item.Address2) != 0
                || Address3.CompareTo(item.Address3) != 0
                || Address4.CompareTo(item.Address4) != 0
                || Tel.CompareTo(item.Tel) != 0
                || Fax.CompareTo(item.Fax) != 0
                || StartDate.CompareTo(item.StartDate) != 0
                || CreateDate.CompareTo(item.CreateDate) != 0
                || SumDate.CompareTo(item.SumDate) != 0
                || CloseDate.CompareTo(item.CloseDate) != 0
)
            {
                return false;
            }
            return true;
        }
 
 
        public override void CopyTo(object dest)
        {
            Hotel item = dest as Hotel;
            item.ID = ID;
            item.Name = Name;
            item.HotelDate = HotelDate;
            item.RoomCount = RoomCount;
            item.ZipCode = ZipCode;
            item.Prefecture = Prefecture;
            item.Address2 = Address2;
            item.Address3 = Address3;
            item.Address4 = Address4;
            item.Tel = Tel;
            item.Fax = Fax;
            item.StartDate = StartDate;
            item.CreateDate = CreateDate;
            item.SumDate = SumDate;
            item.CloseDate = CloseDate;
 
        }
 
        public override void Clear()
        {
            ID = 0;
            Name = string.Empty;
            HotelDate = Date.Default;
            RoomCount = 0;
            ZipCode = string.Empty;
            Prefecture = string.Empty;
            Address2 = string.Empty;
            Address3 = string.Empty;
            Address4 = string.Empty;
            Tel = string.Empty;
            Fax = string.Empty;
            StartDate = 0;
            CreateDate = Date.Default;
            SumDate = Date.Default;
            CloseDate = 0;
 
        }
 
        public Hotel DeepClone()
        {
            Hotel item = new Hotel();
            item.ID = ID;
            item.Name = Name;
            item.HotelDate = HotelDate;
            item.RoomCount = RoomCount;
            item.ZipCode = ZipCode;
            item.Prefecture = Prefecture;
            item.Address2 = Address2;
            item.Address3 = Address3;
            item.Address4 = Address4;
            item.Tel = Tel;
            item.Fax = Fax;
            item.StartDate = StartDate;
            item.CreateDate = CreateDate;
            item.SumDate = SumDate;
            item.CloseDate = CloseDate;
 
            return item;
        }
 
        public override bool ConvertDataRow(System.Data.DataRow row)
        {
            ID = CConvert.ToInt(row["ID"],ID); 
            Name = row["Name"].ToString(); 
            HotelDate = new Date(row.IsNull("HotelDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["HotelDate"])); 
            RoomCount = CConvert.ToInt(row["RoomCount"],RoomCount); 
            ZipCode = row["ZipCode"].ToString(); 
            Prefecture = row["Prefecture"].ToString(); 
            Address2 = row["Address2"].ToString(); 
            Address3 = row["Address3"].ToString(); 
            Address4 = row["Address4"].ToString(); 
            Tel = row["Tel"].ToString(); 
            Fax = row["Fax"].ToString(); 
            StartDate = CConvert.ToInt(row["StartDate"],StartDate); 
            CreateDate = new Date(row.IsNull("CreateDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["CreateDate"])); 
            SumDate = new Date(row.IsNull("SumDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["SumDate"])); 
            CloseDate = CConvert.ToInt(row["CloseDate"],CloseDate); 
 
            return true;
        }
 
        public void ToDataRow(System.Data.DataRow row)
        {
            row["ID"] = ID;
            row["Name"] = Name;
            row["HotelDate"] = HotelDate.ToDateTime();
            row["RoomCount"] = RoomCount;
            row["ZipCode"] = ZipCode;
            row["Prefecture"] = Prefecture;
            row["Address2"] = Address2;
            row["Address3"] = Address3;
            row["Address4"] = Address4;
            row["Tel"] = Tel;
            row["Fax"] = Fax;
            row["StartDate"] = StartDate;
            row["CreateDate"] = CreateDate.ToDateTime();
            row["SumDate"] = SumDate.ToDateTime();
            row["CloseDate"] = CloseDate;
 
        }
 
        public void ConvertReader(SqlDataReader row)
        {
            ID = CConvert.ToInt(row["ID"],ID); 
            Name = row["Name"].ToString(); 
            HotelDate = new Date(row.IsNull("HotelDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["HotelDate"])); 
            RoomCount = CConvert.ToInt(row["RoomCount"],RoomCount); 
            ZipCode = row["ZipCode"].ToString(); 
            Prefecture = row["Prefecture"].ToString(); 
            Address2 = row["Address2"].ToString(); 
            Address3 = row["Address3"].ToString(); 
            Address4 = row["Address4"].ToString(); 
            Tel = row["Tel"].ToString(); 
            Fax = row["Fax"].ToString(); 
            StartDate = CConvert.ToInt(row["StartDate"],StartDate); 
            CreateDate = new Date(row.IsNull("CreateDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["CreateDate"])); 
            SumDate = new Date(row.IsNull("SumDate") ? 0 : CConvert.ToDateInt((System.DateTime)row["SumDate"])); 
            CloseDate = CConvert.ToInt(row["CloseDate"],CloseDate); 
 
        }
 
        public string AddSql()
        {
            return $@"INSERT INTO S_Hotel(ID,Name,HotelDate,RoomCount,ZipCode,Prefecture,Address2,Address3,Address4,Tel,Fax,StartDate,CreateDate,SumDate,CloseDate) VALUES({ID},N'{Name}',{HotelDate.ToSqlValue()},{RoomCount},N'{ZipCode}',N'{Prefecture}',N'{Address2}',N'{Address3}',N'{Address4}',N'{Tel}',N'{Fax}',{StartDate},{CreateDate.ToSqlValue()},{SumDate.ToSqlValue()},{CloseDate});";
        }
 
        public string UpdateSql()
        {
            return $@"UPDATE S_Hotel SET Name = N'{Name}',HotelDate = {HotelDate.ToSqlValue()},RoomCount = {RoomCount},ZipCode = N'{ZipCode}',Prefecture = N'{Prefecture}',Address2 = N'{Address2}',Address3 = N'{Address3}',Address4 = N'{Address4}',Tel = N'{Tel}',Fax = N'{Fax}',StartDate = {StartDate},CreateDate = {CreateDate.ToSqlValue()},SumDate = {SumDate.ToSqlValue()},CloseDate = {CloseDate} WHERE ID = {ID};";
        }
 
        public string ToText()
        {
            StringBuilder text = new StringBuilder();
            text.AppendFormat("ID={0};", ID);
            text.AppendFormat("Name={0};", Name);
            text.AppendFormat("HotelDate={0};", HotelDate);
            text.AppendFormat("RoomCount={0};", RoomCount);
            text.AppendFormat("ZipCode={0};", ZipCode);
            text.AppendFormat("Prefecture={0};", Prefecture);
            text.AppendFormat("Address2={0};", Address2);
            text.AppendFormat("Address3={0};", Address3);
            text.AppendFormat("Address4={0};", Address4);
            text.AppendFormat("Tel={0};", Tel);
            text.AppendFormat("Fax={0};", Fax);
            text.AppendFormat("StartDate={0};", StartDate);
            text.AppendFormat("CreateDate={0};", CreateDate);
            text.AppendFormat("SumDate={0};", SumDate);
            text.AppendFormat("CloseDate={0};", CloseDate);
 
            return text.ToString();
        }
 
        public override object GetField(string name)
        {
 
            if (name == "ID") { return ID; }
            else if (name == "Name") { return Name; }
            else if (name == "HotelDate") { return HotelDate; }
            else if (name == "RoomCount") { return RoomCount; }
            else if (name == "ZipCode") { return ZipCode; }
            else if (name == "Prefecture") { return Prefecture; }
            else if (name == "Address2") { return Address2; }
            else if (name == "Address3") { return Address3; }
            else if (name == "Address4") { return Address4; }
            else if (name == "Tel") { return Tel; }
            else if (name == "Fax") { return Fax; }
            else if (name == "StartDate") { return StartDate; }
            else if (name == "CreateDate") { return CreateDate; }
            else if (name == "SumDate") { return SumDate; }
            else if (name == "CloseDate") { return CloseDate; }
            else { return null; }
        }
 
        public override bool SetField(string name, object value)
        {
 
            if (name == "ID") { ID = CConvert.ToInt(value); return true; }
            else if (name == "Name") { Name = value.ToString(); return true; }
            else if (name == "HotelDate") { HotelDate = new Date(CConvert.ToDateInt(value)); return true; }
            else if (name == "RoomCount") { RoomCount = CConvert.ToInt(value); return true; }
            else if (name == "ZipCode") { ZipCode = value.ToString(); return true; }
            else if (name == "Prefecture") { Prefecture = value.ToString(); return true; }
            else if (name == "Address2") { Address2 = value.ToString(); return true; }
            else if (name == "Address3") { Address3 = value.ToString(); return true; }
            else if (name == "Address4") { Address4 = value.ToString(); return true; }
            else if (name == "Tel") { Tel = value.ToString(); return true; }
            else if (name == "Fax") { Fax = value.ToString(); return true; }
            else if (name == "StartDate") { StartDate = CConvert.ToInt(value); return true; }
            else if (name == "CreateDate") { CreateDate = new Date(CConvert.ToDateInt(value)); return true; }
            else if (name == "SumDate") { SumDate = new Date(CConvert.ToDateInt(value)); return true; }
            else if (name == "CloseDate") { CloseDate = CConvert.ToInt(value); return true; }
            else { return false; }
        }
 
        #endregion
    }
}