リビジョン 220
StringBuilder化追加
プロセス制御パラメータクラス(ProcessParameter)ArrayList追加
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMConstructionSpecUnitPrice.cs | ||
---|---|---|
61 | 61 |
/// </summary> |
62 | 62 |
private string CreateSelectSQL() |
63 | 63 |
{ |
64 |
string strcmd = "SELECT"; |
|
64 |
StringBuilder strcmd = new StringBuilder(); |
|
65 |
strcmd.Append("SELECT"); |
|
66 |
strcmd.Append(" ComponentCode"); |
|
67 |
strcmd.Append(", ItemCode"); |
|
68 |
strcmd.Append(", SpecCode"); |
|
69 |
strcmd.Append(", ConstructionTypeCode"); |
|
70 |
strcmd.Append(", UnitPrice"); |
|
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 ConstructionSpecUnitPrice"); |
|
65 | 74 |
|
66 |
strcmd += " ComponentCode"; |
|
67 |
strcmd += ", ItemCode"; |
|
68 |
strcmd += ", SpecCode"; |
|
69 |
strcmd += ", ConstructionTypeCode"; |
|
70 |
strcmd += ", UnitPrice"; |
|
71 |
strcmd += ", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')"; |
|
72 |
strcmd += ", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')"; |
|
73 |
strcmd += " FROM ConstructionSpecUnitPrice"; |
|
74 |
|
|
75 |
return strcmd; |
|
75 |
return strcmd.ToString(); |
|
76 | 76 |
} |
77 | 77 |
#endregion |
78 | 78 |
|
79 |
#region 検索処理
|
|
79 |
#region 作業単価マスタ検索(1件)
|
|
80 | 80 |
/// <summary> |
81 |
/// 作業単価マスタ検索 |
|
81 |
/// 作業単価マスタ検索(1件)
|
|
82 | 82 |
/// </summary> |
83 | 83 |
/// <param name="AddSQLString">検索条件SQL文字列</param> |
84 | 84 |
/// <param name="data">作業単価マスタデータ</param> |
... | ... | |
86 | 86 |
public bool SelectAction(string AddSQLString, ref ConstructionSpecUnitPrice data, bool bConnect = true) |
87 | 87 |
{ |
88 | 88 |
// インターフェース |
89 |
string strcmd = "";
|
|
89 |
StringBuilder strcmd = new StringBuilder();
|
|
90 | 90 |
ArrayList arData = new ArrayList(); |
91 | 91 |
|
92 | 92 |
try |
93 | 93 |
{ |
94 | 94 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
95 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
95 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
96 | 96 |
|
97 | 97 |
// SQL実行 |
98 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
98 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
99 | 99 |
if (arData.Count == 0) return false; |
100 | 100 |
|
101 | 101 |
// データセット |
... | ... | |
109 | 109 |
} |
110 | 110 |
catch (Exception ex) |
111 | 111 |
{ |
112 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
112 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
113 | 113 |
return false; |
114 | 114 |
} |
115 | 115 |
} |
116 |
#endregion |
|
116 | 117 |
|
118 |
#region 作業単価マスタ検索(複数) |
|
117 | 119 |
/// <summary> |
118 |
/// 作業単価マスタ検索 |
|
120 |
/// 作業単価マスタ検索(複数)
|
|
119 | 121 |
/// </summary> |
120 | 122 |
/// <param name="AddSQLString">検索条件SQL文字列</param> |
121 | 123 |
/// <param name="data">作業単価マスタデータ</param> |
... | ... | |
123 | 125 |
public bool SelectAction(string AddSQLString, ref List<ConstructionSpecUnitPrice> data, bool bConnect = true) |
124 | 126 |
{ |
125 | 127 |
// インターフェース |
126 |
string strcmd = "";
|
|
128 |
StringBuilder strcmd = new StringBuilder();
|
|
127 | 129 |
ArrayList arData = new ArrayList(); |
128 | 130 |
|
129 | 131 |
try |
130 | 132 |
{ |
131 | 133 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
132 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
134 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
133 | 135 |
|
134 | 136 |
// SQL実行 |
135 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
137 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
136 | 138 |
|
137 | 139 |
// データセット |
138 | 140 |
foreach (object[] objwrk in arData) |
... | ... | |
146 | 148 |
} |
147 | 149 |
catch (Exception ex) |
148 | 150 |
{ |
149 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
151 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
150 | 152 |
return false; |
151 | 153 |
} |
152 | 154 |
} |
153 | 155 |
#endregion |
154 | 156 |
|
155 |
#region 追加処理
|
|
157 |
#region 作業単価マスタ追加(1件)
|
|
156 | 158 |
/// <summary> |
157 |
/// 作業単価マスタ追加 |
|
159 |
/// 作業単価マスタ追加(1件)
|
|
158 | 160 |
/// </summary> |
159 | 161 |
/// <param name="data">作業単価マスタデータ</param> |
160 | 162 |
/// <returns>true:成功 false:失敗</returns> |
161 | 163 |
public bool InsertAction(ConstructionSpecUnitPrice data, bool bConnect = true) |
162 | 164 |
{ |
163 |
string strcmd = "";
|
|
165 |
StringBuilder strcmd = new StringBuilder();
|
|
164 | 166 |
try |
165 | 167 |
{ |
166 | 168 |
|
167 | 169 |
bool bColFirst = true; |
168 |
strcmd = "INSERT INTO ConstructionSpecUnitPrice";
|
|
169 |
strcmd += " (";
|
|
170 |
strcmd.Append("INSERT INTO ConstructionSpecUnitPrice");
|
|
171 |
strcmd.Append(" (");
|
|
170 | 172 |
foreach (var gender in Enum.GetValues(typeof(TableColumn))) |
171 | 173 |
{ |
172 |
if (!bColFirst) strcmd += ", ";
|
|
173 |
strcmd += gender.ToString();
|
|
174 |
if (!bColFirst) strcmd.Append(", ");
|
|
175 |
strcmd.Append(gender.ToString());
|
|
174 | 176 |
bColFirst = false; |
175 | 177 |
} |
176 |
strcmd += ") VALUES (";
|
|
178 |
strcmd.Append(") VALUES (");
|
|
177 | 179 |
|
178 |
strcmd += string.Format(" {0}", data.ComponentCode);
|
|
179 |
strcmd += string.Format(",{0}", data.ItemCode);
|
|
180 |
strcmd += string.Format(",{0}", data.SpecCode);
|
|
181 |
strcmd += string.Format(",{0}", data.TypeCode);
|
|
180 |
strcmd.AppendFormat(" {0}", data.ComponentCode);
|
|
181 |
strcmd.AppendFormat(",{0}", data.ItemCode);
|
|
182 |
strcmd.AppendFormat(",{0}", data.SpecCode);
|
|
183 |
strcmd.AppendFormat(",{0}", data.TypeCode);
|
|
182 | 184 |
|
183 |
strcmd += string.Format(",{0}", data.UnitPrice);
|
|
185 |
strcmd.AppendFormat(",{0}", data.UnitPrice);
|
|
184 | 186 |
|
185 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.EntryDate);
|
|
186 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.UpdateDate);
|
|
187 |
strcmd += ")";
|
|
187 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.EntryDate);
|
|
188 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.UpdateDate);
|
|
189 |
strcmd.Append(")");
|
|
188 | 190 |
|
189 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
191 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
190 | 192 |
|
191 | 193 |
return true; |
192 | 194 |
} |
193 | 195 |
catch (Exception ex) |
194 | 196 |
{ |
195 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
197 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
196 | 198 |
return false; |
197 | 199 |
} |
198 | 200 |
} |
201 |
#endregion |
|
202 |
|
|
203 |
#region 作業単価マスタ追加(複数) |
|
204 |
/// <summary> |
|
205 |
/// 作業単価マスタ追加(複数) |
|
206 |
/// </summary> |
|
207 |
/// <param name="data"></param> |
|
208 |
/// <param name="bConnect"></param> |
|
209 |
/// <returns></returns> |
|
199 | 210 |
public bool InsertAction(List<ConstructionSpecUnitPrice> data, bool bConnect = true) |
200 | 211 |
{ |
201 |
string strcmd = "";
|
|
212 |
StringBuilder strcmd = new StringBuilder();
|
|
202 | 213 |
try |
203 | 214 |
{ |
204 | 215 |
bool bColFirst = true; |
205 |
strcmd = "INSERT INTO ConstructionSpecUnitPrice";
|
|
206 |
strcmd += " (";
|
|
216 |
strcmd.Append("INSERT INTO ConstructionSpecUnitPrice");
|
|
217 |
strcmd.Append(" (");
|
|
207 | 218 |
foreach (var gender in Enum.GetValues(typeof(TableColumn))) |
208 | 219 |
{ |
209 |
if (!bColFirst) strcmd += ", ";
|
|
210 |
strcmd += gender.ToString();
|
|
220 |
if (!bColFirst) strcmd.Append(", ");
|
|
221 |
strcmd.Append(gender.ToString());
|
|
211 | 222 |
bColFirst = false; |
212 | 223 |
} |
213 |
strcmd += ") VALUES";
|
|
224 |
strcmd.Append(") VALUES");
|
|
214 | 225 |
|
215 | 226 |
bool bDataFirst = true; |
216 | 227 |
foreach (ConstructionSpecUnitPrice work in data) |
217 | 228 |
{ |
218 |
if (bDataFirst) strcmd += " (";
|
|
219 |
else strcmd += ", (";
|
|
229 |
if (bDataFirst) strcmd.Append(" (");
|
|
230 |
else strcmd.Append(", (");
|
|
220 | 231 |
|
221 |
strcmd += string.Format(" {0}", work.ComponentCode);
|
|
222 |
strcmd += string.Format(",{0}", work.ItemCode);
|
|
223 |
strcmd += string.Format(",{0}", work.SpecCode);
|
|
224 |
strcmd += string.Format(",{0}", work.TypeCode);
|
|
225 |
strcmd += string.Format(",{0}", work.UnitPrice);
|
|
232 |
strcmd.AppendFormat(" {0}", work.ComponentCode);
|
|
233 |
strcmd.AppendFormat(",{0}", work.ItemCode);
|
|
234 |
strcmd.AppendFormat(",{0}", work.SpecCode);
|
|
235 |
strcmd.AppendFormat(",{0}", work.TypeCode);
|
|
236 |
strcmd.AppendFormat(",{0}", work.UnitPrice);
|
|
226 | 237 |
|
227 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
228 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
229 |
strcmd += ")";
|
|
238 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
239 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
240 |
strcmd.Append(")");
|
|
230 | 241 |
|
231 | 242 |
bDataFirst = false; |
232 | 243 |
} |
233 | 244 |
|
234 |
if (!ExecuteNonQuery(strcmd, false)) return false; |
|
245 |
if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
|
|
235 | 246 |
|
236 | 247 |
return true; |
237 | 248 |
} |
238 | 249 |
catch (Exception ex) |
239 | 250 |
{ |
240 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
251 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
241 | 252 |
return false; |
242 | 253 |
} |
243 | 254 |
} |
244 | 255 |
#endregion |
245 | 256 |
|
246 |
#region 更新処理
|
|
257 |
#region 作業単価マスタ更新
|
|
247 | 258 |
/// <summary> |
248 | 259 |
/// 作業単価マスタ更新 |
249 | 260 |
/// </summary> |
... | ... | |
252 | 263 |
/// <returns>true:成功 false:失敗</returns> |
253 | 264 |
public bool UpdateAction(string AddSQLString, ConstructionSpecUnitPrice data, bool bConnect = true) |
254 | 265 |
{ |
255 |
string strcmd = "";
|
|
266 |
StringBuilder strcmd = new StringBuilder();
|
|
256 | 267 |
try |
257 | 268 |
{ |
258 | 269 |
|
259 |
strcmd = "UPDATE ConstructionSpecUnitPrice";
|
|
270 |
strcmd.Append("UPDATE ConstructionSpecUnitPrice");
|
|
260 | 271 |
|
261 |
strcmd += " SET";
|
|
272 |
strcmd.Append(" SET");
|
|
262 | 273 |
|
263 |
strcmd += string.Format(" ComponentCode = {0}", data.ComponentCode);
|
|
264 |
strcmd += string.Format(",ItemCode = {0}", data.ItemCode);
|
|
265 |
strcmd += string.Format(",SpecCode = {0}", data.SpecCode);
|
|
266 |
strcmd += string.Format(",ConstructionTypeCode = {0}", data.TypeCode);
|
|
274 |
strcmd.AppendFormat(" ComponentCode = {0}", data.ComponentCode);
|
|
275 |
strcmd.AppendFormat(",ItemCode = {0}", data.ItemCode);
|
|
276 |
strcmd.AppendFormat(",SpecCode = {0}", data.SpecCode);
|
|
277 |
strcmd.AppendFormat(",ConstructionTypeCode = {0}", data.TypeCode);
|
|
267 | 278 |
|
268 |
strcmd += string.Format(",UnitPrice = {0}", data.UnitPrice);
|
|
279 |
strcmd.AppendFormat(",UnitPrice = {0}", data.UnitPrice);
|
|
269 | 280 |
|
270 |
strcmd += ", UpdateDate = NOW()";
|
|
271 |
strcmd += AddSQLString;
|
|
281 |
strcmd.Append(", UpdateDate = NOW()");
|
|
282 |
strcmd.Append(AddSQLString);
|
|
272 | 283 |
|
273 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
284 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
274 | 285 |
|
275 | 286 |
return true; |
276 | 287 |
} |
277 | 288 |
catch (Exception ex) |
278 | 289 |
{ |
279 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
290 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
280 | 291 |
return false; |
281 | 292 |
} |
282 | 293 |
} |
283 | 294 |
#endregion |
284 | 295 |
|
285 |
#region 削除処理
|
|
296 |
#region 作業単価マスタ削除
|
|
286 | 297 |
/// <summary> |
287 | 298 |
/// 作業単価マスタ削除 |
288 | 299 |
/// </summary> |
... | ... | |
292 | 303 |
public bool DeleteAction(string AddSQLString, bool bConnect = true) |
293 | 304 |
{ |
294 | 305 |
// インターフェース |
295 |
string strcmd = "";
|
|
306 |
StringBuilder strcmd = new StringBuilder();
|
|
296 | 307 |
try |
297 | 308 |
{ |
298 |
strcmd = string.Format("{0}{1}", "DELETE FROM ConstructionSpecUnitPrice", AddSQLString);
|
|
309 |
strcmd.AppendFormat("{0}{1}", "DELETE FROM ConstructionSpecUnitPrice", AddSQLString);
|
|
299 | 310 |
|
300 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
311 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
301 | 312 |
|
302 | 313 |
return true; |
303 | 314 |
} |
304 | 315 |
catch (Exception ex) |
305 | 316 |
{ |
306 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
317 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
307 | 318 |
return false; |
308 | 319 |
} |
309 | 320 |
} |
... | ... | |
343 | 354 |
|
344 | 355 |
#endregion |
345 | 356 |
|
346 |
#region パブリックメソッド(特殊処理)
|
|
357 |
#region 最大値を取得する
|
|
347 | 358 |
/// <summary> |
348 | 359 |
/// 最大値を取得する |
349 | 360 |
/// </summary> |
... | ... | |
353 | 364 |
public int GetMaxWorkCodeCount(string AddSQLString, bool bConnect = true) |
354 | 365 |
{ |
355 | 366 |
// インターフェース |
356 |
string strcmd = "";
|
|
367 |
StringBuilder strcmd = new StringBuilder();
|
|
357 | 368 |
ArrayList arData = new ArrayList(); |
358 | 369 |
int iRet = 0; |
359 | 370 |
try |
360 | 371 |
{ |
361 | 372 |
// SQL作成 |
362 |
strcmd = "SELECT IFNULL(MAX(SpecCode), 0) FROM ConstructionSpecUnitPrice" + AddSQLString;
|
|
373 |
strcmd.AppendFormat("SELECT IFNULL(MAX(SpecCode), 0) FROM ConstructionSpecUnitPrice{0}", AddSQLString);
|
|
363 | 374 |
|
364 | 375 |
// SQL実行 |
365 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet; |
|
376 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
|
|
366 | 377 |
|
367 | 378 |
// データセット |
368 | 379 |
foreach (object[] objwrk in arData) |
... | ... | |
375 | 386 |
} |
376 | 387 |
catch (Exception ex) |
377 | 388 |
{ |
378 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
389 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
379 | 390 |
} |
380 | 391 |
|
381 | 392 |
return iRet; |
382 | 393 |
} |
394 |
#endregion |
|
383 | 395 |
|
396 |
#region 主キー検索の文字列を返す |
|
384 | 397 |
/// <summary> |
385 | 398 |
/// 主キー検索の文字列を返す |
386 | 399 |
/// </summary> |
... | ... | |
389 | 402 |
/// <returns>Where文字列</returns> |
390 | 403 |
public string CreatePrimarykeyString(int ComponentCode, int ItemCode, int SpecCode, int ConstructionTypeCode = 0) |
391 | 404 |
{ |
392 |
string strWork = "";
|
|
405 |
StringBuilder strWork = new StringBuilder();
|
|
393 | 406 |
try |
394 | 407 |
{ |
395 |
strWork = string.Format(" Where ComponentCode = {0} And ItemCode = {1} And SpecCode = {2}", ComponentCode, ItemCode, SpecCode);
|
|
396 |
if (ConstructionTypeCode != 0) strWork += string.Format(" And ConstructionTypeCode = {0}", ConstructionTypeCode);
|
|
408 |
strWork.AppendFormat(" Where ComponentCode = {0} And ItemCode = {1} And SpecCode = {2}", ComponentCode, ItemCode, SpecCode);
|
|
409 |
if (ConstructionTypeCode != 0) strWork.AppendFormat(" And ConstructionTypeCode = {0}", ConstructionTypeCode);
|
|
397 | 410 |
|
398 | 411 |
} |
399 | 412 |
catch (Exception ex) |
400 | 413 |
{ |
401 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork); |
|
414 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
|
|
402 | 415 |
} |
403 | 416 |
|
404 |
return strWork; |
|
417 |
return strWork.ToString();
|
|
405 | 418 |
} |
406 | 419 |
#endregion |
407 | 420 |
} |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMConstructionTypeMaster.cs | ||
---|---|---|
66 | 66 |
/// <returns>true:成功 false:失敗</returns> |
67 | 67 |
private string CreateSelectSQL() |
68 | 68 |
{ |
69 |
string strcmd = "SELECT";
|
|
69 |
StringBuilder strcmd = new StringBuilder();
|
|
70 | 70 |
|
71 |
strcmd += " TypeCode"; |
|
72 |
strcmd += ",DisplayOrder"; |
|
73 |
strcmd += ",NameString"; |
|
74 |
strcmd += ",PublicFlg"; |
|
75 |
strcmd += ",SecRank"; |
|
76 |
strcmd += ",ExpensesLink"; |
|
71 |
strcmd.Append("SELECT"); |
|
72 |
strcmd.Append(" TypeCode"); |
|
73 |
strcmd.Append(",DisplayOrder"); |
|
74 |
strcmd.Append(",NameString"); |
|
75 |
strcmd.Append(",PublicFlg"); |
|
76 |
strcmd.Append(",SecRank"); |
|
77 |
strcmd.Append(",ExpensesLink"); |
|
77 | 78 |
|
78 |
strcmd += ",DeleteFlg";
|
|
79 |
strcmd.Append(",DeleteFlg");
|
|
79 | 80 |
|
80 |
strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
|
|
81 |
strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
|
|
82 |
strcmd += " FROM ConstructionTypeMaster";
|
|
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 ConstructionTypeMaster");
|
|
83 | 84 |
|
84 |
return strcmd; |
|
85 |
return strcmd.ToString();
|
|
85 | 86 |
} |
86 | 87 |
#endregion |
87 | 88 |
|
... | ... | |
96 | 97 |
public bool SelectAction(string AddSQLString, ref List<ConstructionTypeMaster> data, bool bConnect = true) |
97 | 98 |
{ |
98 | 99 |
// インターフェース |
99 |
string strcmd = "";
|
|
100 |
StringBuilder strcmd = new StringBuilder();
|
|
100 | 101 |
ArrayList arData = new ArrayList(); |
101 | 102 |
|
102 | 103 |
try |
103 | 104 |
{ |
104 | 105 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
105 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
106 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
106 | 107 |
|
107 | 108 |
// SQL実行 |
108 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
109 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
109 | 110 |
|
110 | 111 |
// データセット |
111 | 112 |
foreach (object[] objwrk in arData) |
... | ... | |
119 | 120 |
} |
120 | 121 |
catch (Exception ex) |
121 | 122 |
{ |
122 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
123 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
123 | 124 |
return false; |
124 | 125 |
} |
125 | 126 |
|
... | ... | |
137 | 138 |
public bool SelectAction(string AddSQLString, ref ConstructionTypeMaster data, bool bConnect = true) |
138 | 139 |
{ |
139 | 140 |
// インターフェース |
140 |
string strcmd = "";
|
|
141 |
StringBuilder strcmd = new StringBuilder();
|
|
141 | 142 |
ArrayList arData = new ArrayList(); |
142 | 143 |
|
143 | 144 |
try |
144 | 145 |
{ |
145 | 146 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
146 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
147 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
147 | 148 |
|
148 | 149 |
// SQL実行 |
149 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
150 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
150 | 151 |
if (arData.Count == 0) return false; |
151 | 152 |
|
152 | 153 |
// データセット |
... | ... | |
160 | 161 |
} |
161 | 162 |
catch (Exception ex) |
162 | 163 |
{ |
163 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
164 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
164 | 165 |
return false; |
165 | 166 |
} |
166 | 167 |
|
... | ... | |
175 | 176 |
/// <returns>true:成功 false:失敗</returns> |
176 | 177 |
public bool InsertAction(ConstructionTypeMaster work, bool bConnect = true) |
177 | 178 |
{ |
178 |
string strcmd = "";
|
|
179 |
StringBuilder strcmd = new StringBuilder();
|
|
179 | 180 |
try |
180 | 181 |
{ |
181 | 182 |
|
182 |
strcmd = "INSERT INTO ConstructionTypeMaster";
|
|
183 |
strcmd.Append("INSERT INTO ConstructionTypeMaster");
|
|
183 | 184 |
|
184 |
strcmd += "(";
|
|
185 |
strcmd.Append("(");
|
|
185 | 186 |
bool bFirst = true; |
186 | 187 |
foreach (var gender in Enum.GetValues(typeof(NameColumn))) |
187 | 188 |
{ |
188 |
if (!bFirst) strcmd += " ,";
|
|
189 |
strcmd += gender.ToString();
|
|
189 |
if (!bFirst) strcmd.Append(" ,");
|
|
190 |
strcmd.Append(gender.ToString());
|
|
190 | 191 |
bFirst = false; |
191 | 192 |
} |
192 |
strcmd += ") VALUES (";
|
|
193 |
strcmd.Append(") VALUES (");
|
|
193 | 194 |
|
194 |
strcmd += string.Format(" {0}", work.TypeCode);
|
|
195 |
strcmd += string.Format(", {0}", work.DisplayOrder);
|
|
196 |
strcmd += string.Format(",'{0}'", work.NameString);
|
|
197 |
strcmd += string.Format(", {0}", work.PublicFlg);
|
|
198 |
strcmd += string.Format(", {0}", work.SecRank);
|
|
199 |
strcmd += string.Format(", {0}", work.ExpensesLink);
|
|
200 |
strcmd += string.Format(", {0}", work.DeleteFlg);
|
|
195 |
strcmd.AppendFormat(" {0}", work.TypeCode);
|
|
196 |
strcmd.AppendFormat(", {0}", work.DisplayOrder);
|
|
197 |
strcmd.AppendFormat(",'{0}'", work.NameString);
|
|
198 |
strcmd.AppendFormat(", {0}", work.PublicFlg);
|
|
199 |
strcmd.AppendFormat(", {0}", work.SecRank);
|
|
200 |
strcmd.AppendFormat(", {0}", work.ExpensesLink);
|
|
201 |
strcmd.AppendFormat(", {0}", work.DeleteFlg);
|
|
201 | 202 |
|
202 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
203 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
204 |
strcmd += ")";
|
|
203 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
204 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
205 |
strcmd.Append(")");
|
|
205 | 206 |
|
206 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
207 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
207 | 208 |
|
208 | 209 |
return true; |
209 | 210 |
} |
210 | 211 |
catch (Exception ex) |
211 | 212 |
{ |
212 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
213 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
213 | 214 |
return false; |
214 | 215 |
} |
215 | 216 |
} |
... | ... | |
224 | 225 |
/// <returns></returns> |
225 | 226 |
public bool InsertAction(List<ConstructionTypeMaster> data, bool bConnect = true) |
226 | 227 |
{ |
227 |
string strcmd = "";
|
|
228 |
StringBuilder strcmd = new StringBuilder();
|
|
228 | 229 |
try |
229 | 230 |
{ |
230 | 231 |
bool bColFirst = true; |
231 |
strcmd = "INSERT INTO ConstructionTypeMaster";
|
|
232 |
strcmd += " (";
|
|
232 |
strcmd.Append("INSERT INTO ConstructionTypeMaster");
|
|
233 |
strcmd.Append(" (");
|
|
233 | 234 |
foreach (var gender in Enum.GetValues(typeof(NameColumn))) |
234 | 235 |
{ |
235 |
if (!bColFirst) strcmd += ", ";
|
|
236 |
strcmd += gender.ToString();
|
|
236 |
if (!bColFirst) strcmd.Append(", ");
|
|
237 |
strcmd.Append(gender.ToString());
|
|
237 | 238 |
bColFirst = false; |
238 | 239 |
} |
239 |
strcmd += ") VALUES";
|
|
240 |
strcmd.Append(") VALUES");
|
|
240 | 241 |
|
241 | 242 |
bool bDataFirst = true; |
242 | 243 |
foreach (ConstructionTypeMaster work in data) |
243 | 244 |
{ |
244 |
if (bDataFirst) strcmd += " (";
|
|
245 |
else strcmd += ", (";
|
|
245 |
if (bDataFirst) strcmd.Append(" (");
|
|
246 |
else strcmd.Append(", (");
|
|
246 | 247 |
|
247 |
strcmd += string.Format(" {0}", work.TypeCode);
|
|
248 |
strcmd += string.Format(", {0}", work.DisplayOrder);
|
|
249 |
strcmd += string.Format(",'{0}'", work.NameString);
|
|
250 |
strcmd += string.Format(", {0}", work.PublicFlg);
|
|
251 |
strcmd += string.Format(", {0}", work.SecRank);
|
|
252 |
strcmd += string.Format(", {0}", work.ExpensesLink);
|
|
253 |
strcmd += string.Format(", {0}", work.DeleteFlg);
|
|
248 |
strcmd.AppendFormat(" {0}", work.TypeCode);
|
|
249 |
strcmd.AppendFormat(", {0}", work.DisplayOrder);
|
|
250 |
strcmd.AppendFormat(",'{0}'", work.NameString);
|
|
251 |
strcmd.AppendFormat(", {0}", work.PublicFlg);
|
|
252 |
strcmd.AppendFormat(", {0}", work.SecRank);
|
|
253 |
strcmd.AppendFormat(", {0}", work.ExpensesLink);
|
|
254 |
strcmd.AppendFormat(", {0}", work.DeleteFlg);
|
|
254 | 255 |
|
255 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
256 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
257 |
strcmd += ")";
|
|
256 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
257 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
258 |
strcmd.Append(")");
|
|
258 | 259 |
|
259 | 260 |
bDataFirst = false; |
260 | 261 |
} |
261 | 262 |
|
262 |
if (!ExecuteNonQuery(strcmd, false)) return false; |
|
263 |
if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
|
|
263 | 264 |
|
264 | 265 |
return true; |
265 | 266 |
} |
266 | 267 |
catch (Exception ex) |
267 | 268 |
{ |
268 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
269 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
269 | 270 |
return false; |
270 | 271 |
} |
271 | 272 |
} |
... | ... | |
280 | 281 |
/// <returns>true:成功 false:失敗</returns> |
281 | 282 |
public bool UpdateAction(string AddSQLString, ConstructionTypeMaster data, bool bConnect = true) |
282 | 283 |
{ |
283 |
string strcmd = "";
|
|
284 |
StringBuilder strcmd = new StringBuilder();
|
|
284 | 285 |
try |
285 | 286 |
{ |
286 | 287 |
|
287 |
strcmd = "UPDATE ConstructionTypeMaster";
|
|
288 |
strcmd.Append("UPDATE ConstructionTypeMaster");
|
|
288 | 289 |
|
289 |
strcmd += " SET";
|
|
290 |
strcmd.Append(" SET");
|
|
290 | 291 |
|
291 |
strcmd += string.Format(" TypeCode = {0}", data.TypeCode);
|
|
292 |
strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder);
|
|
293 |
strcmd += string.Format(",NameString = '{0}'", data.NameString);
|
|
294 |
strcmd += string.Format(",PublicFlg = {0}", data.PublicFlg);
|
|
295 |
strcmd += string.Format(",SecRank = {0}", data.SecRank);
|
|
296 |
strcmd += string.Format(",ExpensesLink = {0}", data.ExpensesLink);
|
|
297 |
strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg);
|
|
292 |
strcmd.AppendFormat(" TypeCode = {0}", data.TypeCode);
|
|
293 |
strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder);
|
|
294 |
strcmd.AppendFormat(",NameString = '{0}'", data.NameString);
|
|
295 |
strcmd.AppendFormat(",PublicFlg = {0}", data.PublicFlg);
|
|
296 |
strcmd.AppendFormat(",SecRank = {0}", data.SecRank);
|
|
297 |
strcmd.AppendFormat(",ExpensesLink = {0}", data.ExpensesLink);
|
|
298 |
strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg);
|
|
298 | 299 |
|
299 |
strcmd += ", UpdateDate = NOW()";
|
|
300 |
strcmd += AddSQLString;
|
|
300 |
strcmd.Append(", UpdateDate = NOW()");
|
|
301 |
strcmd.Append(AddSQLString);
|
|
301 | 302 |
|
302 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
303 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
303 | 304 |
|
304 | 305 |
return true; |
305 | 306 |
} |
306 | 307 |
catch (Exception ex) |
307 | 308 |
{ |
308 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
309 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
309 | 310 |
return false; |
310 | 311 |
} |
311 | 312 |
} |
... | ... | |
321 | 322 |
public bool DeleteAction(string AddSQLString, bool bConnect = true) |
322 | 323 |
{ |
323 | 324 |
// インターフェース |
324 |
string strcmd = "";
|
|
325 |
StringBuilder strcmd = new StringBuilder();
|
|
325 | 326 |
try |
326 | 327 |
{ |
327 |
strcmd = string.Format("{0}{1}", "DELETE FROM ConstructionTypeMaster", AddSQLString);
|
|
328 |
strcmd.AppendFormat("{0}{1}", "DELETE FROM ConstructionTypeMaster", AddSQLString);
|
|
328 | 329 |
|
329 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
330 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
330 | 331 |
|
331 | 332 |
return true; |
332 | 333 |
} |
333 | 334 |
catch (Exception ex) |
334 | 335 |
{ |
335 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
336 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
336 | 337 |
return false; |
337 | 338 |
} |
338 | 339 |
} |
... | ... | |
417 | 418 |
public int SelectMaxTypeCodeCount(string AddSQLString, bool bConnect = true) |
418 | 419 |
{ |
419 | 420 |
// インターフェース |
420 |
string strcmd = "";
|
|
421 |
StringBuilder strcmd = new StringBuilder();
|
|
421 | 422 |
ArrayList arData = new ArrayList(); |
422 | 423 |
int iRet = 0; |
423 | 424 |
try |
424 | 425 |
{ |
425 | 426 |
// SQL作成 |
426 |
strcmd = "SELECT IFNULL(MAX(TypeCode), 0) FROM ConstructionTypeMaster" + AddSQLString;
|
|
427 |
strcmd.AppendFormat("SELECT IFNULL(MAX(TypeCode), 0) FROM ConstructionTypeMaster{0}", AddSQLString);
|
|
427 | 428 |
|
428 | 429 |
// SQL実行 |
429 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet; |
|
430 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
|
|
430 | 431 |
|
431 | 432 |
// データセット |
432 | 433 |
foreach (object[] objwrk in arData) |
... | ... | |
439 | 440 |
} |
440 | 441 |
catch (Exception ex) |
441 | 442 |
{ |
442 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
443 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
443 | 444 |
} |
444 | 445 |
|
445 | 446 |
return iRet; |
... | ... | |
456 | 457 |
public int SelectMaxCategoryHistoryCount(string AddSQLString, bool bConnect = true) |
457 | 458 |
{ |
458 | 459 |
// インターフェース |
459 |
string strcmd = "";
|
|
460 |
StringBuilder strcmd = new StringBuilder();
|
|
460 | 461 |
ArrayList arData = new ArrayList(); |
461 | 462 |
int iRet = 0; |
462 | 463 |
try |
463 | 464 |
{ |
464 | 465 |
// SQL作成 |
465 |
strcmd = "SELECT IFNULL(MAX(DisplayOrder), 0) FROM ConstructionTypeMaster" + AddSQLString;
|
|
466 |
strcmd.AppendFormat("SELECT IFNULL(MAX(DisplayOrder), 0) FROM ConstructionTypeMaster{0}", AddSQLString);
|
|
466 | 467 |
|
467 | 468 |
// SQL実行 |
468 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet; |
|
469 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
|
|
469 | 470 |
|
470 | 471 |
// データセット |
471 | 472 |
object[] objwrk = (object[])arData[0]; |
... | ... | |
473 | 474 |
} |
474 | 475 |
catch (Exception ex) |
475 | 476 |
{ |
476 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
477 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
477 | 478 |
} |
478 | 479 |
|
479 | 480 |
return iRet; |
... | ... | |
488 | 489 |
/// <returns>Where文字列</returns> |
489 | 490 |
public string CreatePrimarykeyString(int TypeCode) |
490 | 491 |
{ |
491 |
string strWork = string.Empty;
|
|
492 |
StringBuilder strWork = new StringBuilder(); ;
|
|
492 | 493 |
try |
493 | 494 |
{ |
494 |
strWork = string.Format(" Where TypeCode = {0}", TypeCode);
|
|
495 |
strWork.AppendFormat(" Where TypeCode = {0}", TypeCode);
|
|
495 | 496 |
} |
496 | 497 |
catch (Exception ex) |
497 | 498 |
{ |
498 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork); |
|
499 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
|
|
499 | 500 |
} |
500 | 501 |
|
501 |
return strWork; |
|
502 |
return strWork.ToString();
|
|
502 | 503 |
} |
503 | 504 |
#endregion |
504 | 505 |
} |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMDepartment.cs | ||
---|---|---|
66 | 66 |
private string CreateSelectSQL() |
67 | 67 |
{ |
68 | 68 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
69 |
string strcmd = "SELECT";
|
|
69 |
StringBuilder strcmd = new StringBuilder();
|
|
70 | 70 |
|
71 |
strcmd += " DepartmentCode"; |
|
72 |
strcmd += ",DisplayOrder"; |
|
73 |
strcmd += ",DepartmentString"; |
|
74 |
strcmd += ",ActionScheduleFlg"; |
|
75 |
strcmd += ",StaffAssignFlg"; |
|
76 |
strcmd += ",DeleteFlg"; |
|
71 |
strcmd.Append("SELECT"); |
|
72 |
strcmd.Append(" DepartmentCode"); |
|
73 |
strcmd.Append(",DisplayOrder"); |
|
74 |
strcmd.Append(",DepartmentString"); |
|
75 |
strcmd.Append(",ActionScheduleFlg"); |
|
76 |
strcmd.Append(",StaffAssignFlg"); |
|
77 |
strcmd.Append(",DeleteFlg"); |
|
77 | 78 |
|
78 |
strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
|
|
79 |
strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
|
|
80 |
strcmd += " FROM DepartmentMaster";
|
|
79 |
strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
|
|
80 |
strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
|
|
81 |
strcmd.Append(" FROM DepartmentMaster");
|
|
81 | 82 |
|
82 |
return strcmd; |
|
83 |
return strcmd.ToString();
|
|
83 | 84 |
} |
84 | 85 |
#endregion |
85 | 86 |
|
... | ... | |
94 | 95 |
public bool SelectAction(string AddSQLString, ref DepartmentMaster data, bool bConnect = true) |
95 | 96 |
{ |
96 | 97 |
// インターフェース |
97 |
string strcmd = "";
|
|
98 |
StringBuilder strcmd = new StringBuilder();
|
|
98 | 99 |
ArrayList arData = new ArrayList(); |
99 | 100 |
|
100 | 101 |
try |
101 | 102 |
{ |
102 | 103 |
// SQL作成 |
103 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
104 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
104 | 105 |
|
105 | 106 |
// SQL実行 |
106 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
107 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
107 | 108 |
if (arData.Count == 0) return false; |
108 | 109 |
|
109 | 110 |
// データセット |
... | ... | |
114 | 115 |
} |
115 | 116 |
catch (Exception ex) |
116 | 117 |
{ |
117 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
118 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
118 | 119 |
return false; |
119 | 120 |
} |
120 | 121 |
|
... | ... | |
131 | 132 |
public bool SelectAction(string AddSQLString, ref List<DepartmentMaster> data, bool bConnect = true) |
132 | 133 |
{ |
133 | 134 |
// インターフェース |
134 |
string strcmd = "";
|
|
135 |
StringBuilder strcmd = new StringBuilder();
|
|
135 | 136 |
ArrayList arData = new ArrayList(); |
136 | 137 |
|
137 | 138 |
try |
138 | 139 |
{ |
139 | 140 |
// SQL作成 |
140 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
141 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
141 | 142 |
|
142 | 143 |
// SQL実行 |
143 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
144 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
144 | 145 |
|
145 | 146 |
// データセット |
146 | 147 |
foreach (object[] objwrk in arData) |
... | ... | |
154 | 155 |
} |
155 | 156 |
catch (Exception ex) |
156 | 157 |
{ |
157 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
158 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
158 | 159 |
return false; |
159 | 160 |
} |
160 | 161 |
|
... | ... | |
169 | 170 |
/// <returns>true:成功 false:失敗</returns> |
170 | 171 |
public bool InsertAction(List<DepartmentMaster> data, bool bConnect = true) |
171 | 172 |
{ |
172 |
string strcmd = "";
|
|
173 |
StringBuilder strcmd = new StringBuilder();
|
|
173 | 174 |
try |
174 | 175 |
{ |
175 | 176 |
bool bColFirst = true; |
176 |
strcmd = "INSERT INTO DepartmentMaster";
|
|
177 |
strcmd += " (";
|
|
177 |
strcmd.Append("INSERT INTO DepartmentMaster");
|
|
178 |
strcmd.Append(" (");
|
|
178 | 179 |
foreach (var gender in Enum.GetValues(typeof(NameColumn))) |
179 | 180 |
{ |
180 |
if (!bColFirst) strcmd += ", ";
|
|
181 |
strcmd += gender.ToString();
|
|
181 |
if (!bColFirst) strcmd.Append(", ");
|
|
182 |
strcmd.Append(gender.ToString());
|
|
182 | 183 |
bColFirst = false; |
183 | 184 |
} |
184 |
strcmd += ") VALUES";
|
|
185 |
strcmd.Append(") VALUES");
|
|
185 | 186 |
|
186 | 187 |
bool bDataFirst = true; |
187 | 188 |
foreach (DepartmentMaster work in data) |
188 | 189 |
{ |
189 |
if (bDataFirst) strcmd += " (";
|
|
190 |
else strcmd += ", (";
|
|
190 |
if (bDataFirst) strcmd.Append(" (");
|
|
191 |
else strcmd.Append(", (");
|
|
191 | 192 |
|
192 |
strcmd += string.Format(" {0}", work.DepartmentCode.ToString());
|
|
193 |
strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
|
|
194 |
strcmd += string.Format(",'{0}'", work.DepartmentString.ToString());
|
|
195 |
strcmd += string.Format(", {0}", work.ActionScheduleFlg.ToString());
|
|
196 |
strcmd += string.Format(", {0}", work.StaffAssignFlg.ToString());
|
|
197 |
strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
|
|
193 |
strcmd.AppendFormat(" {0}", work.DepartmentCode.ToString());
|
|
194 |
strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
|
|
195 |
strcmd.AppendFormat(",'{0}'", work.DepartmentString.ToString());
|
|
196 |
strcmd.AppendFormat(", {0}", work.ActionScheduleFlg.ToString());
|
|
197 |
strcmd.AppendFormat(", {0}", work.StaffAssignFlg.ToString());
|
|
198 |
strcmd.AppendFormat(", {0}", work.DeleteFlg.ToString());
|
|
198 | 199 |
|
199 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
200 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
201 |
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(")");
|
|
202 | 203 |
|
203 | 204 |
bDataFirst = false; |
204 | 205 |
} |
205 | 206 |
|
206 |
if (!ExecuteNonQuery(strcmd, false)) return false; |
|
207 |
if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
|
|
207 | 208 |
|
208 | 209 |
return true; |
209 | 210 |
} |
210 | 211 |
catch (Exception ex) |
211 | 212 |
{ |
212 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
213 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
213 | 214 |
return false; |
214 | 215 |
} |
215 | 216 |
} |
... | ... | |
224 | 225 |
/// <returns>true:成功 false:失敗</returns> |
225 | 226 |
public bool UpdateAction(string AddSQLString, DepartmentMaster data, bool bConnect = true) |
226 | 227 |
{ |
227 |
string strcmd = "";
|
|
228 |
StringBuilder strcmd = new StringBuilder();
|
|
228 | 229 |
try |
229 | 230 |
{ |
230 | 231 |
|
231 |
strcmd = "UPDATE DepartmentMaster";
|
|
232 |
strcmd.Append("UPDATE DepartmentMaster");
|
|
232 | 233 |
|
233 |
strcmd += " SET";
|
|
234 |
strcmd.Append(" SET");
|
|
234 | 235 |
|
235 |
strcmd += string.Format(" DepartmentCode = {0}", data.DepartmentCode.ToString());
|
|
236 |
strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
|
|
237 |
strcmd += string.Format(",DepartmentString = '{0}'", data.DepartmentString.ToString());
|
|
238 |
strcmd += string.Format(",ActionScheduleFlg = {0}", data.ActionScheduleFlg.ToString());
|
|
239 |
strcmd += string.Format(",StaffAssignFlg = {0}", data.StaffAssignFlg.ToString());
|
|
240 |
strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg.ToString());
|
|
236 |
strcmd.AppendFormat(" DepartmentCode = {0}", data.DepartmentCode.ToString());
|
|
237 |
strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
|
|
238 |
strcmd.AppendFormat(",DepartmentString = '{0}'", data.DepartmentString.ToString());
|
|
239 |
strcmd.AppendFormat(",ActionScheduleFlg = {0}", data.ActionScheduleFlg.ToString());
|
|
240 |
strcmd.AppendFormat(",StaffAssignFlg = {0}", data.StaffAssignFlg.ToString());
|
|
241 |
strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg.ToString());
|
|
241 | 242 |
|
242 |
strcmd += ", UpdateDate = NOW()";
|
|
243 |
strcmd += AddSQLString;
|
|
243 |
strcmd.Append(", UpdateDate = NOW()");
|
|
244 |
strcmd.Append(AddSQLString);
|
|
244 | 245 |
|
245 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
246 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
246 | 247 |
|
247 | 248 |
return true; |
248 | 249 |
} |
249 | 250 |
catch (Exception ex) |
250 | 251 |
{ |
251 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
252 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
252 | 253 |
return false; |
253 | 254 |
} |
254 | 255 |
} |
... | ... | |
264 | 265 |
public bool DeleteAction(string AddSQLString, bool bConnect = true) |
265 | 266 |
{ |
266 | 267 |
// インターフェース |
267 |
string strcmd = "";
|
|
268 |
StringBuilder strcmd = new StringBuilder();
|
|
268 | 269 |
try |
269 | 270 |
{ |
270 |
strcmd = string.Format("{0}{1}", "DELETE FROM DepartmentMaster", AddSQLString);
|
|
271 |
strcmd.AppendFormat("{0}{1}", "DELETE FROM DepartmentMaster", AddSQLString);
|
|
271 | 272 |
|
272 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
273 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
273 | 274 |
|
274 | 275 |
return true; |
275 | 276 |
} |
276 | 277 |
catch (Exception ex) |
277 | 278 |
{ |
278 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
279 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
279 | 280 |
return false; |
280 | 281 |
} |
281 | 282 |
} |
... | ... | |
391 | 392 |
public int SelectMaxDepartmentCount(string AddSQLString, bool bConnect = true) |
392 | 393 |
{ |
393 | 394 |
// インターフェース |
394 |
string strcmd = "";
|
|
395 |
StringBuilder strcmd = new StringBuilder();
|
|
395 | 396 |
ArrayList arData = new ArrayList(); |
396 | 397 |
int iRet = 0; |
397 | 398 |
try |
398 | 399 |
{ |
399 | 400 |
// SQL作成 |
400 |
strcmd = "SELECT IFNULL(MAX(DepartmentCode), 0) FROM DepartmentMaster" + AddSQLString;
|
|
401 |
strcmd.AppendFormat("SELECT IFNULL(MAX(DepartmentCode), 0) FROM DepartmentMaster{0}", AddSQLString);
|
|
401 | 402 |
|
402 | 403 |
// SQL実行 |
403 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet; |
|
404 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
|
|
404 | 405 |
|
405 | 406 |
// データセット |
406 | 407 |
foreach (object[] objwrk in arData) |
... | ... | |
413 | 414 |
} |
414 | 415 |
catch (Exception ex) |
415 | 416 |
{ |
416 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
417 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
417 | 418 |
} |
418 | 419 |
|
419 | 420 |
return iRet; |
... | ... | |
428 | 429 |
/// <returns>Where文字列</returns> |
429 | 430 |
public string CreatePrimarykeyString(int DepartmentCode) |
430 | 431 |
{ |
431 |
string strWork = string.Empty;
|
|
432 |
StringBuilder strWork = new StringBuilder();
|
|
432 | 433 |
try |
433 | 434 |
{ |
434 |
strWork = string.Format(" Where DepartmentCode = {0}", DepartmentCode);
|
|
435 |
strWork.AppendFormat(" Where DepartmentCode = {0}", DepartmentCode);
|
|
435 | 436 |
} |
436 | 437 |
catch (Exception ex) |
437 | 438 |
{ |
438 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork); |
|
439 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
|
|
439 | 440 |
} |
440 | 441 |
|
441 |
return strWork; |
|
442 |
return strWork.ToString();
|
|
442 | 443 |
} |
443 | 444 |
#endregion |
444 | 445 |
} |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMDepartmentExpenses.cs | ||
---|---|---|
89 | 89 |
/// <returns>true:成功 false:失敗</returns> |
90 | 90 |
private string CreateSelectSQL() |
91 | 91 |
{ |
92 |
string strcmd = "SELECT";
|
|
92 |
StringBuilder strcmd = new StringBuilder();
|
|
93 | 93 |
|
94 |
strcmd += " DepartmentCode"; |
|
95 |
strcmd += " ,ExpensesPeriod"; |
|
96 |
strcmd += " ,NameCode"; |
|
97 |
strcmd += " ,DisplayOrder"; |
|
98 |
strcmd += " ,ExpensesRaito"; |
|
99 |
strcmd += " ,DeleteFlg"; |
|
94 |
strcmd.Append("SELECT"); |
|
95 |
strcmd.Append(" DepartmentCode"); |
|
96 |
strcmd.Append(" ,ExpensesPeriod"); |
|
97 |
strcmd.Append(" ,NameCode"); |
|
98 |
strcmd.Append(" ,DisplayOrder"); |
|
99 |
strcmd.Append(" ,ExpensesRaito"); |
|
100 |
strcmd.Append(" ,DeleteFlg"); |
|
100 | 101 |
|
101 |
strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
|
|
102 |
strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
|
|
103 |
strcmd += " FROM DepartmentExpensesMaster";
|
|
102 |
strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
|
|
103 |
strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
|
|
104 |
strcmd.Append(" FROM DepartmentExpensesMaster");
|
|
104 | 105 |
|
105 |
return strcmd; |
|
106 |
return strcmd.ToString();
|
|
106 | 107 |
} |
107 | 108 |
#endregion |
108 | 109 |
|
... | ... | |
117 | 118 |
public bool SelectAction(string AddSQLString, ref List<DepartmentExpenses> data, bool bConnect = true) |
118 | 119 |
{ |
119 | 120 |
// インターフェース |
120 |
string strcmd = "";
|
|
121 |
StringBuilder strcmd = new StringBuilder();
|
|
121 | 122 |
ArrayList arData = new ArrayList(); |
122 | 123 |
|
123 | 124 |
try |
124 | 125 |
{ |
125 | 126 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
126 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
127 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
127 | 128 |
|
128 | 129 |
// SQL実行 |
129 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
130 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
130 | 131 |
|
131 | 132 |
// データセット |
132 | 133 |
foreach (object[] objwrk in arData) |
... | ... | |
140 | 141 |
} |
141 | 142 |
catch (Exception ex) |
142 | 143 |
{ |
143 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
144 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
144 | 145 |
return false; |
145 | 146 |
} |
146 | 147 |
|
... | ... | |
158 | 159 |
public bool SelectAction(string AddSQLString, ref DepartmentExpenses data, bool bConnect = true) |
159 | 160 |
{ |
160 | 161 |
// インターフェース |
161 |
string strcmd = "";
|
|
162 |
StringBuilder strcmd = new StringBuilder();
|
|
162 | 163 |
ArrayList arData = new ArrayList(); |
163 | 164 |
|
164 | 165 |
try |
165 | 166 |
{ |
166 | 167 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
167 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
168 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
168 | 169 |
|
169 | 170 |
// SQL実行 |
170 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
171 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
171 | 172 |
if (arData.Count == 0) return false; |
172 | 173 |
|
173 | 174 |
// データセット |
... | ... | |
181 | 182 |
} |
182 | 183 |
catch (Exception ex) |
183 | 184 |
{ |
184 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
185 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
185 | 186 |
return false; |
186 | 187 |
} |
187 | 188 |
|
... | ... | |
196 | 197 |
/// <returns>true:成功 false:失敗</returns> |
197 | 198 |
public bool InsertAction(DepartmentExpenses data, bool bConnect = true) |
198 | 199 |
{ |
199 |
string strcmd = "";
|
|
200 |
StringBuilder strcmd = new StringBuilder();
|
|
200 | 201 |
try |
201 | 202 |
{ |
202 | 203 |
|
203 | 204 |
bool bColFirst = true; |
204 |
strcmd = "INSERT INTO DepartmentExpensesMaster";
|
|
205 |
strcmd += " (";
|
|
205 |
strcmd.Append("INSERT INTO DepartmentExpensesMaster");
|
|
206 |
strcmd.Append(" (");
|
|
206 | 207 |
foreach (var gender in Enum.GetValues(typeof(NameColumn))) |
207 | 208 |
{ |
208 |
if (!bColFirst) strcmd += ", ";
|
|
209 |
strcmd += gender.ToString();
|
|
209 |
if (!bColFirst) strcmd.Append(", ");
|
|
210 |
strcmd.Append(gender.ToString());
|
|
210 | 211 |
bColFirst = false; |
211 | 212 |
} |
212 |
strcmd += ") VALUES (";
|
|
213 |
strcmd.Append(") VALUES (");
|
|
213 | 214 |
|
214 |
strcmd += string.Format(" {0}", data.DepartmentCode.ToString());
|
|
215 |
strcmd += string.Format(", {0}", data.ExpensesPeriod.ToString());
|
|
216 |
strcmd += string.Format(", {0}", data.NameCode.ToString());
|
|
217 |
strcmd += string.Format(", {0}", data.DisplayOrder.ToString());
|
|
218 |
strcmd += string.Format(", {0}", data.ExpensesRaito.ToString());
|
|
219 |
strcmd += string.Format(", {0}", data.DeleteFlg.ToString());
|
|
215 |
strcmd.AppendFormat(" {0}", data.DepartmentCode.ToString());
|
|
216 |
strcmd.AppendFormat(", {0}", data.ExpensesPeriod.ToString());
|
|
217 |
strcmd.AppendFormat(", {0}", data.NameCode.ToString());
|
|
218 |
strcmd.AppendFormat(", {0}", data.DisplayOrder.ToString());
|
|
219 |
strcmd.AppendFormat(", {0}", data.ExpensesRaito.ToString());
|
|
220 |
strcmd.AppendFormat(", {0}", data.DeleteFlg.ToString());
|
|
220 | 221 |
|
221 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.EntryDate);
|
|
222 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.UpdateDate);
|
|
223 |
strcmd += ")";
|
|
222 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.EntryDate);
|
|
223 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", data.UpdateDate);
|
|
224 |
strcmd.Append(")");
|
|
224 | 225 |
|
225 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
226 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
226 | 227 |
|
227 | 228 |
return true; |
228 | 229 |
} |
229 | 230 |
catch (Exception ex) |
230 | 231 |
{ |
231 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
232 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
232 | 233 |
return false; |
233 | 234 |
} |
234 | 235 |
} |
... | ... | |
242 | 243 |
/// <returns>true:成功 false:失敗</returns> |
243 | 244 |
public bool InsertAction(List<DepartmentExpenses> data, bool bConnect = true) |
244 | 245 |
{ |
245 |
string strcmd = "";
|
|
246 |
StringBuilder strcmd = new StringBuilder();
|
|
246 | 247 |
try |
247 | 248 |
{ |
248 | 249 |
bool bColFirst = true; |
249 |
strcmd = "INSERT INTO DepartmentExpensesMaster";
|
|
250 |
strcmd += " (";
|
|
250 |
strcmd.Append("INSERT INTO DepartmentExpensesMaster");
|
|
251 |
strcmd.Append(" (");
|
|
251 | 252 |
foreach (var gender in Enum.GetValues(typeof(NameColumn))) |
252 | 253 |
{ |
253 |
if (!bColFirst) strcmd += ", ";
|
|
254 |
strcmd += gender.ToString();
|
|
254 |
if (!bColFirst) strcmd.Append(", ");
|
|
255 |
strcmd.Append(gender.ToString());
|
|
255 | 256 |
bColFirst = false; |
256 | 257 |
} |
257 |
strcmd += ") VALUES";
|
|
258 |
strcmd.Append(") VALUES");
|
|
258 | 259 |
|
259 | 260 |
bool bDataFirst = true; |
260 | 261 |
foreach (DepartmentExpenses work in data) |
261 | 262 |
{ |
262 |
if (bDataFirst) strcmd += " (";
|
|
263 |
else strcmd += ", (";
|
|
263 |
if (bDataFirst) strcmd.Append(" (");
|
|
264 |
else strcmd.Append(", (");
|
|
264 | 265 |
|
265 |
strcmd += string.Format(" {0}", work.DepartmentCode.ToString());
|
|
266 |
strcmd += string.Format(", {0}", work.ExpensesPeriod.ToString());
|
|
267 |
strcmd += string.Format(", {0}", work.NameCode.ToString());
|
|
268 |
strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
|
|
269 |
strcmd += string.Format(", {0}", work.ExpensesRaito.ToString());
|
|
270 |
strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
|
|
266 |
strcmd.AppendFormat(" {0}", work.DepartmentCode.ToString());
|
|
267 |
strcmd.AppendFormat(", {0}", work.ExpensesPeriod.ToString());
|
|
268 |
strcmd.AppendFormat(", {0}", work.NameCode.ToString());
|
|
269 |
strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
|
|
270 |
strcmd.AppendFormat(", {0}", work.ExpensesRaito.ToString());
|
|
271 |
strcmd.AppendFormat(", {0}", work.DeleteFlg.ToString());
|
|
271 | 272 |
|
272 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
273 |
strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
274 |
strcmd += ")";
|
|
273 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
|
|
274 |
strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
|
|
275 |
strcmd.Append(")");
|
|
275 | 276 |
|
276 | 277 |
bDataFirst = false; |
277 | 278 |
} |
278 | 279 |
|
279 |
if (!ExecuteNonQuery(strcmd, false)) return false; |
|
280 |
if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
|
|
280 | 281 |
|
281 | 282 |
return true; |
282 | 283 |
} |
283 | 284 |
catch (Exception ex) |
284 | 285 |
{ |
285 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
286 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
286 | 287 |
return false; |
287 | 288 |
} |
288 | 289 |
} |
... | ... | |
297 | 298 |
/// <returns>true:成功 false:失敗</returns> |
298 | 299 |
public bool UpdateAction(string AddSQLString, DepartmentExpenses data, bool bConnect = true) |
299 | 300 |
{ |
300 |
string strcmd = "";
|
|
301 |
StringBuilder strcmd = new StringBuilder();
|
|
301 | 302 |
try |
302 | 303 |
{ |
303 | 304 |
|
304 |
strcmd = "UPDATE DepartmentExpensesMaster";
|
|
305 |
strcmd.Append("UPDATE DepartmentExpensesMaster");
|
|
305 | 306 |
|
306 |
strcmd += " SET";
|
|
307 |
strcmd.Append(" SET");
|
|
307 | 308 |
|
308 |
strcmd += string.Format(" DepartmentCode = {0}", data.DepartmentCode.ToString());
|
|
309 |
strcmd += string.Format(",ExpensesPeriod = {0}", data.ExpensesPeriod.ToString());
|
|
310 |
strcmd += string.Format(",NameCode = {0}", data.NameCode.ToString());
|
|
311 |
strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
|
|
312 |
strcmd += string.Format(",EXPENSESRAITO = {0}", data.ExpensesRaito.ToString());
|
|
313 |
strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg.ToString());
|
|
309 |
strcmd.AppendFormat(" DepartmentCode = {0}", data.DepartmentCode.ToString());
|
|
310 |
strcmd.AppendFormat(",ExpensesPeriod = {0}", data.ExpensesPeriod.ToString());
|
|
311 |
strcmd.AppendFormat(",NameCode = {0}", data.NameCode.ToString());
|
|
312 |
strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
|
|
313 |
strcmd.AppendFormat(",EXPENSESRAITO = {0}", data.ExpensesRaito.ToString());
|
|
314 |
strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg.ToString());
|
|
314 | 315 |
|
315 |
strcmd += ", UpdateDate = NOW()";
|
|
316 |
strcmd += AddSQLString;
|
|
316 |
strcmd.Append(", UpdateDate = NOW()");
|
|
317 |
strcmd.Append(AddSQLString);
|
|
317 | 318 |
|
318 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
319 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
319 | 320 |
|
320 | 321 |
return true; |
321 | 322 |
} |
322 | 323 |
catch (Exception ex) |
323 | 324 |
{ |
324 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
325 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
325 | 326 |
return false; |
326 | 327 |
} |
327 | 328 |
} |
... | ... | |
337 | 338 |
public bool DeleteAction(string AddSQLString, bool bConnect = true) |
338 | 339 |
{ |
339 | 340 |
// インターフェース |
340 |
string strcmd = "";
|
|
341 |
StringBuilder strcmd = new StringBuilder();
|
|
341 | 342 |
try |
342 | 343 |
{ |
343 |
strcmd = string.Format("{0}{1}", "DELETE FROM DepartmentExpensesMaster", AddSQLString);
|
|
344 |
strcmd.AppendFormat("{0}{1}", "DELETE FROM DepartmentExpensesMaster", AddSQLString);
|
|
344 | 345 |
|
345 |
if (!ExecuteNonQuery(strcmd, bConnect)) return false; |
|
346 |
if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
|
|
346 | 347 |
|
347 | 348 |
return true; |
348 | 349 |
} |
349 | 350 |
catch (Exception ex) |
350 | 351 |
{ |
351 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
352 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
352 | 353 |
return false; |
353 | 354 |
} |
354 | 355 |
} |
... | ... | |
434 | 435 |
public int SelectMaxCategoryHistoryCount(string AddSQLString, bool bConnect = true) |
435 | 436 |
{ |
436 | 437 |
// インターフェース |
437 |
string strcmd = "";
|
|
438 |
StringBuilder strcmd = new StringBuilder();
|
|
438 | 439 |
ArrayList arData = new ArrayList(); |
439 | 440 |
int iRet = 0; |
440 | 441 |
try |
441 | 442 |
{ |
442 | 443 |
// SQL作成 |
443 |
strcmd = "SELECT IFNULL(MAX(NameCode), 0) FROM DepartmentExpensesMaster" + AddSQLString;
|
|
444 |
strcmd.AppendFormat("SELECT IFNULL(MAX(NameCode), 0) FROM DepartmentExpensesMaster{0}", AddSQLString);
|
|
444 | 445 |
|
445 | 446 |
// SQL実行 |
446 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet; |
|
447 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
|
|
447 | 448 |
|
448 | 449 |
// データセット |
449 | 450 |
foreach (object[] objwrk in arData) |
... | ... | |
456 | 457 |
} |
457 | 458 |
catch (Exception ex) |
458 | 459 |
{ |
459 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
460 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
460 | 461 |
} |
461 | 462 |
|
462 | 463 |
return iRet; |
... | ... | |
471 | 472 |
/// <returns>Where文字列</returns> |
472 | 473 |
public string CreatePrimarykeyString(int DepartmentCode, int ExpensesPeriod = 0, int NameCode = 0) |
473 | 474 |
{ |
474 |
string strWork = string.Empty;
|
|
475 |
StringBuilder strWork = new StringBuilder();
|
|
475 | 476 |
try |
476 | 477 |
{ |
477 |
strWork = string.Format(" Where DepartmentCode = {0}", DepartmentCode);
|
|
478 |
strWork.AppendFormat(" Where DepartmentCode = {0}", DepartmentCode);
|
|
478 | 479 |
if (ExpensesPeriod != 0) |
479 |
strWork += string.Format(" And ExpensesPeriod = {0}", ExpensesPeriod);
|
|
480 |
strWork.AppendFormat(" And ExpensesPeriod = {0}", ExpensesPeriod);
|
|
480 | 481 |
if (NameCode != 0) |
481 |
strWork += string.Format(" And NameCode = {0}", NameCode);
|
|
482 |
strWork.AppendFormat(" And NameCode = {0}", NameCode);
|
|
482 | 483 |
} |
483 | 484 |
catch (Exception ex) |
484 | 485 |
{ |
485 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork); |
|
486 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
|
|
486 | 487 |
} |
487 | 488 |
|
488 |
return strWork; |
|
489 |
return strWork.ToString();
|
|
489 | 490 |
} |
490 | 491 |
#endregion |
491 | 492 |
} |
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMDivision.cs | ||
---|---|---|
64 | 64 |
/// <returns>true:成功 false:失敗</returns> |
65 | 65 |
private string CreateSelectSQL() |
66 | 66 |
{ |
67 |
string strcmd = "SELECT";
|
|
67 |
StringBuilder strcmd = new StringBuilder();
|
|
68 | 68 |
|
69 |
strcmd += " DivisionCode"; |
|
70 |
strcmd += ",NameCode"; |
|
71 |
strcmd += ",DisplayOrder"; |
|
72 |
strcmd += ",NameString"; |
|
73 |
strcmd += ",DeleteFlg"; |
|
69 |
strcmd.Append("SELECT"); |
|
70 |
strcmd.Append(" DivisionCode"); |
|
71 |
strcmd.Append(",NameCode"); |
|
72 |
strcmd.Append(",DisplayOrder"); |
|
73 |
strcmd.Append(",NameString"); |
|
74 |
strcmd.Append(",DeleteFlg"); |
|
74 | 75 |
|
75 |
strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
|
|
76 |
strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
|
|
77 |
strcmd += " FROM DivisionMaster";
|
|
76 |
strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
|
|
77 |
strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
|
|
78 |
strcmd.Append(" FROM DivisionMaster");
|
|
78 | 79 |
|
79 |
return strcmd; |
|
80 |
return strcmd.ToString();
|
|
80 | 81 |
} |
81 | 82 |
public bool SelectAction(string AddSQLString, ref List<DivisionMaster> data, bool bConnect = true) |
82 | 83 |
{ |
83 | 84 |
// インターフェース |
84 |
string strcmd = "";
|
|
85 |
StringBuilder strcmd = new StringBuilder();
|
|
85 | 86 |
ArrayList arData = new ArrayList(); |
86 | 87 |
|
87 | 88 |
try |
88 | 89 |
{ |
89 | 90 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
90 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
91 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
91 | 92 |
|
92 | 93 |
// SQL実行 |
93 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
94 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
94 | 95 |
|
95 | 96 |
// データセット |
96 | 97 |
foreach (object[] objwrk in arData) |
... | ... | |
104 | 105 |
} |
105 | 106 |
catch (Exception ex) |
106 | 107 |
{ |
107 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
108 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
108 | 109 |
return false; |
109 | 110 |
} |
110 | 111 |
|
... | ... | |
112 | 113 |
public bool SelectAction(string AddSQLString, ref DivisionMaster data, bool bConnect = true) |
113 | 114 |
{ |
114 | 115 |
// インターフェース |
115 |
string strcmd = "";
|
|
116 |
StringBuilder strcmd = new StringBuilder();
|
|
116 | 117 |
ArrayList arData = new ArrayList(); |
117 | 118 |
|
118 | 119 |
try |
119 | 120 |
{ |
120 | 121 |
// SQL作成(DateTime型が変換できないのでCharに変換しておく) |
121 |
strcmd = CreateSelectSQL() + AddSQLString;
|
|
122 |
strcmd.AppendFormat("{0}{1}", CreateSelectSQL(), AddSQLString);
|
|
122 | 123 |
|
123 | 124 |
// SQL実行 |
124 |
if (!ExecuteReader(strcmd, ref arData, bConnect)) return false; |
|
125 |
if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
|
|
125 | 126 |
if (arData.Count == 0) return false; |
126 | 127 |
|
127 | 128 |
// データセット |
... | ... | |
135 | 136 |
} |
136 | 137 |
catch (Exception ex) |
137 | 138 |
{ |
138 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd); |
|
139 |
logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
|
|
139 | 140 |
return false; |
140 | 141 |
} |
141 | 142 |
|
... | ... | |
148 | 149 |
/// <returns>true:成功 false:失敗</returns> |
149 | 150 |
public bool InsertAction(List<DivisionMaster> data, bool bConnect = true) |
150 | 151 |
{ |
151 |
string strcmd = "";
|
|
152 |
StringBuilder strcmd = new StringBuilder();
|
|
152 | 153 |
try |
153 | 154 |
{ |
154 | 155 |
bool bColFirst = true; |
155 |
strcmd = "INSERT INTO DivisionMaster"; |
|
156 |
strcmd += " ("; |
|
156 |
strcmd.Append("INSERT INTO DivisionMaster"); |
|
157 |
strcmd.Append(" ("); |
他の形式にエクスポート: Unified diff