プロジェクト

全般

プロフィール

リビジョン 219

堀内7年以上前に追加

工事承認:注文書承認バグ修正
担当者承認:手間・業者支払い承認追加(途中)
SQLのStringBuilder化
承認一覧画面:請求承認追加、メニューに実装

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonDefine.cs
1683 1683
            PerosonApproval,
1684 1684
        }
1685 1685
        #endregion
1686

  
1686 1687
        #region 業者手間区分
1687 1688
        /// <summary>
1688 1689
        /// 業者手間区分                          // Add BIT 2017/02/23
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 47;
17
        public static int s_SystemVersion = 48;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
1178 1178

  
1179 1179
                // パラメータセット
1180 1180
                frm.ConstructionCode = CurrentPara.IntExecParameter[0];
1181
                if (CurrentPara.IntExecParameter.Count > 1) frm.OrderNo = CurrentPara.IntExecParameter[1];
1181
                if (CurrentPara.IntExecParameter.Count > 1) frm.OrderNo = CurrentPara.IntExecParameter[2];
1182 1182

  
1183 1183
                // 直接表示フラグのセット
1184 1184
                if (CurrentPara.BoolExecParameter.Count > 0)
......
1263 1263

  
1264 1264
                // 条件を取り込む
1265 1265
                frm.ApprovalCode = CurrentPara.IntExecParameter[0];
1266
                if (CurrentPara.IntExecParameter.Count > 1) frm.AllPurposeKinds = CurrentPara.IntExecParameter[1];
1266 1267

  
1267 1268
                // フォーム表示
1268 1269
                frm.ShowDialog();
......
2509 2510
            try
2510 2511
            {
2511 2512
                frm.ExecuteFlg = CurrentPara.IntExecParameter[0];
2513
                if (CurrentPara.IntExecParameter.Count > 1) frm.BillingSplitFlg = CurrentPara.IntExecParameter[1];
2512 2514
                // フォーム表示
2513 2515
                frm.ShowDialog();
2514 2516
            }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMComponentLink.cs
29 29

  
30 30
        #region 定数
31 31
        /// <summary>
32
        /// 工事項目マスタフィールド並び
32
        /// 構成関連マスタフィールド並び
33 33
        /// </summary>
34 34
        public enum NameColumn
35 35
        {
......
53 53

  
54 54
        #endregion
55 55

  
56
        #region 検索処理
56
        #region 構成関連マスタ検索SQL作成
57 57
        /// <summary>
58
        /// 工事項目マスタ検索
58
        /// 構成関連マスタ検索SQL作成
59 59
        /// </summary>
60 60
        /// <param name="AddSQLString">検索条件SQL文字列</param>
61
        /// <param name="data">工事項目マスタデータ</param>
61
        /// <param name="data">構成関連マスタデータ</param>
62 62
        /// <returns>true:成功 false:失敗</returns>
63 63
        private string CreateSelectSQL()
64 64
        {
65 65
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
66
            string strcmd = "SELECT";
67
            strcmd += "  ComponentCode";
68
            strcmd += " ,ItemCode";
69
            strcmd += " ,DisplayOrder";
70
            strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
71
            strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
72
            strcmd += " FROM ComponentLinkMaster";
66
            StringBuilder strcmd = new StringBuilder();
67
            strcmd.Append("SELECT");
68
            strcmd.Append("  ComponentCode");
69
            strcmd.Append(" ,ItemCode");
70
            strcmd.Append(" ,DisplayOrder");
71
            strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
72
            strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
73
            strcmd.Append(" FROM ComponentLinkMaster");
73 74

  
74
            return strcmd;
75
            return strcmd.ToString();
75 76
        }
77
        #endregion
78

  
79
        #region 構成関連マスタ検索(複数)
80
        /// <summary>
81
        /// 構成関連マスタ検索(複数)
82
        /// </summary>
83
        /// <param name="AddSQLString"></param>
84
        /// <param name="data"></param>
85
        /// <param name="bConnect"></param>
86
        /// <returns></returns>
76 87
        public bool SelectAction(string AddSQLString, ref List<ComponentLinkMaster> data, bool bConnect = true)
77 88
        {
78 89
            // インターフェース
79
            string strcmd = "";
90
            StringBuilder strcmd = new StringBuilder();
80 91
            ArrayList arData = new ArrayList();
81 92

  
82 93
            try
83 94
            {
84 95
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
85
                strcmd = CreateSelectSQL() + AddSQLString;
96
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
86 97

  
87 98
                // SQL実行
88
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
99
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
89 100

  
90 101
                // データセット
91 102
                foreach (object[] objwrk in arData)
......
99 110
            }
100 111
            catch (Exception ex)
101 112
            {
102
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
113
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
103 114
                return false;
104 115
            }
105 116

  
106 117
        }
118
        #endregion
119

  
120
        #region 構成関連マスタ検索(1件)
121
        /// <summary>
122
        /// 構成関連マスタ検索(1件)
123
        /// </summary>
124
        /// <param name="AddSQLString"></param>
125
        /// <param name="data"></param>
126
        /// <param name="bConnect"></param>
127
        /// <returns></returns>
107 128
        public bool SelectAction(string AddSQLString, ref ComponentLinkMaster data, bool bConnect = true)
108 129
        {
109 130
            // インターフェース
110
            string strcmd = "";
131
            StringBuilder strcmd = new StringBuilder();
111 132
            ArrayList arData = new ArrayList();
112 133

  
113 134
            try
114 135
            {
115 136
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
116
                strcmd = CreateSelectSQL() + AddSQLString;
137
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
117 138

  
118 139
                // SQL実行
119
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
140
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
120 141
                // データ無
121 142
                if (arData.Count == 0) return false;
122 143

  
......
131 152
            }
132 153
            catch (Exception ex)
133 154
            {
134
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
155
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
135 156
                return false;
136 157
            }
137 158

  
138 159
        }
139 160
        #endregion
140 161

  
141
        #region 追加処理
162
        #region 構成関連マスタ追加(1件)
142 163
        /// <summary>
143
        /// 工事項目マスタ追加
164
        /// 構成関連マスタ追加(1件)
144 165
        /// </summary>
145
        /// <param name="data">工事項目マスタデータ</param>
166
        /// <param name="data">構成関連マスタデータ</param>
146 167
        /// <returns>true:成功 false:失敗</returns>
147 168
        public bool InsertAction(ComponentLinkMaster work, bool bConnect = true)
148 169
        {
149
            string strcmd = "";
170
            StringBuilder strcmd = new StringBuilder();
150 171
            try
151 172
            {
152 173
                bool bColFirst = true;
153
                strcmd = "INSERT INTO ComponentLinkMaster";
154
                strcmd += " (";
174
                strcmd.Append("INSERT INTO ComponentLinkMaster");
175
                strcmd.Append(" (");
155 176
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
156 177
                {
157
                    if (!bColFirst) strcmd += ", ";
158
                    strcmd += gender.ToString();
178
                    if (!bColFirst) strcmd.Append(", ");
179
                    strcmd.Append(gender.ToString());
159 180
                    bColFirst = false;
160 181
                }
161
                strcmd += ") VALUES (";
182
                strcmd.Append(") VALUES (");
162 183

  
163
                strcmd += string.Format("  {0}", work.ComponentCode.ToString());
164
                strcmd += string.Format(", {0}", work.ItemCode.ToString());
165
                strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
184
                strcmd.AppendFormat("  {0}", work.ComponentCode.ToString());
185
                strcmd.AppendFormat(", {0}", work.ItemCode.ToString());
186
                strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
166 187

  
167
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
168
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
169
                strcmd += ")";
188
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
189
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
190
                strcmd.Append(")");
170 191

  
171
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
192
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
172 193

  
173 194
                return true;
174 195
            }
175 196
            catch (Exception ex)
176 197
            {
177
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
198
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
178 199
                return false;
179 200
            }
180 201
        }
202
        #endregion
203

  
204
        #region 構成関連マスタ追加(複数)
181 205
        /// <summary>
182
        /// 工事項目マスタ追加
206
        /// 構成関連マスタ追加(複数)
183 207
        /// </summary>
184
        /// <param name="data">工事項目マスタデータ</param>
208
        /// <param name="data">構成関連マスタデータ</param>
185 209
        /// <returns>true:成功 false:失敗</returns>
186 210
        public bool InsertAction(List<ComponentLinkMaster> data, bool bConnect = true)
187 211
        {
188
            string strcmd = "";
212
            StringBuilder strcmd = new StringBuilder();
189 213
            try
190 214
            {
191 215
                bool bColFirst = true;
192
                strcmd = "INSERT INTO ComponentLinkMaster";
193
                strcmd += " (";
216
                strcmd.Append("INSERT INTO ComponentLinkMaster");
217
                strcmd.Append(" (");
194 218
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
195 219
                {
196
                    if (!bColFirst) strcmd += ", ";
197
                    strcmd += gender.ToString();
220
                    if (!bColFirst) strcmd.Append(", ");
221
                    strcmd.Append(gender.ToString());
198 222
                    bColFirst = false;
199 223
                }
200
                strcmd += ") VALUES";
224
                strcmd.Append(") VALUES");
201 225

  
202 226
                bool bDataFirst = true;
203 227
                foreach (ComponentLinkMaster work in data)
204 228
                {
205
                    if (bDataFirst) strcmd += " (";
206
                    else strcmd += ", (";
229
                    if (bDataFirst) strcmd.Append(" (");
230
                    else strcmd.Append(", (");
207 231

  
208
                    strcmd += string.Format("  {0}", work.ComponentCode.ToString());
209
                    strcmd += string.Format(", {0}", work.ItemCode.ToString());
210
                    strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
232
                    strcmd.AppendFormat("  {0}", work.ComponentCode.ToString());
233
                    strcmd.AppendFormat(", {0}", work.ItemCode.ToString());
234
                    strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
211 235

  
212
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
213
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
214
                    strcmd += ")";
236
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
237
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
238
                    strcmd.Append(")");
215 239

  
216 240
                    bDataFirst = false;
217 241
                }
218 242

  
219
                if (!ExecuteNonQuery(strcmd, false)) return false;
243
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
220 244

  
221 245
                return true;
222 246
            }
223 247
            catch (Exception ex)
224 248
            {
225
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
249
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
226 250
                return false;
227 251
            }
228 252
        }
229 253
        #endregion
230 254

  
231
        #region 更新処理
255
        #region 構成関連マスタ更新
232 256
        /// <summary>
233
        /// 工事項目マスタ更新
257
        /// 構成関連マスタ更新
234 258
        /// </summary>
235 259
        /// <param name="AddSQLString">更新条件SQL文字列</param>
236
        /// <param name="data">工事項目マスタデータ</param>
260
        /// <param name="data">構成関連マスタデータ</param>
237 261
        /// <returns>true:成功 false:失敗</returns>
238 262
        public bool UpdateAction(string AddSQLString, ComponentLinkMaster data, bool bConnect = true)
239 263
        {
240
            string strcmd = "";
264
            StringBuilder strcmd = new StringBuilder();
241 265
            try
242 266
            {
243 267

  
244
                strcmd = "UPDATE ComponentLinkMaster";
268
                strcmd.Append("UPDATE ComponentLinkMaster");
245 269

  
246
                strcmd += " SET";
270
                strcmd.Append(" SET");
247 271

  
248
                strcmd += string.Format(" ComponentCode = {0}", data.ComponentCode.ToString());
249
                strcmd += string.Format(",ItemCode = {0}", data.ItemCode.ToString());
250
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
272
                strcmd.AppendFormat(" ComponentCode = {0}", data.ComponentCode.ToString());
273
                strcmd.AppendFormat(",ItemCode = {0}", data.ItemCode.ToString());
274
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
251 275

  
252
                strcmd += ", UpdateDate = NOW()";
253
                strcmd += AddSQLString;
276
                strcmd.Append(", UpdateDate = NOW()");
277
                strcmd.Append(AddSQLString);
254 278

  
255
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
279
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
256 280

  
257 281
                return true;
258 282
            }
259 283
            catch (Exception ex)
260 284
            {
261
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
285
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
262 286
                return false;
263 287
            }
264 288
        }
265 289
        #endregion
266 290

  
267
        #region 削除
291
        #region 構成関連マスタ削除
268 292
        /// <summary>
269
        /// 工事項目マスタ削除
293
        /// 構成関連マスタ削除
270 294
        /// </summary>
271 295
        /// <param name="AddSQLString">削除条件SQL文字列</param>
272
        /// <param name="data">工事項目マスタデータ</param>
296
        /// <param name="data">構成関連マスタデータ</param>
273 297
        /// <returns>true:成功 false:失敗</returns>
274 298
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
275 299
        {
276 300
            // インターフェース
277
            string strcmd = "";
301
            StringBuilder strcmd = new StringBuilder();
278 302
            try
279 303
            {
280
                strcmd = string.Format("{0}{1}", "DELETE FROM ComponentLinkMaster", AddSQLString);
304
                strcmd.AppendFormat("{0}{1}", "DELETE FROM ComponentLinkMaster", AddSQLString);
281 305

  
282
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
306
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
283 307

  
284 308
                return true;
285 309
            }
286 310
            catch (Exception ex)
287 311
            {
288
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
312
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
289 313
                return false;
290 314
            }
291 315
        }
......
332 356
        public int SelectMaxIDisplayOrderCount(string AddSQLString, bool bConnect = true)
333 357
        {
334 358
            // インターフェース
335
            string strcmd = "";
359
            StringBuilder strcmd = new StringBuilder();
336 360
            ArrayList arData = new ArrayList();
337 361
            int iRet = 0;
338 362
            try
339 363
            {
340 364
                // SQL作成
341
                strcmd = "SELECT IFNULL(MAX(DisplsyOrder), 0) FROM ComponentLinkMaster" + AddSQLString;
365
                strcmd.AppendFormat("SELECT IFNULL(MAX(DisplsyOrder), 0) FROM ComponentLinkMaster{0}", AddSQLString);
342 366

  
343 367
                // SQL実行
344
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet;
368
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
345 369

  
346 370
                // データセット
347 371
                foreach (object[] objwrk in arData)
......
354 378
            }
355 379
            catch (Exception ex)
356 380
            {
357
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
381
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
358 382
            }
359 383

  
360 384
            return iRet;
......
369 393
        /// <returns>Where文字列</returns>
370 394
        public string CreatePrimarykeyString(int ComponentCode, int ItemCode=0)
371 395
        {
372
            string strWork = "";
396
            StringBuilder strWork = new StringBuilder();
373 397
            try
374 398
            {
375
                strWork = string.Format(" Where ComponentCode = {0}", ComponentCode);
399
                strWork.AppendFormat(" Where ComponentCode = {0}", ComponentCode);
376 400
                if (ItemCode != 0)
377
                    strWork += string.Format(" And ItemCode = {0}", ItemCode);
401
                    strWork.AppendFormat(" And ItemCode = {0}", ItemCode);
378 402
            }
379 403
            catch (Exception ex)
380 404
            {
381
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
405
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
382 406
            }
383 407

  
384
            return strWork;
408
            return strWork.ToString();
385 409
        }
386 410
        #endregion
387 411
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMComponentToTypeMaster.cs
29 29

  
30 30
        #region 定数
31 31
        /// <summary>
32
        /// 工事項目マスタフィールド並び
32
        /// 構成工事種別関連マスタフィールド並び
33 33
        /// </summary>
34 34
        public enum NameColumn
35 35
        {
......
58 58
        /// 構成工事種別関連マスタ検索文字列作成
59 59
        /// </summary>
60 60
        /// <param name="AddSQLString">検索条件SQL文字列</param>
61
        /// <param name="data">工事項目マスタデータ</param>
61
        /// <param name="data">構成工事種別関連マスタデータ</param>
62 62
        /// <returns>true:成功 false:失敗</returns>
63 63
        private string CreateSelectSQL()
64 64
        {
65 65
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
66
            string strcmd = "SELECT";
67
            strcmd += "  ComponentCode";
68
            strcmd += " ,ItemCode";
69
            strcmd += " ,DisplayOrder";
70
            strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
71
            strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
72
            strcmd += " FROM ComponentToTypeMaster";
66
            StringBuilder strcmd = new StringBuilder();
67
            strcmd.Append("SELECT");
68
            strcmd.Append("  ComponentCode");
69
            strcmd.Append(" ,ItemCode");
70
            strcmd.Append(" ,DisplayOrder");
71
            strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
72
            strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
73
            strcmd.Append(" FROM ComponentToTypeMaster");
73 74

  
74
            return strcmd;
75
            return strcmd.ToString();
75 76
        }
76 77
        #endregion
77 78

  
......
86 87
        public bool SelectAction(string AddSQLString, ref List<ComponentToTypeMaster> data, bool bConnect = true)
87 88
        {
88 89
            // インターフェース
89
            string strcmd = "";
90
            StringBuilder strcmd = new StringBuilder();
90 91
            ArrayList arData = new ArrayList();
91 92

  
92 93
            try
93 94
            {
94 95
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
95
                strcmd = CreateSelectSQL() + AddSQLString;
96
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
96 97

  
97 98
                // SQL実行
98
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
99
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
99 100

  
100 101
                // データセット
101 102
                foreach (object[] objwrk in arData)
......
109 110
            }
110 111
            catch (Exception ex)
111 112
            {
112
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
113
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
113 114
                return false;
114 115
            }
115 116

  
......
127 128
        public bool SelectAction(string AddSQLString, ref ComponentToTypeMaster data, bool bConnect = true)
128 129
        {
129 130
            // インターフェース
130
            string strcmd = "";
131
            StringBuilder strcmd = new StringBuilder();
131 132
            ArrayList arData = new ArrayList();
132 133

  
133 134
            try
134 135
            {
135 136
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
136
                strcmd = CreateSelectSQL() + AddSQLString;
137
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
137 138

  
138 139
                // SQL実行
139
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
140
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
140 141
                // データ無
141 142
                if (arData.Count == 0) return false;
142 143

  
......
151 152
            }
152 153
            catch (Exception ex)
153 154
            {
154
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
155
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
155 156
                return false;
156 157
            }
157 158

  
......
160 161

  
161 162
        #region 追加処理
162 163
        /// <summary>
163
        /// 工事項目マスタ追加
164
        /// 構成工事種別関連マスタ追加
164 165
        /// </summary>
165
        /// <param name="data">工事項目マスタデータ</param>
166
        /// <param name="data">構成工事種別関連マスタデータ</param>
166 167
        /// <returns>true:成功 false:失敗</returns>
167 168
        public bool InsertAction(ComponentToTypeMaster work, bool bConnect = true)
168 169
        {
169
            string strcmd = "";
170
            StringBuilder strcmd = new StringBuilder();
170 171
            try
171 172
            {
172
                strcmd = "INSERT INTO ComponentToTypeMaster";
173
                strcmd.Append("INSERT INTO ComponentToTypeMaster");
173 174

  
174
                strcmd += " VALUES (";
175
                strcmd.Append(" VALUES (");
175 176

  
176
                strcmd += string.Format("  {0}", work.ComponentCode.ToString());
177
                strcmd += string.Format(", {0}", work.TypeCode.ToString());
177
                strcmd.AppendFormat("  {0}", work.ComponentCode.ToString());
178
                strcmd.AppendFormat(", {0}", work.TypeCode.ToString());
178 179

  
179
                strcmd += ", NOW()";
180
                strcmd += ", NOW()";
181
                strcmd += ")";
180
                strcmd.Append(", NOW()");
181
                strcmd.Append(", NOW()");
182
                strcmd.Append(")");
182 183

  
183
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
184
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
184 185

  
185 186
                return true;
186 187
            }
187 188
            catch (Exception ex)
188 189
            {
189
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
190
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
190 191
                return false;
191 192
            }
192 193
        }
193 194
        #endregion
194 195

  
195
        #region 工事項目マスタ追加
196
        #region 構成工事種別関連マスタ追加
196 197
        /// <summary>
197
        /// 工事項目マスタ追加
198
        /// 構成工事種別関連マスタ追加
198 199
        /// </summary>
199
        /// <param name="data">工事項目マスタデータ</param>
200
        /// <param name="data">構成工事種別関連マスタデータ</param>
200 201
        /// <returns>true:成功 false:失敗</returns>
201 202
        public bool InsertAction(List<ComponentToTypeMaster> data, bool bConnect = true)
202 203
        {
203
            string strcmd = "";
204
            StringBuilder strcmd = new StringBuilder();
204 205
            try
205 206
            {
206

  
207 207
                foreach (ComponentToTypeMaster work in data)
208 208
                {
209 209
                    InsertAction(work, bConnect);
......
212 212
            }
213 213
            catch (Exception ex)
214 214
            {
215
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
215
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
216 216
                return false;
217 217
            }
218 218
        }
219 219
        #endregion
220 220

  
221
        #region 更新処理
221
        #region 構成工事種別関連マスタ更新
222 222
        /// <summary>
223
        /// 工事項目マスタ更新
223
        /// 構成工事種別関連マスタ更新
224 224
        /// </summary>
225 225
        /// <param name="AddSQLString">更新条件SQL文字列</param>
226
        /// <param name="data">工事項目マスタデータ</param>
226
        /// <param name="data">構成工事種別関連マスタデータ</param>
227 227
        /// <returns>true:成功 false:失敗</returns>
228 228
        public bool UpdateAction(string AddSQLString, ComponentToTypeMaster data, bool bConnect = true)
229 229
        {
230
            string strcmd = "";
230
            StringBuilder strcmd = new StringBuilder();
231 231
            try
232 232
            {
233
                strcmd.Append("UPDATE ComponentToTypeMaster");
233 234

  
234
                strcmd = "UPDATE ComponentToTypeMaster";
235
                strcmd.Append(" SET");
235 236

  
236
                strcmd += " SET";
237
                strcmd.AppendFormat(" ComponentCode = {0}", data.ComponentCode.ToString());
238
                strcmd.AppendFormat(",ItemCode = {0}", data.TypeCode.ToString());
237 239

  
238
                strcmd += string.Format(" ComponentCode = {0}", data.ComponentCode.ToString());
239
                strcmd += string.Format(",ItemCode = {0}", data.TypeCode.ToString());
240
                strcmd.Append(", UpdateDate = NOW()");
241
                strcmd.Append(AddSQLString);
240 242

  
241
                strcmd += ", UpdateDate = NOW()";
242
                strcmd += AddSQLString;
243
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
243 244

  
244
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
245

  
246 245
                return true;
247 246
            }
248 247
            catch (Exception ex)
249 248
            {
250
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
249
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
251 250
                return false;
252 251
            }
253 252
        }
254 253
        #endregion
255 254

  
256
        #region 削除
255
        #region 構成工事種別関連マスタ削除
257 256
        /// <summary>
258
        /// 工事項目マスタ削除
257
        /// 構成工事種別関連マスタ削除
259 258
        /// </summary>
260 259
        /// <param name="AddSQLString">削除条件SQL文字列</param>
261
        /// <param name="data">工事項目マスタデータ</param>
260
        /// <param name="data">構成工事種別関連マスタデータ</param>
262 261
        /// <returns>true:成功 false:失敗</returns>
263 262
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
264 263
        {
265 264
            // インターフェース
266
            string strcmd = "";
265
            StringBuilder strcmd = new StringBuilder();
267 266
            try
268 267
            {
269
                strcmd = string.Format("{0}{1}", "DELETE FROM ComponentToTypeMaster", AddSQLString);
268
                strcmd.AppendFormat("{0}{1}", "DELETE FROM ComponentToTypeMaster", AddSQLString);
270 269

  
271
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
270
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
272 271

  
273 272
                return true;
274 273
            }
275 274
            catch (Exception ex)
276 275
            {
277
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
276
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
278 277
                return false;
279 278
            }
280 279
        }
......
317 316
        /// <returns>Where文字列</returns>
318 317
        public string CreatePrimarykeyString(int ComponentCode, int TypeCode=0)
319 318
        {
320
            string strWork = "";
319
            StringBuilder strWork = new StringBuilder();
321 320
            try
322 321
            {
323
                strWork = string.Format(" Where ComponentCode = {0}", ComponentCode);
322
                strWork.AppendFormat(" Where ComponentCode = {0}", ComponentCode);
324 323
                if (TypeCode != 0)
325
                    strWork += string.Format(" And TypeCode = {0}", TypeCode);
324
                    strWork.AppendFormat(" And TypeCode = {0}", TypeCode);
326 325
            }
327 326
            catch (Exception ex)
328 327
            {
329 328
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
330 329
            }
331 330

  
332
            return strWork;
331
            return strWork.ToString();
333 332
        }
334 333
        #endregion
335 334
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMConstructionItem.cs
56 56

  
57 57
        #endregion
58 58

  
59
        #region 検索処理
59
        #region 工事項目マスタ検索SQL作成
60 60
        /// <summary>
61
        /// 工事項目マスタ検索
61
        /// 工事項目マスタ検索SQL作成
62 62
        /// </summary>
63 63
        /// <param name="AddSQLString">検索条件SQL文字列</param>
64 64
        /// <param name="data">工事項目マスタデータ</param>
......
66 66
        private string CreateSelectSQL()
67 67
        {
68 68
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
69
            string strcmd = "SELECT";
70
            strcmd += "  ItemCode";
71
            strcmd += " ,DisplayOrder";
72
            strcmd += " ,ItemName";
73
            strcmd += " ,SubitemsFlg";
74
            strcmd += " ,MyExpensesFlg";
75
            strcmd += " ,DeleteFlg";
76
            strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
77
            strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
78
            strcmd += " FROM ConstructionItemMaster";
69
            StringBuilder strcmd = new StringBuilder();
70
            strcmd.Append("SELECT");
71
            strcmd.Append("  ItemCode");
72
            strcmd.Append(" ,DisplayOrder");
73
            strcmd.Append(" ,ItemName");
74
            strcmd.Append(" ,SubitemsFlg");
75
            strcmd.Append(" ,MyExpensesFlg");
76
            strcmd.Append(" ,DeleteFlg");
77
            strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
78
            strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
79
            strcmd.Append(" FROM ConstructionItemMaster");
79 80

  
80
            return strcmd;
81
            return strcmd.ToString();
81 82
        }
83
        #endregion
84

  
85
        #region 工事項目マスタ検索(複数)
86
        /// <summary>
87
        /// 工事項目マスタ検索(複数)
88
        /// </summary>
89
        /// <param name="AddSQLString"></param>
90
        /// <param name="data"></param>
91
        /// <param name="bConnect"></param>
92
        /// <returns></returns>
82 93
        public bool SelectAction(string AddSQLString, ref List<ConstructionItemMaster> data, bool bConnect = true)
83 94
        {
84 95
            // インターフェース
85
            string strcmd = "";
96
            StringBuilder strcmd = new StringBuilder();
86 97
            ArrayList arData = new ArrayList();
87 98

  
88 99
            try
89 100
            {
90 101
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
91
                strcmd = CreateSelectSQL() + AddSQLString;
102
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
92 103

  
93 104
                // SQL実行
94
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
105
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
95 106

  
96 107
                // データセット
97 108
                foreach (object[] objwrk in arData)
......
105 116
            }
106 117
            catch (Exception ex)
107 118
            {
108
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
119
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
109 120
                return false;
110 121
            }
111 122

  
112 123
        }
124
        #endregion
125

  
126
        #region 工事項目マスタ検索(1件)
127
        /// <summary>
128
        /// 工事項目マスタ検索(1件)
129
        /// </summary>
130
        /// <param name="AddSQLString"></param>
131
        /// <param name="data"></param>
132
        /// <param name="bConnect"></param>
133
        /// <returns></returns>
113 134
        public bool SelectAction(string AddSQLString, ref ConstructionItemMaster data, bool bConnect = true)
114 135
        {
115 136
            // インターフェース
116
            string strcmd = "";
137
            StringBuilder strcmd = new StringBuilder();
117 138
            ArrayList arData = new ArrayList();
118 139

  
119 140
            try
120 141
            {
121 142
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
122
                strcmd = CreateSelectSQL() + AddSQLString;
143
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
123 144

  
124 145
                // SQL実行
125
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
146
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
126 147
                // データ無
127 148
                if (arData.Count == 0) return false;
128 149

  
......
137 158
            }
138 159
            catch (Exception ex)
139 160
            {
140
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
161
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
141 162
                return false;
142 163
            }
143 164

  
144 165
        }
145 166
        #endregion
146 167

  
147
        #region 追加処理
168
        #region 工事項目マスタ追加(1件)
148 169
        /// <summary>
149
        /// 工事項目マスタ追加
170
        /// 工事項目マスタ追加(1件)
150 171
        /// </summary>
151 172
        /// <param name="data">工事項目マスタデータ</param>
152 173
        /// <returns>true:成功 false:失敗</returns>
153 174
        public bool InsertAction(ConstructionItemMaster work, bool bConnect = true)
154 175
        {
155
            string strcmd = "";
176
            StringBuilder strcmd = new StringBuilder();
156 177
            try
157 178
            {
158 179
                bool bColFirst = true;
159
                strcmd = "INSERT INTO ConstructionItemMaster";
160
                strcmd += " (";
180
                strcmd.Append("INSERT INTO ConstructionItemMaster");
181
                strcmd.Append(" (");
161 182
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
162 183
                {
163
                    if (!bColFirst) strcmd += ", ";
164
                    strcmd += gender.ToString();
184
                    if (!bColFirst) strcmd.Append(", ");
185
                    strcmd.Append(gender.ToString());
165 186
                    bColFirst = false;
166 187
                }
167
                strcmd += ") VALUES (";
188
                strcmd.Append(") VALUES (");
168 189

  
169
                strcmd += string.Format("  {0}", work.ItemCode.ToString());
170
                strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
171
                strcmd += string.Format(", '{0}'", work.ItemName);
172
                strcmd += string.Format(", {0}", work.SubitemsFlg.ToString());
173
                strcmd += string.Format(", {0}", work.MyExpensesFlg.ToString());
174
                strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
190
                strcmd.AppendFormat("  {0}", work.ItemCode.ToString());
191
                strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
192
                strcmd.AppendFormat(", '{0}'", work.ItemName);
193
                strcmd.AppendFormat(", {0}", work.SubitemsFlg.ToString());
194
                strcmd.AppendFormat(", {0}", work.MyExpensesFlg.ToString());
195
                strcmd.AppendFormat(", {0}", work.DeleteFlg.ToString());
175 196

  
176
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
177
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
178
                strcmd += ")";
197
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
198
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
199
                strcmd.Append(")");
179 200

  
180
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
201
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
181 202

  
182 203
                return true;
183 204
            }
184 205
            catch (Exception ex)
185 206
            {
186
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
207
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
187 208
                return false;
188 209
            }
189 210
        }
211
        #endregion
212

  
213
        #region 工事項目マスタ追加(複数)
190 214
        /// <summary>
191
        /// 工事項目マスタ追加
215
        /// 工事項目マスタ追加(複数)
192 216
        /// </summary>
193 217
        /// <param name="data">工事項目マスタデータ</param>
194 218
        /// <returns>true:成功 false:失敗</returns>
195 219
        public bool InsertAction(List<ConstructionItemMaster> data, bool bConnect = true)
196 220
        {
197
            string strcmd = "";
221
            StringBuilder strcmd = new StringBuilder();
198 222
            try
199 223
            {
200 224
                bool bColFirst = true;
201
                strcmd = "INSERT INTO ConstructionItemMaster";
202
                strcmd += " (";
225
                strcmd.Append("INSERT INTO ConstructionItemMaster");
226
                strcmd.Append(" (");
203 227
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
204 228
                {
205
                    if (!bColFirst) strcmd += ", ";
206
                    strcmd += gender.ToString();
229
                    if (!bColFirst) strcmd.Append(", ");
230
                    strcmd.Append(gender.ToString());
207 231
                    bColFirst = false;
208 232
                }
209
                strcmd += ") VALUES";
233
                strcmd.Append(") VALUES");
210 234

  
211 235
                bool bDataFirst = true;
212 236
                foreach (ConstructionItemMaster work in data)
213 237
                {
214
                    if (bDataFirst) strcmd += " (";
215
                    else strcmd += ", (";
238
                    if (bDataFirst) strcmd.Append(" (");
239
                    else strcmd.Append(", (");
216 240

  
217
                    strcmd += string.Format("  {0}", work.ItemCode.ToString());
218
                    strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
219
                    strcmd += string.Format(", '{0}'", work.ItemName);
220
                    strcmd += string.Format(", {0}", work.SubitemsFlg.ToString());
221
                    strcmd += string.Format(", {0}", work.MyExpensesFlg.ToString());
222
                    strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
241
                    strcmd.AppendFormat("  {0}", work.ItemCode.ToString());
242
                    strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
243
                    strcmd.AppendFormat(", '{0}'", work.ItemName);
244
                    strcmd.AppendFormat(", {0}", work.SubitemsFlg.ToString());
245
                    strcmd.AppendFormat(", {0}", work.MyExpensesFlg.ToString());
246
                    strcmd.AppendFormat(", {0}", work.DeleteFlg.ToString());
223 247

  
224
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
225
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
226
                    strcmd += ")";
248
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
249
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
250
                    strcmd.Append(")");
227 251

  
228 252
                    bDataFirst = false;
229 253
                }
230 254

  
231
                if (!ExecuteNonQuery(strcmd, false)) return false;
255
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
232 256

  
233 257
                return true;
234 258
            }
235 259
            catch (Exception ex)
236 260
            {
237
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
261
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
238 262
                return false;
239 263
            }
240 264
        }
241 265
        #endregion
242 266

  
243
        #region 更新処理
267
        #region 工事項目マスタ更新
244 268
        /// <summary>
245 269
        /// 工事項目マスタ更新
246 270
        /// </summary>
......
249 273
        /// <returns>true:成功 false:失敗</returns>
250 274
        public bool UpdateAction(string AddSQLString, ConstructionItemMaster data, bool bConnect = true)
251 275
        {
252
            string strcmd = "";
276
            StringBuilder strcmd = new StringBuilder();
253 277
            try
254 278
            {
255 279

  
256
                strcmd = "UPDATE ConstructionItemMaster";
280
                strcmd.Append("UPDATE ConstructionItemMaster");
257 281

  
258
                strcmd += " SET";
282
                strcmd.Append(" SET");
259 283

  
260
                strcmd += string.Format(" ItemCode = {0}", data.ItemCode.ToString());
261
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
262
                strcmd += string.Format(",ItemName = '{0}'", data.ItemName);
263
                strcmd += string.Format(",SubitemsFlg = {0}", data.SubitemsFlg.ToString());
264
                strcmd += string.Format(",MyExpensesFlg = {0}", data.MyExpensesFlg.ToString());
265
                strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg.ToString());
284
                strcmd.AppendFormat(" ItemCode = {0}", data.ItemCode.ToString());
285
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
286
                strcmd.AppendFormat(",ItemName = '{0}'", data.ItemName);
287
                strcmd.AppendFormat(",SubitemsFlg = {0}", data.SubitemsFlg.ToString());
288
                strcmd.AppendFormat(",MyExpensesFlg = {0}", data.MyExpensesFlg.ToString());
289
                strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg.ToString());
266 290

  
267
                strcmd += ", UpdateDate = NOW()";
268
                strcmd += AddSQLString;
291
                strcmd.Append(", UpdateDate = NOW()");
292
                strcmd.Append(AddSQLString);
269 293

  
270
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
294
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
271 295

  
272 296
                return true;
273 297
            }
274 298
            catch (Exception ex)
275 299
            {
276
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
300
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
277 301
                return false;
278 302
            }
279 303
        }
......
289 313
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
290 314
        {
291 315
            // インターフェース
292
            string strcmd = "";
316
            StringBuilder strcmd = new StringBuilder();
293 317
            try
294 318
            {
295
                strcmd = string.Format("{0}{1}", "DELETE FROM ConstructionItemMaster", AddSQLString);
319
                strcmd.AppendFormat("{0}{1}", "DELETE FROM ConstructionItemMaster", AddSQLString);
296 320

  
297
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
321
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
298 322

  
299 323
                return true;
300 324
            }
301 325
            catch (Exception ex)
302 326
            {
303
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
327
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
304 328
                return false;
305 329
            }
306 330
        }
331
        #endregion
307 332

  
333
        #region 論理削除
308 334
        /// <summary>
309 335
        /// 論理削除
310 336
        /// </summary>
......
376 402

  
377 403
        #endregion
378 404

  
379
        #region パブリックメソッド(特殊処理)
380

  
405
        #region 最大値を取得する
381 406
        /// <summary>
382 407
        /// 最大値を取得する
383 408
        /// </summary>
......
387 412
        public int SelectMaxItemCodeCount(string AddSQLString, bool bConnect = true)
388 413
        {
389 414
            // インターフェース
390
            string strcmd = "";
415
            StringBuilder strcmd = new StringBuilder();
391 416
            ArrayList arData = new ArrayList();
392 417
            int iRet = 0;
393 418
            try
394 419
            {
395 420
                // SQL作成
396
                strcmd = "SELECT IFNULL(MAX(ItemCode), 0) FROM ConstructionItemMaster" + AddSQLString;
421
                strcmd.AppendFormat("SELECT IFNULL(MAX(ItemCode), 0) FROM ConstructionItemMaster{0}", AddSQLString);
397 422

  
398 423
                // SQL実行
399
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet;
424
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
400 425

  
401 426
                // データセット
402 427
                foreach (object[] objwrk in arData)
......
409 434
            }
410 435
            catch (Exception ex)
411 436
            {
412
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
437
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
413 438
            }
414 439

  
415 440
            return iRet;
416 441
        }
442
        #endregion
417 443

  
444
        #region 主キー検索の文字列を返す
418 445
        /// <summary>
419 446
        /// 主キー検索の文字列を返す
420 447
        /// </summary>
......
422 449
        /// <returns>Where文字列</returns>
423 450
        public string CreatePrimarykeyString(int ItemCode = 0)
424 451
        {
425
            string strWork = "";
452
            StringBuilder strWork = new StringBuilder();
426 453
            try
427 454
            {
428
                strWork = string.Format(" Where ItemCode = {0}", ItemCode);
455
                strWork.AppendFormat(" Where ItemCode = {0}", ItemCode);
429 456
            }
430 457
            catch (Exception ex)
431 458
            {
432
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
459
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
433 460
            }
434 461

  
435
            return strWork;
462
            return strWork.ToString();
436 463
        }
437 464
        #endregion
438 465
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMConstructionSpec.cs
58 58

  
59 59
        #endregion
60 60

  
61
        #region パブリックメソッド
61
        #region 施工工種マスタ検索SQL作成
62
        /// <summary>
63
        /// 施工工種マスタ検索SQL作成
64
        /// </summary>
65
        /// <returns></returns>
62 66
        private string CreateSelectSQL()
63 67
        {
64 68
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
65
            string strcmd = "SELECT";
69
            StringBuilder strcmd = new StringBuilder();
66 70

  
67
            strcmd += "  ItemCode";
68
            strcmd += ", SpecCode";
69
            strcmd += ", DisplayOrder";
70
            strcmd += ", ItemName";
71
            strcmd += ", SpecName";
72
            strcmd += ", UnitName";
73
            strcmd += ", UnitPrice";
74
            strcmd += ", DeleteFlg";
71
            strcmd.Append("SELECT");
72
            strcmd .Append("  ItemCode");
73
            strcmd .Append(", SpecCode");
74
            strcmd .Append(", DisplayOrder");
75
            strcmd .Append(", ItemName");
76
            strcmd .Append(", SpecName");
77
            strcmd .Append(", UnitName");
78
            strcmd .Append(", UnitPrice");
79
            strcmd .Append(", DeleteFlg");
75 80

  
76
            strcmd += ", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
77
            strcmd += ", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
78
            strcmd += " FROM ConstructionSpecMaster";
81
            strcmd .Append(", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
82
            strcmd .Append(", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
83
            strcmd .Append(" FROM ConstructionSpecMaster");
79 84

  
80
            return strcmd;
85
            return strcmd.ToString();
81 86
        }
87
        #endregion
88

  
89
        #region 施工工種マスタ検索(複数)
82 90
        /// <summary>
83
        /// 施工工種マスタ検索
91
        /// 施工工種マスタ検索(複数)
84 92
        /// </summary>
85 93
        /// <param name="AddSQLString">検索条件SQL文字列</param>
86 94
        /// <param name="data">施工工種マスタデータ</param>
......
88 96
        public bool SelectAction(string AddSQLString, ref List<ConstructionSpecMaster> data, bool bConnect = true)
89 97
        {
90 98
            // インターフェース
91
            string strcmd = "";
99
            StringBuilder strcmd = new StringBuilder();
92 100
            ArrayList arData = new ArrayList();
93 101

  
94 102
            try
95 103
            {
96
                strcmd = CreateSelectSQL() + AddSQLString;
104
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
97 105

  
98 106
                // SQL実行
99
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
107
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
100 108

  
101 109
                // データセット
102 110
                foreach (object[] objwrk in arData)
......
110 118
            }
111 119
            catch (Exception ex)
112 120
            {
113
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
121
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
114 122
                return false;
115 123
            }
116 124
        }
125
        #endregion
126

  
127
        #region 施工工種マスタ検索(1件)
128
        /// <summary>
129
        /// 施工工種マスタ検索(1件)
130
        /// </summary>
131
        /// <param name="AddSQLString">検索条件SQL文字列</param>
132
        /// <param name="data">施工工種マスタデータ</param>
133
        /// <returns>true:成功 false:失敗</returns>
117 134
        public bool SelectAction(string AddSQLString, ref ConstructionSpecMaster data, bool bConnect = true)
118 135
        {
119 136
            // インターフェース
120
            string strcmd = "";
137
            StringBuilder strcmd = new StringBuilder();
121 138
            ArrayList arData = new ArrayList();
122 139

  
123 140
            try
124 141
            {
125 142
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
126
                strcmd = CreateSelectSQL() + AddSQLString;
143
                strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
127 144

  
128 145
                // SQL実行
129
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
146
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
130 147
                // データ無
131 148
                if (arData.Count == 0) return false;
132 149

  
......
141 158
            }
142 159
            catch (Exception ex)
143 160
            {
144
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
161
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
145 162
                return false;
146 163
            }
147 164

  
148 165
        }
166
        #endregion
149 167

  
168
        #region 施工工種マスタ追加(1件)
150 169
        /// <summary>
151
        /// 施工工種マスタ追加
170
        /// 施工工種マスタ追加(1件)
152 171
        /// </summary>
153 172
        /// <param name="data">施工工種マスタデータ</param>
154 173
        /// <returns>true:成功 false:失敗</returns>
155 174
        public bool InsertAction(ConstructionSpecMaster work, bool bConnect = true)
156 175
        {
157
            string strcmd = "";
176
            StringBuilder strcmd = new StringBuilder();
158 177
            try
159 178
            {
160 179
                bool bColFirst = true;
161
                strcmd = "INSERT INTO ConstructionSpecMaster";
162
                strcmd += " (";
180
                strcmd.Append("INSERT INTO ConstructionSpecMaster");
181
                strcmd .Append(" (");
163 182
                foreach (var gender in Enum.GetValues(typeof(TableColumn)))
164 183
                {
165
                    if (!bColFirst) strcmd += ", ";
166
                    strcmd += gender.ToString();
184
                    if (!bColFirst) strcmd .Append(", ");
185
                    strcmd .Append(gender.ToString());
167 186
                    bColFirst = false;
168 187
                }
169
                strcmd += ") VALUES (";
188
                strcmd .Append(") VALUES (");
170 189

  
171
                strcmd += string.Format(" {0}", work.ItemCode);
172
                strcmd += string.Format(",{0}", work.SpecCode);
173
                strcmd += string.Format(",{0}", work.DisplayOrder);
190
                strcmd.AppendFormat(" {0}", work.ItemCode);
191
                strcmd.AppendFormat(",{0}", work.SpecCode);
192
                strcmd.AppendFormat(",{0}", work.DisplayOrder);
174 193

  
175
                strcmd += string.Format(",'{0}'", work.ItemName);
176
                strcmd += string.Format(",'{0}'", work.SpecName);
177
                strcmd += string.Format(",'{0}'", work.UnitName);
178
                strcmd += string.Format(",{0}", work.UnitPrice);
179
                strcmd += string.Format(",{0}", work.DeleteFlg);
194
                strcmd.AppendFormat(",'{0}'", work.ItemName);
195
                strcmd.AppendFormat(",'{0}'", work.SpecName);
196
                strcmd.AppendFormat(",'{0}'", work.UnitName);
197
                strcmd.AppendFormat(",{0}", work.UnitPrice);
198
                strcmd.AppendFormat(",{0}", work.DeleteFlg);
180 199

  
181
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
182
                strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
183
                strcmd += ")";
200
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
201
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
202
                strcmd .Append(")");
184 203

  
185
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
204
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
186 205

  
187 206
                return true;
188 207
            }
189 208
            catch (Exception ex)
190 209
            {
191
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
210
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
192 211
                return false;
193 212
            }
194 213
        }
214
        #endregion
195 215

  
216
        #region 施工工種マスタ追加(複数)
196 217
        /// <summary>
197
        /// 施工工種マスタ追加
218
        /// 施工工種マスタ追加(複数)
198 219
        /// </summary>
199 220
        /// <param name="data">施工工種マスタデータ</param>
200 221
        /// <returns>true:成功 false:失敗</returns>
201 222
        public bool InsertAction(List<ConstructionSpecMaster> data, bool bConnect = true)
202 223
        {
203
            string strcmd = "";
224
            StringBuilder strcmd = new StringBuilder();
204 225
            try
205 226
            {
206 227
                bool bColFirst = true;
207
                strcmd = "INSERT INTO ConstructionSpecMaster";
208
                strcmd += " (";
228
                strcmd.Append("INSERT INTO ConstructionSpecMaster");
229
                strcmd .Append(" (");
209 230
                foreach (var gender in Enum.GetValues(typeof(TableColumn)))
210 231
                {
211
                    if (!bColFirst) strcmd += ", ";
212
                    strcmd += gender.ToString();
232
                    if (!bColFirst) strcmd .Append(", ");
233
                    strcmd .Append(gender.ToString());
213 234
                    bColFirst = false;
214 235
                }
215
                strcmd += ") VALUES";
236
                strcmd .Append(") VALUES");
216 237

  
217 238
                bool bDataFirst = true;
218 239
                foreach (ConstructionSpecMaster work in data)
219 240
                {
220
                    if (bDataFirst) strcmd += " (";
221
                    else strcmd += ", (";
241
                    if (bDataFirst) strcmd .Append(" (");
242
                    else strcmd .Append(", (");
222 243

  
223
                    strcmd += string.Format(" {0}", work.ItemCode);
224
                    strcmd += string.Format(",{0}", work.SpecCode);
225
                    strcmd += string.Format(",{0}", work.DisplayOrder);
244
                    strcmd.AppendFormat(" {0}", work.ItemCode);
245
                    strcmd.AppendFormat(",{0}", work.SpecCode);
246
                    strcmd.AppendFormat(",{0}", work.DisplayOrder);
226 247

  
227
                    strcmd += string.Format(",'{0}'", work.ItemName);
228
                    strcmd += string.Format(",'{0}'", work.SpecName);
229
                    strcmd += string.Format(",'{0}'", work.UnitName);
230
                    strcmd += string.Format(",{0}", work.UnitPrice);
231
                    strcmd += string.Format(",{0}", work.DeleteFlg);
248
                    strcmd.AppendFormat(",'{0}'", work.ItemName);
249
                    strcmd.AppendFormat(",'{0}'", work.SpecName);
250
                    strcmd.AppendFormat(",'{0}'", work.UnitName);
251
                    strcmd.AppendFormat(",{0}", work.UnitPrice);
252
                    strcmd.AppendFormat(",{0}", work.DeleteFlg);
232 253

  
233
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
234
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
235
                    strcmd += ")";
254
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
255
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
256
                    strcmd .Append(")");
236 257

  
237 258
                    bDataFirst = false;
238 259
                }
239 260

  
240
                if (!ExecuteNonQuery(strcmd, false)) return false;
261
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
241 262

  
242 263
                return true;
243 264
            }
244 265
            catch (Exception ex)
245 266
            {
246
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
267
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
247 268
                return false;
248 269
            }
249 270
        }
271
        #endregion
250 272

  
273
        #region 施工工種マスタ更新
251 274
        /// <summary>
252 275
        /// 施工工種マスタ更新
253 276
        /// </summary>
......
256 279
        /// <returns>true:成功 false:失敗</returns>
257 280
        public bool UpdateAction(string AddSQLString, ConstructionSpecMaster data, bool bConnect = true)
258 281
        {
259
            string strcmd = "";
282
            StringBuilder strcmd = new StringBuilder();
260 283
            try
261 284
            {
262 285

  
263
                strcmd = "UPDATE ConstructionSpecMaster";
286
                strcmd.Append("UPDATE ConstructionSpecMaster");
264 287

  
265
                strcmd += " SET";
288
                strcmd .Append(" SET");
266 289

  
267
                strcmd += string.Format(" ItemCode = {0}", data.ItemCode);
268
                strcmd += string.Format(",SpecCode = {0}", data.SpecCode);
269
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder);
290
                strcmd.AppendFormat(" ItemCode = {0}", data.ItemCode);
291
                strcmd.AppendFormat(",SpecCode = {0}", data.SpecCode);
292
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder);
270 293

  
271
                strcmd += string.Format(",ItemName = '{0}'", data.ItemName);
272
                strcmd += string.Format(",SpecName = '{0}'", data.SpecName);
273
                strcmd += string.Format(",UnitName = '{0}'", data.UnitName);
274
                strcmd += string.Format(",UnitPrice = {0}", data.UnitPrice);
275
                strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg);
294
                strcmd.AppendFormat(",ItemName = '{0}'", data.ItemName);
295
                strcmd.AppendFormat(",SpecName = '{0}'", data.SpecName);
296
                strcmd.AppendFormat(",UnitName = '{0}'", data.UnitName);
297
                strcmd.AppendFormat(",UnitPrice = {0}", data.UnitPrice);
298
                strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg);
276 299

  
277
                strcmd += ", UpdateDate = NOW()";
278
                strcmd += AddSQLString;
300
                strcmd .Append(", UpdateDate = NOW()");
301
                strcmd .Append(AddSQLString);
279 302

  
280
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
303
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
281 304

  
282 305
                return true;
283 306
            }
284 307
            catch (Exception ex)
285 308
            {
286
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
309
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
287 310
                return false;
288 311
            }
289 312
        }
313
        #endregion
290 314

  
291

  
315
        #region 施工工種マスタ削除
292 316
        /// <summary>
293 317
        /// 施工工種マスタ削除
294 318
        /// </summary>
......
298 322
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
299 323
        {
300 324
            // インターフェース
301
            string strcmd = "";
325
            StringBuilder strcmd = new StringBuilder();
302 326
            try
303 327
            {
304
                strcmd = string.Format("{0}{1}", "DELETE FROM ConstructionSpecMaster", AddSQLString);
328
                strcmd.AppendFormat("{0}{1}", "DELETE FROM ConstructionSpecMaster", AddSQLString);
305 329

  
306
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
330
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
307 331

  
308 332
                return true;
309 333
            }
310 334
            catch (Exception ex)
311 335
            {
312
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
336
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
313 337
                return false;
314 338
            }
315 339
        }
340
        #endregion
316 341

  
342
        #region 論理削除
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

他の形式にエクスポート: Unified diff