プロジェクト

全般

プロフィール

リビジョン 199

堀内7年以上前に追加

StringBuilder化追加
請求入力画面デザイン変更
ビルドワーニング消去対策
起動権限チェック追加

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsChangeLedgerData.cs
185 185
        {
186 186
            try
187 187
            {
188
                string strSQL = string.Empty;
188
                StringBuilder strSQL = new StringBuilder();
189 189
                bool bRet = true;
190

  
191
                // 集計コード一覧作成
192
                // 対象データ取得
193
                List<int> GroupCodeList1 = new List<int>();
194
                List<int> GroupCodeList2 = new List<int>();
195
                List<int> GroupCodeList3 = new List<int>();
196
                List<int> GroupCodeList4 = new List<int>();
197
                SetGroupCodeList(ref GroupCodeList1, ref GroupCodeList2, ref GroupCodeList3, ref GroupCodeList4);
198

  
190 199
                foreach (int ConstrCode in ConstrCodeList)
191 200
                {
192 201
                    // 工事台帳実行データよりグループごとの合計金額を取得する
193
                    strSQL = "SELECT GROUPCOUNT, SUM(PAYMENTAMOUNT)";
194
                    strSQL += " FROM CONSTRUCTIONLEDGEREXCUTE";
195
                    strSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
196
                    strSQL += " GROUP BY GROUPCOUNT";
197
                    strSQL += " ORDER BY GROUPCOUNT";
202
                    strSQL.Append("SELECT GROUPCOUNT, SUM(PAYMENTAMOUNT)");
203
                    strSQL.Append(" FROM CONSTRUCTIONLEDGEREXCUTE");
204
                    strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
205
                    strSQL.Append(" GROUP BY GROUPCOUNT");
206
                    strSQL.Append(" ORDER BY GROUPCOUNT");
198 207

  
199 208
                    ArrayList InData = new ArrayList();
200
                    if (!LedgerExcuteDB.ExecuteReader(strSQL, ref InData, false)) continue;
209
                    if (!LedgerExcuteDB.ExecuteReader(strSQL.ToString(), ref InData, false)) continue;
201 210

  
202 211
                    // データ無は次のデータ
203 212
                    if (InData.Count == 0) continue;
204 213

  
205 214
                    // 対象データ取得
206
                    List<int> GroupCodeList = new List<int>();
207
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.Expenses);               // 1:経費
215
                    int Payment = CalcGetTotal(InData, GroupCodeList1);                             // ----- 支払額
208 216

  
209
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.ConstructionCosts);      // 2:施工
217
                    int PExpenses = CalcGetTotal(InData, GroupCodeList2);                           // ----- 人件
210 218

  
211
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.TransportationCosts);    // 3:交通費(通行料・電車代)
212
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.PurchaseCosts);          // 4:購入品
213
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.VehicleLeaseFee);        // 5:車両リース代
214
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.ParkingCosts);           // 6:駐車場・資材置き場
215
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.RoomChargeCosts);        // 7:宿泊費
219
                    int Allowance = CalcGetTotal(InData, GroupCodeList3);                           // ----- 給与
216 220

  
217
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.DisposeCosts);           // 8:処分費等
218
                    int Payment = CalcGetTotal(InData, GroupCodeList);                              // ----- 支払額
221
                    int Billing = CalcGetTotal(InData, GroupCodeList4);                             // ----- 請求額
219 222

  
220
                    GroupCodeList.Clear();
221
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.Instructor);             // 9:指導員給料行
222
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.Assistant);              // 10:副担当者給料行
223
                    int PExpenses = CalcGetTotal(InData, GroupCodeList);                            // ----- 人件費
224

  
225
                    GroupCodeList.Clear();
226
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.Payroll);                // 11:担当者給料行
227
                    int Allowance = CalcGetTotal(InData, GroupCodeList);                            // ----- 給与
228

  
229
                    GroupCodeList.Clear();
230
                    GroupCodeList.Add((int)FrmConstructionLedger.DataGroup.BillingAmount);          // 14:請求金額
231
                    int Billing = CalcGetTotal(InData, GroupCodeList);                              // ----- 請求額
232

  
233 223
                    // ----- 工事詳細台帳更新
234
                    strSQL = "UPDATE CONSTRUCTIONLEDGER SET";
235
                    strSQL += string.Format(" TOTALPAYMENT = {0}", Payment);
236
                    strSQL += string.Format(" , GROSSPROFIT = {0}", (Billing - Payment));
237
                    strSQL += string.Format(" , Allowance = {0}", Allowance);
238
                    strSQL += string.Format(" , NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
239
                    strSQL += string.Format(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
240
                    if (!LedgerExcuteDB.ExecuteNonQuery(strSQL, false))
224
                    strSQL.Clear();
225
                    strSQL.Append("UPDATE CONSTRUCTIONLEDGER SET");
226
                    strSQL.AppendFormat(" TOTALPAYMENT = {0}", Payment);
227
                    strSQL.AppendFormat(" , GROSSPROFIT = {0}", (Billing - Payment));
228
                    strSQL.AppendFormat(" , Allowance = {0}", Allowance);
229
                    strSQL.AppendFormat(" , NETPROFIT = {0}", (Billing - (Payment + Allowance + PExpenses)));
230
                    strSQL.AppendFormat(" WHERE CONSTRUCTIONCODE = {0}", ConstrCode);
231
                    if (!LedgerExcuteDB.ExecuteNonQuery(strSQL.ToString(), false))
241 232
                    {
242 233
                        bRet = false;
243 234
                        break;
......
253 244
        }
254 245
        #endregion
255 246

  
247
        #region 集計用コードセット
248
        /// <summary>
249
        /// 集計用コードセット
250
        /// </summary>
251
        private static void SetGroupCodeList(ref List<int> GroupCodeList1, ref List<int> GroupCodeList2,
252
                                                ref List<int> GroupCodeList3, ref List<int> GroupCodeList4)
253
        {
254
            try
255
            {
256
                // 対象データ取得
257
                // ----- 支払額コードセット
258
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.Expenses);               // 1:経費
259
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ConstructionCosts);      // 2:施工費
260
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.TransportationCosts);    // 3:交通費(通行料・電車代)
261
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.PurchaseCosts);          // 4:購入品
262
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.VehicleLeaseFee);        // 5:車両リース代
263
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.ParkingCosts);           // 6:駐車場・資材置き場
264
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.RoomChargeCosts);        // 7:宿泊費
265
                GroupCodeList1.Add((int)FrmConstructionLedger.DataGroup.DisposeCosts);           // 8:処分費等
266

  
267
                // ----- 人件費コードセット
268
                GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Instructor);             // 9:指導員給料行
269
                GroupCodeList2.Add((int)FrmConstructionLedger.DataGroup.Assistant);              // 10:副担当者給料行
270

  
271
                // ----- 給与コードセット
272
                GroupCodeList3.Add((int)FrmConstructionLedger.DataGroup.Payroll);                // 11:担当者給料行
273

  
274
                // ----- 請求額コードセット
275
                GroupCodeList4.Add((int)FrmConstructionLedger.DataGroup.BillingAmount);          // 14:請求金額
276
            }
277
            catch (System.Exception ex)
278
            {
279
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
280
            }
281
        }
282
        #endregion
283

  
256 284
        #region 配列リストより指定された合計を取得する
257 285
        /// <summary>
258 286
        /// 配列リストより指定された合計を取得する
......
996 1024
                StringBuilder strSQL = new StringBuilder();
997 1025
                bool bExists = true;
998 1026
                bool bRet = true;
1027
                List<int> ConstrCodeList = new List<int>();
1028

  
999 1029
                foreach (ConstructionLedgerExcute CurRec in EntryList)
1000 1030
                {
1001 1031
                    strSQL.Clear();
1002

  
1032
                    // キー作成
1003 1033
                    strSQL.AppendFormat(ExecDB.CreatePrimarykeyString(CurRec.ConstructionCode,
1004 1034
                                                                        CurRec.GroupCount,
1005 1035
                                                                        CurRec.LineCount,
......
1043 1073
                            break;
1044 1074
                        }
1045 1075
                    }
1076

  
1077
                    // 更新対象リストへの追加処理
1078
                    bool bAddFlg = true;
1079
                    foreach (int CurCode in ConstrCodeList)
1080
                    {
1081
                        // 既に追加済みかを探す
1082
                        if (CurCode == CurRec.ConstructionCode)
1083
                        {
1084
                            bAddFlg = false;
1085
                            break;
1086
                        }
1087
                    }
1088
                    if (bAddFlg)
1089
                    {   // 更新対象リストへ追加
1090
                        ConstrCodeList.Add(CurRec.ConstructionCode);
1091
                    }
1046 1092
                }
1047 1093

  
1094
                // 台帳再計算
1095
                if (!LedgerRecalculate(ExecDB, ConstrCodeList))
1096
                {
1097
                    bRet = false;
1098
                    ExecDB.rollback();
1099
                }
1100

  
1048 1101
                return bRet;
1049 1102
            }
1050 1103
            catch (System.Exception ex)
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
85 85
            MaterialEntrylList = 38,            // 38:資材選択一覧
86 86
            BillingEntrylList = 39,             // 39:請求選択一覧
87 87
            PurchaseStatusInput = 40,           // 40:注文書状況入力
88
            ReqBillingStatus = 41,              // 41:請求書状況入力
88
            ReqBillingStatus = 41,              // 41:請求書発給一覧
89 89
        }
90 90
        #endregion
91 91

  
......
191 191
                                                                                { (int)ProcessExecuteNo.MaterialEntrylList,     "資材データ一覧-表示"},
192 192
                                                                                { (int)ProcessExecuteNo.BillingEntrylList,      "請求データ一覧-表示"},
193 193
                                                                                { (int)ProcessExecuteNo.PurchaseStatusInput,    "注文書状況-入力"},
194
                                                                                { (int)ProcessExecuteNo.ReqBillingStatus,     "請求書状況-入力"},
194
                                                                                { (int)ProcessExecuteNo.ReqBillingStatus,       "請求書発給一覧-表示"},
195 195
        };
196 196

  
197 197
        #endregion
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMBusinessType.cs
53 53

  
54 54
        #endregion
55 55

  
56
        #region パブリックメソッド
56
        #region 業種マスタ検索
57 57
        /// <summary>
58 58
        /// 業種マスタ検索
59 59
        /// </summary>
......
63 63
        public bool SelectAction(string AddSQLString, ref List<BusinessTypeMaster> data, bool bConnect = true)
64 64
        {
65 65
            // インターフェース
66
            string strcmd = "";
66
            StringBuilder strcmd = new StringBuilder();
67 67
            ArrayList arData = new ArrayList();
68 68

  
69 69
            try
70 70
            {
71 71
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
72
                strcmd = "SELECT";
73
                strcmd += " BusinessTypeCode, DisplayOrder, BusinessTypeName";
74
                strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
75
                strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
76
                strcmd += " FROM BusinessTypeMaster";
77
                strcmd += AddSQLString;
72
                strcmd.Append("SELECT");
73
                strcmd.Append(" BusinessTypeCode, DisplayOrder, BusinessTypeName");
74
                strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
75
                strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
76
                strcmd.Append(" FROM BusinessTypeMaster");
77
                strcmd.Append(AddSQLString);
78 78

  
79 79
                // SQL実行
80
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
80
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
81 81

  
82 82
                // データセット
83 83
                foreach (object[] objwrk in arData)
......
91 91
            }
92 92
            catch (Exception ex)
93 93
            {
94
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
94
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
95 95
                return false;
96 96
            }
97 97

  
98 98
        }
99
        #endregion
99 100

  
101
        #region 業種マスタ追加(複数件)
100 102
        /// <summary>
101 103
        /// 業種マスタ追加(複数件)
102 104
        /// </summary>
......
104 106
        /// <returns>true:成功 false:失敗</returns>
105 107
        public bool InsertAction(List<BusinessTypeMaster> data, bool bConnect = true)
106 108
        {
107
            string strcmd = "";
109
            StringBuilder strcmd = new StringBuilder();
108 110
            try
109 111
            {
110 112

  
111 113
                bool bColFirst = true;
112
                strcmd = "INSERT INTO BusinessTypeMaster";
113
                strcmd += " (";
114
                strcmd.Append("INSERT INTO BusinessTypeMaster");
115
                strcmd.Append(" (");
114 116
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
115 117
                {
116
                    if (!bColFirst) strcmd += ", ";
117
                    strcmd += gender.ToString();
118
                    if (!bColFirst) strcmd.Append(", ");
119
                    strcmd.Append(gender.ToString());
118 120
                    bColFirst = false;
119 121
                }
120
                strcmd += ") VALUES";
122
                strcmd.Append(") VALUES");
121 123

  
122 124
                bool bDataFirst = true;
123 125
                foreach (BusinessTypeMaster work in data)
124 126
                {
125
                    if (bDataFirst) strcmd += " (";
126
                    else strcmd += ", (";
127
                    if (bDataFirst) strcmd.Append(" (");
128
                    else strcmd.Append(", (");
127 129

  
128
                    strcmd += string.Format("  {0}", work.BusinessTypeCode.ToString());
129
                    strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
130
                    strcmd += string.Format(", '{0}'", work.BusinessTypeName);
130
                    strcmd.AppendFormat("  {0}", work.BusinessTypeCode.ToString());
131
                    strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
132
                    strcmd.AppendFormat(", '{0}'", work.BusinessTypeName);
131 133

  
132
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
133
                    strcmd += string.Format(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
134
                    strcmd += ")";
134
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
135
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
136
                    strcmd.Append(")");
135 137

  
136 138
                    bDataFirst = false;
137 139
                }
138 140

  
139
                if (!ExecuteNonQuery(strcmd, false)) return false;
141
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
140 142

  
141 143
                return true;
142 144
            }
143 145
            catch (Exception ex)
144 146
            {
145
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
147
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
146 148
                return false;
147 149
            }
148 150
        }
151
        #endregion
149 152

  
153
        #region 業種マスタ更新
150 154
        /// <summary>
151 155
        /// 業種マスタ更新
152 156
        /// </summary>
......
155 159
        /// <returns>true:成功 false:失敗</returns>
156 160
        public bool UpdateAction(string AddSQLString, BusinessTypeMaster data, bool bConnect = true)
157 161
        {
158
            string strcmd = "";
162
            StringBuilder strcmd = new StringBuilder();
159 163
            try
160 164
            {
161 165

  
162
                strcmd = "UPDATE BusinessTypeMaster";
166
                strcmd.Append("UPDATE BusinessTypeMaster");
163 167

  
164
                strcmd += " SET";
168
                strcmd.Append(" SET");
165 169

  
166
                strcmd += string.Format(" BusinessTypeCode = {0}", data.BusinessTypeCode.ToString());
167
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
168
                strcmd += string.Format(",BusinessTypeName = '{0}'", data.BusinessTypeName);
170
                strcmd.AppendFormat(" BusinessTypeCode = {0}", data.BusinessTypeCode.ToString());
171
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
172
                strcmd.AppendFormat(",BusinessTypeName = '{0}'", data.BusinessTypeName);
169 173

  
170
                strcmd += ", UpdateDate = NOW()";
171
                strcmd += AddSQLString;
174
                strcmd.Append(", UpdateDate = NOW()");
175
                strcmd.Append(AddSQLString);
172 176

  
173
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
177
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
174 178

  
175 179
                return true;
176 180
            }
177 181
            catch (Exception ex)
178 182
            {
179
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
183
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
180 184
                return false;
181 185
            }
182 186
        }
187
        #endregion
183 188

  
184

  
189
        #region 業種マスタ削除
185 190
        /// <summary>
186 191
        /// 業種マスタ削除
187 192
        /// </summary>
......
191 196
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
192 197
        {
193 198
            // インターフェース
194
            string strcmd = "";
199
            StringBuilder strcmd = new StringBuilder();
195 200
            try
196 201
            {
197
                strcmd = string.Format("{0}{1}", "DELETE FROM BusinessTypeMaster", AddSQLString);
202
                strcmd.AppendFormat("{0}{1}", "DELETE FROM BusinessTypeMaster", AddSQLString);
198 203

  
199
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
204
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
200 205

  
201 206
                return true;
202 207
            }
203 208
            catch (Exception ex)
204 209
            {
205
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
210
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
206 211
                return false;
207 212
            }
208 213
        }
214
        #endregion
209 215

  
216
        #region OracleDataReaderより構造体へセットする
210 217
        /// <summary>
211 218
        /// OracleDataReaderより構造体へセットする
212 219
        /// </summary>
......
233 240
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
234 241
            }
235 242
        }
236

  
237 243
        #endregion
238 244

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

  
245
        #region 主キー検索の文字列を返す
241 246
        /// <summary>
242 247
        /// 主キー検索の文字列を返す
243 248
        /// </summary>
......
245 250
        /// <returns>Where文字列</returns>
246 251
        public string CreatePrimarykeyString(int BusinessTypeCode)
247 252
        {
248
            string strWork = string.Empty;
253
            StringBuilder strWork = new StringBuilder();
249 254
            try
250 255
            {
251
                strWork = string.Format(" Where BusinessTypeCode = {0}", BusinessTypeCode);
256
                strWork.AppendFormat(" Where BusinessTypeCode = {0}", BusinessTypeCode);
252 257

  
253 258
            }
254 259
            catch (Exception ex)
......
256 261
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
257 262
            }
258 263

  
259
            return strWork;
264
            return strWork.ToString();
260 265
        }
266
        #endregion
261 267

  
268
        #region 主キー検索の文字列を返す
262 269
        /// <summary>
263 270
        /// 最大値を取得する
264 271
        /// </summary>
......
268 275
        public int SelectMaxBusinessTypeKeyCount(string AddSQLString, bool bConnect = true)
269 276
        {
270 277
            // インターフェース
271
            string strcmd = "";
278
            StringBuilder strcmd = new StringBuilder();
272 279
            ArrayList arData = new ArrayList();
273 280
            int iRet = 0;
274 281
            try
275 282
            {
276 283
                // SQL作成
277
                strcmd = "SELECT IFNULL(MAX(BusinessTypeCode), 0) FROM BusinessTypeMaster" + AddSQLString;
284
                strcmd.AppendFormat("SELECT IFNULL(MAX(BusinessTypeCode), 0) FROM BusinessTypeMaster", AddSQLString);
278 285

  
279 286
                // SQL実行
280
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet;
287
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
281 288

  
282 289
                // データセット
283 290
                foreach (object[] objwrk in arData)
......
290 297
            }
291 298
            catch (Exception ex)
292 299
            {
293
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
300
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
294 301
            }
295 302

  
296 303
            return iRet;
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMCategoryName.cs
55 55

  
56 56
        #endregion
57 57

  
58
        #region パブリックメソッド
58
        #region カテゴリ名称マスタ検索
59 59
        /// <summary>
60 60
        /// カテゴリ名称マスタ検索
61 61
        /// </summary>
......
65 65
        public bool SelectAction(string AddSQLString, ref List<CategoryNameMaster> data, bool bConnect = true)
66 66
        {
67 67
            // インターフェース
68
            string strcmd = "";
68
            StringBuilder strcmd = new StringBuilder();
69 69
            ArrayList arData = new ArrayList();
70 70

  
71 71
            try
72 72
            {
73 73
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
74
                strcmd = "SELECT";
74
                strcmd.Append("SELECT");
75 75

  
76
                strcmd += "  NameCode";
77
                strcmd += " ,CategoryCode";
78
                strcmd += " ,DisplayOrder";
79
                strcmd += " ,CategoryName";
80
                strcmd += " ,DeleteFlg";
76
                strcmd.Append("  NameCode");
77
                strcmd.Append(" ,CategoryCode");
78
                strcmd.Append(" ,DisplayOrder");
79
                strcmd.Append(" ,CategoryName");
80
                strcmd.Append(" ,DeleteFlg");
81 81

  
82
                strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
83
                strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
84
                strcmd += " FROM CategoryNameMaster";
85
                strcmd += AddSQLString;
82
                strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
83
                strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
84
                strcmd.Append(" FROM CategoryNameMaster");
85
                strcmd.Append(AddSQLString);
86 86

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

  
90 90
                // データセット
91 91
                foreach (object[] objwrk in arData)
......
104 104
            }
105 105

  
106 106
        }
107
        #endregion
107 108

  
109
        #region カテゴリ名称マスタ追加
108 110
        /// <summary>
109 111
        /// カテゴリ名称マスタ追加
110 112
        /// </summary>
......
112 114
        /// <returns>true:成功 false:失敗</returns>
113 115
        public bool InsertAction(List<CategoryNameMaster> data, bool bConnect = true)
114 116
        {
115
            string strcmd = "";
117
            StringBuilder strcmd = new StringBuilder();
116 118
            try
117 119
            {
118 120

  
119 121
                foreach (CategoryNameMaster work in data)
120 122
                {
121
                    strcmd = "INSERT INTO CategoryNameMaster";
123
                    strcmd.Append("INSERT INTO CategoryNameMaster");
122 124

  
123
                    strcmd += " VALUES (";
125
                    strcmd.Append(" VALUES (");
124 126

  
125
                    strcmd += string.Format("  {0}", work.NameCode.ToString());
126
                    strcmd += string.Format(", {0}", work.CategoryCode.ToString());
127
                    strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
128
                    strcmd += string.Format(",'{0}'", work.CategoryName.ToString());
129
                    strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
127
                    strcmd.AppendFormat("  {0}", work.NameCode.ToString());
128
                    strcmd.AppendFormat(", {0}", work.CategoryCode.ToString());
129
                    strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
130
                    strcmd.AppendFormat(",'{0}'", work.CategoryName.ToString());
131
                    strcmd.AppendFormat(", {0}", work.DeleteFlg.ToString());
130 132

  
131
                    strcmd += ", NOW()";
132
                    strcmd += ", NOW()";
133
                    strcmd += ")";
133
                    strcmd.Append(", NOW()");
134
                    strcmd.Append(", NOW()");
135
                    strcmd.Append(")");
134 136

  
135
                    if (!ExecuteNonQuery(strcmd, bConnect)) return false;
137
                    if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
136 138
                }
137 139
                return true;
138 140
            }
......
142 144
                return false;
143 145
            }
144 146
        }
147
        #endregion
145 148

  
149
        #region カテゴリ名称マスタ更新
146 150
        /// <summary>
147 151
        /// カテゴリ名称マスタ更新
148 152
        /// </summary>
......
151 155
        /// <returns>true:成功 false:失敗</returns>
152 156
        public bool UpdateAction(string AddSQLString, CategoryNameMaster data, bool bConnect = true)
153 157
        {
154
            string strcmd = "";
158
            StringBuilder strcmd = new StringBuilder();
155 159
            try
156 160
            {
157 161

  
158
                strcmd = "UPDATE CategoryNameMaster";
162
                strcmd.Append("UPDATE CategoryNameMaster");
159 163

  
160
                strcmd += " SET";
164
                strcmd.Append(" SET");
161 165

  
162
                strcmd += string.Format(" NameCode = {0}", data.NameCode.ToString());
163
                strcmd += string.Format(",CategoryCode = {0}", data.CategoryCode.ToString());
164
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
165
                strcmd += string.Format(",CategoryName ='{0}'", data.CategoryName.ToString());
166
                strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg.ToString());
166
                strcmd.AppendFormat(" NameCode = {0}", data.NameCode.ToString());
167
                strcmd.AppendFormat(",CategoryCode = {0}", data.CategoryCode.ToString());
168
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
169
                strcmd.AppendFormat(",CategoryName ='{0}'", data.CategoryName.ToString());
170
                strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg.ToString());
167 171

  
168
                strcmd += ", UpdateDate = NOW()";
169
                strcmd += AddSQLString;
172
                strcmd.Append(", UpdateDate = NOW()");
173
                strcmd.Append(AddSQLString);
170 174

  
171
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
175
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
172 176

  
173 177
                return true;
174 178
            }
......
178 182
                return false;
179 183
            }
180 184
        }
185
        #endregion
181 186

  
182

  
187
        #region カテゴリ名称マスタ削除
183 188
        /// <summary>
184 189
        /// カテゴリ名称マスタ削除
185 190
        /// </summary>
......
189 194
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
190 195
        {
191 196
            // インターフェース
192
            string strcmd = "";
197
            StringBuilder strcmd = new StringBuilder();
193 198
            try
194 199
            {
195
                strcmd = string.Format("{0}{1}", "DELETE FROM CategoryNameMaster", AddSQLString);
200
                strcmd.AppendFormat("{0}{1}", "DELETE FROM CategoryNameMaster", AddSQLString);
196 201

  
197
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
202
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
198 203

  
199 204
                return true;
200 205
            }
......
204 209
                return false;
205 210
            }
206 211
        }
212
        #endregion
207 213

  
214
        #region 論理削除
208 215
        /// <summary>
209 216
        /// 論理削除
210 217
        /// </summary>
......
240 247
                return false;
241 248
            }
242 249
        }
250
        #endregion
251

  
252
        #region OracleDataReaderより構造体へセットする
243 253
        /// <summary>
244 254
        /// OracleDataReaderより構造体へセットする
245 255
        /// </summary>
......
271 281

  
272 282
        #endregion
273 283

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

  
284
        #region カテゴリ履歴の最大値を取得する
276 285
        /// <summary>
277 286
        /// カテゴリ履歴の最大値を取得する
278 287
        /// </summary>
......
282 291
        public int SelectMaxCategoryHistoryCount(string AddSQLString, bool bConnect = true)
283 292
        {
284 293
            // インターフェース
285
            string strcmd = "";
294
            StringBuilder strcmd = new StringBuilder();
286 295
            ArrayList arData = new ArrayList();
287 296
            int iRet = 0;
288 297
            try
289 298
            {
290 299
                // SQL作成
291
                strcmd = "SELECT MAX(CategoryCode) FROM CategoryNameMaster" + AddSQLString;
300
                strcmd.AppendFormat("SELECT MAX(CategoryCode) FROM CategoryNameMaster{0}", AddSQLString);
292 301

  
293 302
                // SQL実行
294
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet;
303
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
295 304

  
296 305
                // データセット
297 306
                foreach (object[] objwrk in arData)
......
304 313
            }
305 314
            catch (Exception ex)
306 315
            {
307
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
316
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
308 317
            }
309 318

  
310 319
            return iRet;
311 320
        }
321
        #endregion
312 322

  
323
        #region 主キー検索の文字列を返す
313 324
        /// <summary>
314 325
        /// 主キー検索の文字列を返す
315 326
        /// </summary>
......
318 329
        /// <returns>Where文字列</returns>
319 330
        public string CreatePrimarykeyString(int NameCode, int CategoryCode = 0)
320 331
        {
321
            string strWork = string.Empty;
332
            StringBuilder strWork = new StringBuilder();
322 333
            try
323 334
            {
324
                strWork = string.Format(" Where NameCode = {0}", NameCode);
335
                strWork.AppendFormat(" Where NameCode = {0}", NameCode);
325 336

  
326 337
                if (CategoryCode != 0)
327 338
                {
328
                    strWork += string.Format(" And CategoryCode = {0}", CategoryCode);
339
                    strWork.AppendFormat(" And CategoryCode = {0}", CategoryCode);
329 340
                }
330 341
            }
331 342
            catch (Exception ex)
332 343
            {
333
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
344
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
334 345
            }
335 346

  
336
            return strWork;
347
            return strWork.ToString();
337 348
        }
338 349
        #endregion
339 350
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMCommonCostLarge.cs
55 55

  
56 56
        #endregion
57 57

  
58
        #region パブリックメソッド
58
        #region 共通費大項目マスタ検索SQL作成
59 59
        /// <summary>
60 60
        /// 共通費大項目マスタ検索
61 61
        /// </summary>
......
65 65
        private string CreateSelectSQL()
66 66
        {
67 67
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
68
            string strcmd = "SELECT";
69
            strcmd += "  LargeCode";
70
            strcmd += " ,DisplayOrder";
71
            strcmd += " ,LargeName";
72
            strcmd += " ,CommentText";
73
            strcmd += " ,DeleteFlg";
74
            strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
75
            strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
76
            strcmd += " FROM CommonCostLarge";
68
            StringBuilder strcmd = new StringBuilder();
69
            strcmd.Append("SELECT");
70
            strcmd.Append("  LargeCode");
71
            strcmd.Append(" ,DisplayOrder");
72
            strcmd.Append(" ,LargeName");
73
            strcmd.Append(" ,CommentText");
74
            strcmd.Append(" ,DeleteFlg");
75
            strcmd.Append(" ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
76
            strcmd.Append(" ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
77
            strcmd.Append(" FROM CommonCostLarge");
77 78

  
78
            return strcmd;
79
            return strcmd.ToString();
79 80
        }
81
        #endregion
82

  
83
        #region 共通費大項目マスタ検索(複数)
84
        /// <summary>
85
        /// 共通費大項目マスタ検索(複数)
86
        /// </summary>
80 87
        public bool SelectAction(string AddSQLString, ref List<CommonCostLarge> data, bool bConnect = true)
81 88
        {
82 89
            // インターフェース
83
            string strcmd = "";
90
            StringBuilder strcmd = new StringBuilder();
84 91
            ArrayList arData = new ArrayList();
85 92

  
86 93
            try
87 94
            {
88
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
89
                strcmd = CreateSelectSQL() + AddSQLString;
95
                // SQL作成
96
                strcmd.Append(CreateSelectSQL());
97
                strcmd.Append(AddSQLString);
90 98

  
91 99
                // SQL実行
92
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
100
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
93 101

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

  
110 118
        }
119
        #endregion
120

  
121
        #region 共通費大項目マスタ検索(1件)
122
        /// <summary>
123
        /// 共通費大項目マスタ検索(1件)
124
        /// </summary>
125
        /// <param name="AddSQLString"></param>
126
        /// <param name="data"></param>
127
        /// <param name="bConnect"></param>
128
        /// <returns></returns>
111 129
        public bool SelectAction(string AddSQLString, ref CommonCostLarge data, bool bConnect = true)
112 130
        {
113 131
            // インターフェース
114
            string strcmd = "";
132
            StringBuilder strcmd = new StringBuilder();
115 133
            ArrayList arData = new ArrayList();
116 134

  
117 135
            try
118 136
            {
119 137
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
120
                strcmd = CreateSelectSQL() + AddSQLString;
138
                strcmd.Append(CreateSelectSQL());
139
                strcmd.Append(AddSQLString);
121 140

  
122 141
                // SQL実行
123
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
142
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
124 143
                if (arData.Count == 0) return false;
125 144

  
126 145
                // データセット
......
134 153
            }
135 154
            catch (Exception ex)
136 155
            {
137
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
156
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
138 157
                return false;
139 158
            }
140 159

  
141 160
        }
161
        #endregion
142 162

  
163
        #region 共通費大項目マスタ追加(複数件)
143 164
        /// <summary>
144 165
        /// 共通費大項目マスタ追加(複数件)
145 166
        /// </summary>
......
147 168
        /// <returns>true:成功 false:失敗</returns>
148 169
        public bool InsertAction(List<CommonCostLarge> data, bool bConnect = true)
149 170
        {
150
            string strcmd = "";
171
            StringBuilder strcmd = new StringBuilder();
151 172
            try
152 173
            {
153 174
                bool bColFirst = true;
154
                strcmd = "INSERT INTO CommonCostLarge";
155
                strcmd += " (";
175
                strcmd.Append("INSERT INTO CommonCostLarge");
176
                strcmd.Append(" (");
156 177
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
157 178
                {
158
                    if (!bColFirst) strcmd += ", ";
159
                    strcmd += gender.ToString();
179
                    if (!bColFirst) strcmd.Append(", ");
180
                    strcmd.Append(gender.ToString());
160 181
                    bColFirst = false;
161 182
                }
162
                strcmd += ") VALUES";
183
                strcmd.Append(") VALUES");
163 184

  
164 185
                bool bDataFirst = true;
165 186
                foreach (CommonCostLarge work in data)
166 187
                {
167
                    if (bDataFirst) strcmd += " (";
168
                    else strcmd += ", (";
188
                    if (bDataFirst) strcmd.Append(" (");
189
                    else strcmd.Append(", (");
169 190

  
170
                    strcmd += string.Format("  {0}", work.LargeCode.ToString());
171
                    strcmd += string.Format(", {0}", work.DisplayOrder.ToString());
172
                    strcmd += string.Format(", '{0}'", work.LargeName);
173
                    strcmd += string.Format(", '{0}'", work.CommentText);
174
                    strcmd += string.Format(", {0}", work.DeleteFlg.ToString());
191
                    strcmd.AppendFormat("  {0}", work.LargeCode.ToString());
192
                    strcmd.AppendFormat(", {0}", work.DisplayOrder.ToString());
193
                    strcmd.AppendFormat(", '{0}'", work.LargeName);
194
                    strcmd.AppendFormat(", '{0}'", work.CommentText);
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 201
                    bDataFirst = false;
181 202
                }
182 203

  
183
                if (!ExecuteNonQuery(strcmd, false)) return false;
204
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
184 205

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

  
216
        #region 共通費大項目マスタ更新
194 217
        /// <summary>
195 218
        /// 共通費大項目マスタ更新
196 219
        /// </summary>
......
199 222
        /// <returns>true:成功 false:失敗</returns>
200 223
        public bool UpdateAction(string AddSQLString, CommonCostLarge data, bool bConnect = true)
201 224
        {
202
            string strcmd = "";
225
            StringBuilder strcmd = new StringBuilder();
203 226
            try
204 227
            {
205 228

  
206
                strcmd = "UPDATE CommonCostLarge";
229
                strcmd.Append("UPDATE CommonCostLarge");
207 230

  
208
                strcmd += " SET";
231
                strcmd.Append(" SET");
209 232

  
210
                strcmd += string.Format(" LargeCode = {0}", data.LargeCode.ToString());
211
                strcmd += string.Format(",DisplayOrder = {0}", data.DisplayOrder.ToString());
212
                strcmd += string.Format(",LargeName = '{0}'", data.LargeName);
213
                strcmd += string.Format(",CommentText = '{0}'", data.CommentText);
214
                strcmd += string.Format(",DeleteFlg = {0}", data.DeleteFlg.ToString());
233
                strcmd.AppendFormat(" LargeCode = {0}", data.LargeCode.ToString());
234
                strcmd.AppendFormat(",DisplayOrder = {0}", data.DisplayOrder.ToString());
235
                strcmd.AppendFormat(",LargeName = '{0}'", data.LargeName);
236
                strcmd.AppendFormat(",CommentText = '{0}'", data.CommentText);
237
                strcmd.AppendFormat(",DeleteFlg = {0}", data.DeleteFlg.ToString());
215 238

  
216
                strcmd += ", UpdateDate = NOW()";
217
                strcmd += AddSQLString;
239
                strcmd.Append(", UpdateDate = NOW()");
240
                strcmd.Append(AddSQLString);
218 241

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

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

  
230

  
254
        #region 共通費大項目マスタ削除
231 255
        /// <summary>
232 256
        /// 共通費大項目マスタ削除
233 257
        /// </summary>
......
237 261
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
238 262
        {
239 263
            // インターフェース
240
            string strcmd = "";
264
            StringBuilder strcmd = new StringBuilder();
241 265
            try
242 266
            {
243
                strcmd = string.Format("{0}{1}", "DELETE FROM CommonCostLarge", AddSQLString);
267
                strcmd.AppendFormat("{0}{1}", "DELETE FROM CommonCostLarge", AddSQLString);
244 268

  
245
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
269
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
246 270

  
247 271
                return true;
248 272
            }
249 273
            catch (Exception ex)
250 274
            {
251
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
275
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
252 276
                return false;
253 277
            }
254 278
        }
279
        #endregion
255 280

  
281
        #region 論理削除
256 282
        /// <summary>
257 283
        /// 論理削除
258 284
        /// </summary>
......
289 315
                return false;
290 316
            }
291 317
        }
318
        #endregion
319

  
320
        #region OracleDataReaderより構造体へセットする
292 321
        /// <summary>
293 322
        /// OracleDataReaderより構造体へセットする
294 323
        /// </summary>
......
317 346
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
318 347
            }
319 348
        }
320

  
321 349
        #endregion
322 350

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

  
351
        #region 最大値を取得する
325 352
        /// <summary>
326 353
        /// 最大値を取得する
327 354
        /// </summary>
......
331 358
        public int SelectMaxCommonCostLargeCount(string AddSQLString, bool bConnect = true)
332 359
        {
333 360
            // インターフェース
334
            string strcmd = "";
361
            StringBuilder strcmd = new StringBuilder();
335 362
            ArrayList arData = new ArrayList();
336 363
            int iRet = 0;
337 364
            try
338 365
            {
339 366
                // SQL作成
340
                strcmd = "SELECT IFNULL(MAX(LargeCode), 0) FROM CommonCostLarge" + AddSQLString;
367
                strcmd.AppendFormat("SELECT IFNULL(MAX(LargeCode), 0) FROM CommonCostLarge", AddSQLString);
341 368

  
342 369
                // SQL実行
343
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return iRet;
370
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
344 371

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

  
359 386
            return iRet;
360 387
        }
388
        #endregion
361 389

  
390
        #region 主キー検索の文字列を返す
362 391
        /// <summary>
363 392
        /// 主キー検索の文字列を返す
364 393
        /// </summary>
......
366 395
        /// <returns>Where文字列</returns>
367 396
        public string CreatePrimarykeyString(int CommonCostLargeCode)
368 397
        {
369
            string strWork = "";
398
            StringBuilder strWork = new StringBuilder();
370 399
            try
371 400
            {
372
                strWork = string.Format(" Where LargeCode = {0}", CommonCostLargeCode);
401
                strWork.AppendFormat(" Where LargeCode = {0}", CommonCostLargeCode);
373 402
            }
374 403
            catch (Exception ex)
375 404
            {
376
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork);
405
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
377 406
            }
378 407

  
379
            return strWork;
408
            return strWork.ToString();
380 409
        }
381 410
        #endregion
382 411
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMCommonCostLinkMS.cs
53 53

  
54 54
        #endregion
55 55

  
56
        #region 検索処理
56
        #region 共通費工種関連マスタ検索SQL作成
57 57
        /// <summary>
58 58
        /// 共通費工種関連マスタ検索
59 59
        /// </summary>
......
63 63
        private string CreateSelectSQL()
64 64
        {
65 65
            // SQL作成(DateTime型が変換できないのでCharに変換しておく)
66
            string strcmd = "SELECT";
67
            strcmd += "  LargeCode";
68
            strcmd += " ,MiddleCode";
69
            strcmd += " ,ItemCode";
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 CommonCostLinkMS";
66
            StringBuilder strcmd = new StringBuilder();
67
            strcmd.Append("SELECT");
68
            strcmd.Append("  LargeCode");
69
            strcmd.Append(" ,MiddleCode");
70
            strcmd.Append(" ,ItemCode");
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 CommonCostLinkMS");
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<CommonCostLinkMS> 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.Append(CreateSelectSQL());
97
                strcmd.Append(AddSQLString);
86 98

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

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

  
106 118
        }
119
        #endregion
120

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

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

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

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

  
......
146 169
        /// <returns>true:成功 false:失敗</returns>
147 170
        public bool InsertAction(CommonCostLinkMS work, bool bConnect = true)
148 171
        {
149
            string strcmd = "";
172
            StringBuilder strcmd = new StringBuilder();
150 173
            try
151 174
            {
152 175
                bool bColFirst = true;
153
                strcmd = "INSERT INTO CommonCostLinkMS";
154
                strcmd += " (";
176
                strcmd.Append("INSERT INTO CommonCostLinkMS");
177
                strcmd.Append(" (");
155 178
                foreach (var gender in Enum.GetValues(typeof(NameColumn)))
156 179
                {
157
                    if (!bColFirst) strcmd += ", ";
158
                    strcmd += gender.ToString();
180
                    if (!bColFirst) strcmd.Append(", ");
181
                    strcmd.Append(gender.ToString());
159 182
                    bColFirst = false;
160 183
                }
161
                strcmd += ") VALUES (";
184
                strcmd.Append(") VALUES (");
162 185

  
163
                strcmd += string.Format("  {0}", work.LargeCode.ToString());
164
                strcmd += string.Format(", {0}", work.MiddleCode.ToString());
165
                strcmd += string.Format(", {0}", work.ItemCode.ToString());
186
                strcmd.AppendFormat("  {0}", work.LargeCode.ToString());
187
                strcmd.AppendFormat(", {0}", work.MiddleCode.ToString());
188
                strcmd.AppendFormat(", {0}", work.ItemCode.ToString());
166 189

  
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 += ")";
190
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
191
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
192
                strcmd.Append(")");
170 193

  
171
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
194
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
172 195

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

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

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

  
208
                    strcmd += string.Format("  {0}", work.LargeCode.ToString());
209
                    strcmd += string.Format(", {0}", work.MiddleCode.ToString());
210
                    strcmd += string.Format(", {0}", work.ItemCode.ToString());
234
                    strcmd.AppendFormat("  {0}", work.LargeCode.ToString());
235
                    strcmd.AppendFormat(", {0}", work.MiddleCode.ToString());
236
                    strcmd.AppendFormat(", {0}", work.ItemCode.ToString());
211 237

  
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 += ")";
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(")");
215 241

  
216 242
                    bDataFirst = false;
217 243
                }
218 244

  
219
                if (!ExecuteNonQuery(strcmd, false)) return false;
245
                if (!ExecuteNonQuery(strcmd.ToString(), false)) return false;
220 246

  
221 247
                return true;
222 248
            }
223 249
            catch (Exception ex)
224 250
            {
225
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
251
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
226 252
                return false;
227 253
            }
228 254
        }
......
237 263
        /// <returns>true:成功 false:失敗</returns>
238 264
        public bool UpdateAction(string AddSQLString, CommonCostLinkMS data, bool bConnect = true)
239 265
        {
240
            string strcmd = "";
266
            StringBuilder strcmd = new StringBuilder();
241 267
            try
242 268
            {
243 269

  
244
                strcmd = "UPDATE CommonCostLinkMS";
270
                strcmd.Append("UPDATE CommonCostLinkMS");
245 271

  
246
                strcmd += " SET";
272
                strcmd.Append(" SET");
247 273

  
248
                strcmd += string.Format(" ComponentCode = {0}", data.LargeCode.ToString());
249
                strcmd += string.Format(",MiddleCode = {0}", data.MiddleCode.ToString());
250
                strcmd += string.Format(",ItemCode = {0}", data.ItemCode.ToString());
274
                strcmd.AppendFormat(" ComponentCode = {0}", data.LargeCode.ToString());
275
                strcmd.AppendFormat(",MiddleCode = {0}", data.MiddleCode.ToString());
276
                strcmd.AppendFormat(",ItemCode = {0}", data.ItemCode.ToString());
251 277

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

  
255
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
281
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
256 282

  
257 283
                return true;
258 284
            }
259 285
            catch (Exception ex)
260 286
            {
261
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
287
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
262 288
                return false;
263 289
            }
264 290
        }
......
274 300
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
275 301
        {
276 302
            // インターフェース
277
            string strcmd = "";
303
            StringBuilder strcmd = new StringBuilder();
278 304
            try
279 305
            {
280
                strcmd = string.Format("{0}{1}", "DELETE FROM CommonCostLinkMS", AddSQLString);
306
                strcmd.AppendFormat("{0}{1}", "DELETE FROM CommonCostLinkMS", AddSQLString);
281 307

  
282
                if (!ExecuteNonQuery(strcmd, bConnect)) return false;
308
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
283 309

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

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

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

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

  
384
            return strWork;
410
            return strWork.ToString();
385 411
        }
386 412
        #endregion
387 413
    }
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOMaterialRecordInfo.cs
66 66
        public bool SelectAction(string AddSQLString, ref List<MaterialRecordInfo> data, bool bConnect = true)
67 67
        {
68 68
            // インターフェース
69
            string strcmd = "";
69
            StringBuilder strcmd = new StringBuilder();
70 70
            ArrayList arData = new ArrayList();
71 71

  
72 72
            try
73 73
            {
74 74
                // SQL作成(DateTime型が変換できないのでCharに変換しておく)
75
                strcmd = "SELECT";
76
                strcmd += " MaterialItemCode,DATE_FORMAT(ProcessDate, '%Y/%m/%d %H:%i:%s'),SeqNo,RecKind,ConstructionCode,PersonCode,MaterialCount,DATE_FORMAT(RepayPlanDate, '%Y/%m/%d %H:%i:%s'),CommentText";
77
                strcmd += " ,DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')";
78
                strcmd += " ,DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')";
79
                strcmd += " FROM MaterialRecordInfo";
80
                strcmd += AddSQLString;
75
                strcmd.Append("SELECT");
76
                strcmd.Append("MaterialItemCode,DATE_FORMAT(ProcessDate, '%Y/%m/%d %H:%i:%s'),SeqNo,RecKind,ConstructionCode,PersonCode,MaterialCount,DATE_FORMAT(RepayPlanDate, '%Y/%m/%d %H:%i:%s'),CommentText");
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 MaterialRecordInfo");
80
                strcmd.Append(AddSQLString);
81 81

  
82 82
                // SQL実行
83
                if (!ExecuteReader(strcmd, ref arData, bConnect)) return false;
83
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
84 84

  
85 85
                // データセット
86 86
                foreach (object[] objwrk in arData)
......
94 94
            }
95 95
            catch (Exception ex)
96 96
            {
97
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd);
97
                logger.ErrorFormat("システムエラー::{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
98 98
                return false;
99 99
            }
100 100

  
......
107 107
        /// <returns>true:成功 false:失敗</returns>
108 108
        public bool InsertAction(List<MaterialRecordInfo> data, bool bConnect = true)
109 109
        {
110
            string strcmd = "";
110
            StringBuilder strcmd = new StringBuilder();
111 111
            try
112 112
            {
113 113

  
114 114
                foreach (MaterialRecordInfo work in data)
115 115
                {
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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