プロジェクト

全般

プロフィール

リビジョン 355

堀内6年以上前に追加

ソース内のDataGridViewをDataGridViewEXへ統一
DataGridViewActionをDataGridViewEXへ統合
他の画面へのコンテキストメニュー定義修正
部署出納帳追加
工事情報コンボボックス表示バグ修正
旧常用者マスタメンバより削除
工事台帳発注書金額追加
注文書承認、一覧よりの申請時にデータ無しでも申請できるバグを修正

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonMotions.cs
3291 3291
        /// <summary>
3292 3292
        /// 選択行の色を変更する
3293 3293
        /// </summary>
3294
        public static void ChangeGridRow(DataGridView dgv
3294
        public static void ChangeGridRow(DataGridViewEX dgv
3295 3295
                                        , DataGridViewRow CurRow
3296 3296
                                        , ref GridCellStyleMember[] BackUpStyle
3297 3297
                                        , bool bSelect = true)
......
3512 3512
                strSQL.AppendFormat(" AND(DATE('{0}') <= DATE(B.CompDate)", dtDefaultStart.ToShortDateString());
3513 3513
                strSQL.AppendFormat(" OR DATE('{0}') = DATE(B.CompDate)))", DateTime.MinValue.ToShortDateString());
3514 3514

  
3515
                if (nDepCode != 0) strSQL.AppendFormat(" AND (B.DEPARTMENTCODE = {0})", nDepCode);
3515
                if (nDepCode > 0) strSQL.AppendFormat(" AND (B.DEPARTMENTCODE = {0})", nDepCode);
3516 3516

  
3517 3517
                if (nLEDGERFLG == -1) strSQL.AppendFormat(" AND A.LEDGERFLG = {0}", (int)PersonInChargeMaster.LedgerDivNoDef.CalcTarget);
3518 3518
                else if (nLEDGERFLG > -1) strSQL.AppendFormat(" AND A.LEDGERFLG = {0}", nLEDGERFLG);
branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 206;
17
        public static int s_SystemVersion = 208;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsExcute.cs
90 90
            SafetyPatrol = 43,                  // 43:安全パトロール申請
91 91
            ReqSumTotalList = 44,               // 44:手間・通常業者一覧
92 92
            RequestPrintList = 45,              // 45:請求書印刷一覧
93
            DepartmentCost = 46,                // 46:部署出納帳
93 94
        }
94 95
        #endregion
95 96

  
......
203 204
                                                                                { (int)ProcessExecuteNo.SafetyPatrol,           "安全パトロール申請"},
204 205
                                                                                { (int)ProcessExecuteNo.ReqSumTotalList,        "手間・通常業者一覧-表示"},
205 206
                                                                                { (int)ProcessExecuteNo.RequestPrintList,       "請求書印刷一覧-表示"},
207
                                                                                { (int)ProcessExecuteNo.DepartmentCost,         "部署出納帳" },
206 208
        };
207 209

  
208 210
        #endregion
......
686 688
                            ProcessExecuteNo_RequestPrintList(m_ProcControlPara[NowPoint]);
687 689
                            break;
688 690

  
691
                        case (int)ProcessExecuteNo.DepartmentCost:                      // 46:部署出納帳
692
                            ProcessExecuteNo_DepartmentCost(m_ProcControlPara[NowPoint]);
693
                            break;
689 694
                            #endregion
690 695

  
691 696
                        #region マスタメンテ
......
1238 1243
                    }
1239 1244
                }
1240 1245

  
1241
                // 直接表示フラグのセット
1242 1246
                if (CurrentPara.BoolExecParameter.Count > 0)
1243 1247
                {
1248
                    // 直接表示フラグのセット
1244 1249
                    frm.DirectFlg = CurrentPara.BoolExecParameter[0];
1250
                    if (CurrentPara.BoolExecParameter.Count > 1)
1251
                    {
1252
                        /// 新規申請フラグ
1253
                        frm.NewApprovalFlg = CurrentPara.BoolExecParameter[1];
1254
                    }
1245 1255
                }
1246 1256

  
1247 1257
                // フォーム表示
......
2731 2741
            }
2732 2742
        }
2733 2743
        #endregion
2744

  
2745
        #region 部署出納帳
2746
        /// <summary>
2747
        /// 部署出納帳
2748
        /// </summary>
2749
        /// <returns></returns>
2750
        public static void ProcessExecuteNo_DepartmentCost(ProcessParameter CurrentPara)
2751
        {
2752
            // 部署出納帳一覧
2753
            FrmDepCost frm = new FrmDepCost();
2754
            try
2755
            {
2756
                // フォーム表示
2757
                frm.ShowDialog();
2758

  
2759
            }
2760
            catch (Exception ex)
2761
            {
2762
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2763
                BackProcess();
2764
            }
2765
            finally
2766
            {
2767
                frm.Dispose(); frm = null;
2768
            }
2769
        }
2734 2770
        #endregion
2771
        #endregion
2735 2772

  
2736 2773
        #region マスタメンテナンス
2737 2774
        // ----------------- メンテナンス起動
branches/src/ProcessManagement/ProcessManagement/Common/Process/ClsSecurityPermission.cs
716 716
                {
717 717
                    foreach (ProcessExcute CurRec in CommonMotions.LoginUserProcExe)
718 718
                    {
719
                        if (ExecCode == CurRec.ExecCode)
720
                        {
721
                            bRet = true;
722
                            Editflg = CurRec.EditFlg;
723
                            break;
724
                        }
719
                        if (ExecCode != CurRec.ExecCode) continue;
720

  
721
                        bRet = true;
722
                        Editflg = CurRec.EditFlg;
723
                        break;
725 724
                    }
726 725
                }
727 726
                else
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOCostDataOfDepartment.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Data;
6
using System.Collections;
7

  
8
using log4net;
9
using MySql.Data.MySqlClient;           // Data Provider for MySql
10

  
11
using ProcessManagement.DB.MySql;
12
using ProcessManagement.DB.Core;
13
using ProcessManagement.DataModel;
14
using ProcessManagement.Common;
15

  
16
namespace ProcessManagement.DB.IOAccess
17
{
18
    /// <summary>
19
    /// 部署毎経費データDBアクセス
20
    /// </summary>
21
    public class IOCostDataOfDepartment : MySqlProcess
22
    {
23
        #region 定義部
24
        /// <summary>
25
        /// log4netログを使用する
26
        /// </summary>
27
        private static readonly ILog logger = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
28
        #endregion
29

  
30
        #region 定数
31
        /// <summary>
32
        /// 部署毎経費データフィールド並び
33
        /// </summary>
34
        public enum TableColumn
35
        {
36
            DepartmentCode = 0, // 部署コード
37
            ConstrYear,         // 工事期数・年数
38
            SeqNo,              // データ番号
39
            CostDate,           // 対象日付
40
            DepartmentName,     // 部署名
41
            SuppliersCode,      // 出納先コード
42
            SuppliersName,      // 出納先名称
43
            PaymentContent,     // 出納内容
44
            SendReceiveFlg,     // 出納フラグ
45
            EntryPrice,	        // 金額(税抜)
46
            EntryTax,           // 金額(税込)
47
            Coment,             // 備考
48

  
49
            EntryDate,
50
            UpdateDate,
51
        }
52
        #endregion
53

  
54
        #region コンストラクタ
55
        /// <summary>
56
        /// コンストラクタ
57
        /// </summary>
58
        /// <param name="ConnectionString"></param>
59
        public IOCostDataOfDepartment()
60
            : base(DBCommon.Instance.DBConnectString)
61
        {
62
        }
63

  
64
        #endregion
65

  
66
        #region SQL作成
67
        /// <summary>
68
        /// SQL作成
69
        /// </summary>
70
        private string CreateSelectSQL()
71
        {
72
            // SQL作成
73
            StringBuilder strcmd = new StringBuilder();
74
            strcmd.Append("SELECT");
75

  
76
            bool bColFirst = true;
77
            string strWork = string.Empty;
78
            foreach (var gender in Enum.GetValues(typeof(TableColumn)))
79
            {
80
                strWork = gender.ToString();
81
                if (!bColFirst) strcmd.Append(",");
82
                if (strWork.Equals("EntryDate") || strWork.Equals("UpdateDate"))
83
                {
84
                    strcmd.AppendFormat(" DATE_FORMAT({0}, '%Y/%m/%d %H:%i:%s')", strWork);
85
                }
86
                else if (strWork.Equals("CostDate"))
87
                {
88
                    strcmd.AppendFormat(" DATE_FORMAT({0}, '%Y/%m/%d')", strWork);
89
                }
90
                else
91
                {
92
                    strcmd.AppendFormat(" {0}", strWork);
93
                }
94
                bColFirst = false;
95
            }
96

  
97
            strcmd.Append(" FROM CostDataOfDepartment");
98

  
99
            return strcmd.ToString();
100
        }
101
        #endregion
102

  
103
        #region 複数読込み処理
104
        public bool SelectAction(string AddSQLString, ref List<CostDataOfDepartment> data, bool bConnect = true)
105
        {
106
            // インターフェース
107
            StringBuilder strcmd = new StringBuilder();
108
            ArrayList arData = new ArrayList();
109

  
110
            try
111
            {
112
                // SQL作成
113
                strcmd.Append(CreateSelectSQL());
114
                strcmd.Append(AddSQLString);
115

  
116
                // SQL実行
117
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
118

  
119
                // データセット
120
                foreach (object[] objwrk in arData)
121
                {
122
                    CostDataOfDepartment work = new CostDataOfDepartment();
123
                    Reader2Struct(objwrk, ref work);
124
                    data.Add(work);
125
                }
126

  
127
                return true;
128
            }
129
            catch (Exception ex)
130
            {
131
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
132
                return false;
133
            }
134
        }
135
        #endregion
136

  
137
        #region 1件読込み処理
138
        public bool SelectAction(string AddSQLString, ref CostDataOfDepartment data, bool bConnect = true)
139
        {
140
            // インターフェース
141
            StringBuilder strcmd = new StringBuilder();
142
            ArrayList arData = new ArrayList();
143

  
144
            try
145
            {
146
                strcmd.Append(CreateSelectSQL());
147
                strcmd.Append(AddSQLString);
148

  
149
                // SQL実行
150
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return false;
151
                if (arData.Count == 0) return false;
152

  
153
                // データセット
154
                foreach (object[] objwrk in arData)
155
                {
156
                    Reader2Struct(objwrk, ref data);
157
                    break;
158
                }
159

  
160
                return true;
161
            }
162
            catch (Exception ex)
163
            {
164
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
165
                return false;
166
            }
167
        }
168
        #endregion
169

  
170
        #region 1件追加処理
171
        /// <summary>
172
        /// 部署毎経費データ追加
173
        /// </summary>
174
        /// <param name="data">部署毎経費データデータ</param>
175
        /// <returns>true:成功 false:失敗</returns>
176
        public bool InsertAction(CostDataOfDepartment work, bool bConnect = true)
177
        {
178
            StringBuilder strcmd = new StringBuilder();
179
            try
180
            {
181
                bool bColFirst = true;
182
                strcmd.Append("INSERT INTO CostDataOfDepartment");
183
                strcmd.Append(" (");
184
                foreach (var gender in Enum.GetValues(typeof(TableColumn)))
185
                {
186
                    if (!bColFirst) strcmd.Append(", ");
187
                    strcmd.Append(gender.ToString());
188
                    bColFirst = false;
189
                }
190
                strcmd.Append(") VALUES (");
191

  
192
                strcmd.AppendFormat("  {0}", work.DepartmentCode);                  // 部署コード
193
                strcmd.AppendFormat(", {0}", work.ConstrYear);                      // 工事期数・年数
194
                strcmd.AppendFormat(", {0}", work.SeqNo);                           // データ番号
195
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')"
196
                                            , work.CostDate.ToShortDateString());   // 対象日付
197
                strcmd.AppendFormat(",'{0}'", work.DepartmentName);                 // 部署名称
198

  
199
                strcmd.AppendFormat(", {0}", work.SuppliersCode);                   // 出納先コード
200
                strcmd.AppendFormat(",'{0}'", work.SuppliersName);                  // 出納先名称
201
                strcmd.AppendFormat(",'{0}'", work.PaymentContent);                 // 出納内容
202
                strcmd.AppendFormat(", {0}", work.SendReceiveFlg);                  // 出納フラグ
203
                strcmd.AppendFormat(", {0}", work.EntryPrice);	                    // 金額(税抜)
204
                strcmd.AppendFormat(", {0}", work.EntryTax);	                    // 金額(税込)
205
                strcmd.AppendFormat(",'{0}'", work.Coment);	                        // 備考
206

  
207
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
208
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
209
                strcmd.Append(")");
210

  
211
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
212

  
213
                return true;
214
            }
215
            catch (Exception ex)
216
            {
217
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
218
                return false;
219
            }
220
        }
221
        #endregion
222

  
223
        #region 複数追加処理
224
        public bool InsertAction(List<CostDataOfDepartment> data, bool bConnect = true)
225
        {
226
            StringBuilder strcmd = new StringBuilder();
227
            try
228
            {
229
                bool bColFirst = true;
230
                strcmd.Append("INSERT INTO CostDataOfDepartment");
231
                strcmd.Append(" (");
232
                foreach (var gender in Enum.GetValues(typeof(TableColumn)))
233
                {
234
                    if (!bColFirst) strcmd.Append(", ");
235
                    strcmd.Append(gender.ToString());
236
                    bColFirst = false;
237
                }
238
                strcmd.Append(") VALUES");
239

  
240
                bool bDataFirst = true;
241
                foreach (CostDataOfDepartment work in data)
242
                {
243
                    if (bDataFirst) strcmd.Append(" (");
244
                    else strcmd.Append(", (");
245

  
246
                    strcmd.AppendFormat("  {0}", work.DepartmentCode);                  // 部署コード
247
                    strcmd.AppendFormat(", {0}", work.ConstrYear);                      // 工事期数・年数
248
                    strcmd.AppendFormat(", {0}", work.SeqNo);                           // データ番号
249
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d')"
250
                                                , work.CostDate.ToShortDateString());   // 対象日付
251
                    strcmd.AppendFormat(",'{0}'", work.DepartmentName);                 // 部署名称
252
                    strcmd.AppendFormat(", {0}", work.SuppliersCode);                   // 出納先コード
253
                    strcmd.AppendFormat(",'{0}'", work.SuppliersName);                  // 出納先名称
254
                    strcmd.AppendFormat(",'{0}'", work.PaymentContent);                 // 出納内容
255
                    strcmd.AppendFormat(", {0}", work.SendReceiveFlg);                  // 出納フラグ
256
                    strcmd.AppendFormat(", {0}", work.EntryPrice);	                    // 金額(税抜)
257
                    strcmd.AppendFormat(", {0}", work.EntryTax);	                    // 金額(税込)
258
                    strcmd.AppendFormat(",'{0}'", work.Coment);                         // 備考
259

  
260
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
261
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
262
                    strcmd.Append(")");
263

  
264
                    bDataFirst = false;
265
                }
266

  
267
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
268
                return true;
269
            }
270
            catch (Exception ex)
271
            {
272
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
273
                return false;
274
            }
275
        }
276
        #endregion
277

  
278
        #region 更新処理
279
        /// <summary>
280
        /// 部署毎経費データ更新
281
        /// </summary>
282
        /// <param name="AddSQLString">更新条件SQL文字列</param>
283
        /// <param name="data">部署毎経費データデータ</param>
284
        /// <returns>true:成功 false:失敗</returns>
285
        public bool UpdateAction(string AddSQLString, CostDataOfDepartment data, bool bConnect = true)
286
        {
287
            StringBuilder strcmd = new StringBuilder();
288
            try
289
            {
290

  
291
                strcmd.Append("UPDATE CostDataOfDepartment");
292

  
293
                strcmd.Append(" SET");
294

  
295
                strcmd.AppendFormat(" DepartmentCode = {0}", data.DepartmentCode);          // 部署コード
296
                strcmd.AppendFormat(",ConstrYear = {0}", data.ConstrYear);                  // 工事期数・年数
297
                strcmd.AppendFormat(",SeqNo = {0}", data.SeqNo);                            // データ番号
298
                strcmd.AppendFormat(",CostDate = STR_TO_DATE('{0}','%Y/%m/%d')"
299
                                        , data.CostDate.ToShortDateString());               // 対象日付
300
                strcmd.AppendFormat(",DepartmentName = '{0}'", data.DepartmentName);        // 部署名称
301
                strcmd.AppendFormat(",SuppliersCode = {0}", data.SuppliersCode);            // 出納先コード
302
                strcmd.AppendFormat(",SuppliersName = '{0}'", data.SuppliersName);          // 出納先名称
303
                strcmd.AppendFormat(",PaymentContent = '{0}'", data.PaymentContent);        // 出納内容
304
                strcmd.AppendFormat(",SendReceiveFlg = {0}", data.SendReceiveFlg);          // 出納フラグ
305
                strcmd.AppendFormat(",EntryPrice = {0}", data.EntryPrice);                  // 金額(税抜)
306
                strcmd.AppendFormat(",EntryTax = {0}", data.EntryTax);                      // 金額(税込)
307
                strcmd.AppendFormat(",Coment = '{0}'", data.Coment);                        // 備考
308

  
309
                strcmd.Append(", UpdateDate = NOW()");
310
                strcmd.Append(AddSQLString);
311

  
312
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
313

  
314
                return true;
315
            }
316
            catch (Exception ex)
317
            {
318
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
319
                return false;
320
            }
321
        }
322
        #endregion
323

  
324
        #region 削除処理
325
        /// <summary>
326
        /// 部署毎経費データ削除
327
        /// </summary>
328
        /// <param name="AddSQLString">削除条件SQL文字列</param>
329
        /// <param name="data">部署毎経費データデータ</param>
330
        /// <returns>true:成功 false:失敗</returns>
331
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
332
        {
333
            // インターフェース
334
            StringBuilder strcmd = new StringBuilder();
335
            try
336
            {
337
                strcmd.AppendFormat("{0}{1}", "DELETE FROM CostDataOfDepartment", AddSQLString);
338

  
339
                if (!ExecuteNonQuery(strcmd.ToString(), bConnect)) return false;
340

  
341
                return true;
342
            }
343
            catch (Exception ex)
344
            {
345
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
346
                return false;
347
            }
348
        }
349
        #endregion
350

  
351
        #region データセット処理
352
        /// <summary>
353
        /// MySQLDataReaderより構造体へセットする
354
        /// </summary>
355
        /// <param name="reader">MySQLDataReader</param>
356
        /// <param name="wrk">構造体</param>
357
        public void Reader2Struct(object[] objwrk, ref CostDataOfDepartment wrk)
358
        {
359
            try
360
            {
361
                // データ取得
362
                wrk.DepartmentCode = int.Parse(objwrk[(int)TableColumn.DepartmentCode].ToString());         // 部署コード
363
                wrk.ConstrYear = int.Parse(objwrk[(int)TableColumn.ConstrYear].ToString());                 // 工事期数・年数
364
                wrk.SeqNo = int.Parse(objwrk[(int)TableColumn.SeqNo].ToString());                           // データ番号
365
                wrk.CostDate = DateTime.Parse(objwrk[(int)TableColumn.CostDate].ToString());                // 対象日付
366
                wrk.DepartmentName = objwrk[(int)TableColumn.DepartmentName].ToString();                    // 部署名称
367

  
368
                wrk.SuppliersCode = int.Parse(objwrk[(int)TableColumn.SuppliersCode].ToString());           // 出納先コード
369
                wrk.SuppliersName = objwrk[(int)TableColumn.SuppliersName].ToString();                      // 出納先名称
370
                wrk.PaymentContent = objwrk[(int)TableColumn.PaymentContent].ToString();                    // 出納内容
371

  
372
                wrk.SendReceiveFlg = int.Parse(objwrk[(int)TableColumn.SendReceiveFlg].ToString());         // 出納フラグ
373
                wrk.EntryPrice = CommonMotions.cnvDouble(objwrk[(int)TableColumn.EntryPrice]);              // 金額(税抜)
374
                wrk.EntryTax = CommonMotions.cnvDouble(objwrk[(int)TableColumn.EntryTax]);                  // 金額(税込)
375
                wrk.Coment = objwrk[(int)TableColumn.Coment].ToString();                                    // 備考
376

  
377
                wrk.EntryDate = DateTime.Parse(objwrk[(int)TableColumn.EntryDate].ToString());
378
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)TableColumn.UpdateDate].ToString());
379
            }
380
            catch (MySqlException myex)
381
            {
382
                logger.ErrorFormat("MySQLエラー:{0}:{1}", CommonMotions.GetMethodName(2), myex.Message);
383
            }
384
            catch (Exception ex)
385
            {
386
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(2), ex.Message);
387
            }
388
        }
389
        #endregion
390

  
391
        #region 検索文字列作成処理
392
        /// <summary>
393
        /// 主キー検索の文字列を返す
394
        /// </summary>
395
        /// <param name="DepartmentCode"></param>
396
        /// <param name="CostDate"></param>
397
        /// <param name="DataType"></param>
398
        /// <param name="DataAddCount"></param>
399
        /// <returns></returns>
400
        public string CreatePrimarykeyString(int DepartmentCode, int ConstrYear = 0, int SeqNo = 0)
401
        {
402
            StringBuilder strWork = new StringBuilder();
403
            try
404
            {
405
                strWork.AppendFormat(" WHERE DepartmentCode = {0}", DepartmentCode);
406
                if (ConstrYear != 0)
407
                    strWork.AppendFormat(" AND ConstrYear = {0}", ConstrYear);
408
                if (SeqNo != 0)
409
                    strWork.AppendFormat(" AND SeqNo = {0}", SeqNo);
410

  
411
                return strWork.ToString();
412
            }
413
            catch (Exception ex)
414
            {
415
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strWork.ToString());
416
                return string.Empty;
417
            }
418
        }
419
        #endregion
420

  
421
        #region 追加番号の最大値を取得
422
        /// <summary>
423
        /// 追加番号の最大値を取得する
424
        /// </summary>
425
        /// <param name="AddSQLString"></param>
426
        /// <param name="bConnect"></param>
427
        /// <returns></returns>
428
        public int SelectMaxAddDataCount(string AddSQLString, bool bConnect = true)
429
        {
430
            // インターフェース
431
            StringBuilder strcmd = new StringBuilder();
432
            ArrayList arData = new ArrayList();
433
            int iRet = 0;
434
            try
435
            {
436
                // SQL作成
437
                strcmd.AppendFormat("SELECT IFNULL(MAX(SeqNo), 0) FROM CostDataOfDepartment{0}", AddSQLString);
438

  
439
                // SQL実行
440
                if (!ExecuteReader(strcmd.ToString(), ref arData, bConnect)) return iRet;
441

  
442
                // データセット
443
                foreach (object[] objwrk in arData)
444
                {
445
                    if (objwrk[0].ToString().Equals("null"))
446
                        iRet = 0;
447
                    else
448
                        iRet = int.Parse(objwrk[0].ToString());
449
                }
450

  
451
            }
452
            catch (Exception ex)
453
            {
454
                logger.ErrorFormat("システムエラー:{0}:{1}:{2}", CommonMotions.GetMethodName(2), ex.Message, strcmd.ToString());
455
            }
456
            return iRet;
457
        }
458
        #endregion
459
    }
460
}
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOPurchaseOrderDetail.cs
49 49
            SourceCode,             // 台帳工事番号
50 50
            SourceDetailCnt,	    // 台帳明細番号
51 51
            DataTypeFlag,           // 明細行データタイプフラグ
52

  
52
            StatutoryWelfareRate,   // 法定福利費比率
53 53
            EntryDate,
54 54
            UpdateDate,
55 55
        }
......
92 92
            strcmd.Append(", SourceCode");              // 台帳工事番号
93 93
            strcmd.Append(", SourceDetailCnt");	        // 台帳明細番号
94 94
            strcmd.Append(", DataTypeFlag");            // 明細行データタイプフラグ
95

  
95
            strcmd.Append(", StatutoryWelfareRate");    // 法定福利費比率
96 96
            strcmd.Append(", DATE_FORMAT(EntryDate, '%Y/%m/%d %H:%i:%s')");
97 97
            strcmd.Append(", DATE_FORMAT(UpdateDate, '%Y/%m/%d %H:%i:%s')");
98 98
            strcmd.Append(" FROM PurchaseOrderDetail");
......
220 220
                strcmd.AppendFormat(", {0}", work.SourceCode);              // 台帳工事番号
221 221
                strcmd.AppendFormat(", {0}", work.SourceDetailCnt);	        // 台帳明細番号
222 222
                strcmd.AppendFormat(", {0}", work.DataTypeFlag);            // 明細行データタイプフラグ
223
                strcmd.AppendFormat(", {0}", work.StatutoryWelfareRate);    // 法定福利費比率
223 224

  
224

  
225 225
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
226 226
                strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
227 227
                strcmd.Append(")");
......
282 282
                    strcmd.AppendFormat(", {0}", work.SourceCode);              // 台帳工事番号
283 283
                    strcmd.AppendFormat(", {0}", work.SourceDetailCnt);	        // 台帳明細番号
284 284
                    strcmd.AppendFormat(", {0}", work.DataTypeFlag);            // 明細行データタイプフラグ
285
                    strcmd.AppendFormat(", {0}", work.StatutoryWelfareRate);    // 法定福利費比率
285 286

  
286 287
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.EntryDate);
287 288
                    strcmd.AppendFormat(", STR_TO_DATE('{0}','%Y/%m/%d %H:%i:%s')", work.UpdateDate);
......
335 336
                strcmd.AppendFormat(", SourceCode = {0}", data.SourceCode);                     // 台帳工事番号
336 337
                strcmd.AppendFormat(", SourceDetailCnt = {0}", data.SourceDetailCnt);	        // 台帳明細番号
337 338
                strcmd.AppendFormat(", DataTypeFlag = {0}", data.DataTypeFlag);                 // 明細行データタイプフラグ
339
                strcmd.AppendFormat(", StatutoryWelfareRate = {0}", data.StatutoryWelfareRate); // 法定福利費比率
338 340

  
339 341
                strcmd.Append(", UpdateDate = NOW()");
340 342
                strcmd.Append(AddSQLString);
......
438 440
                    case (int)TableColumn.DataTypeFlag:     // 明細行データタイプフラグ
439 441
                        strcmd.AppendFormat(" DataTypeFlag = {0}", ((int)value).ToString());
440 442
                        break;
443
                    case (int)TableColumn.StatutoryWelfareRate: // 法定福利費比率
444
                        strcmd.AppendFormat(" StatutoryWelfareRate = {0}", ((double)value).ToString());
445
                        break;
441 446
                }
442 447

  
443 448
                strcmd.Append(", UpdateDate = NOW()");
......
483 488
                wrk.SourceCode = int.Parse(objwrk[(int)TableColumn.SourceCode].ToString());                     // 台帳工事番号
484 489
                wrk.SourceDetailCnt = int.Parse(objwrk[(int)TableColumn.SourceDetailCnt].ToString());	        // 台帳明細番号
485 490
                wrk.DataTypeFlag = int.Parse(objwrk[(int)TableColumn.DataTypeFlag].ToString());                 // 明細行データタイプフラグ
491
                wrk.StatutoryWelfareRate = double.Parse(objwrk[(int)TableColumn.StatutoryWelfareRate].ToString());  // 法定福利費比率
486 492

  
487

  
488 493
                wrk.EntryDate = DateTime.Parse(objwrk[(int)TableColumn.EntryDate].ToString());
489 494
                wrk.UpdateDate = DateTime.Parse(objwrk[(int)TableColumn.UpdateDate].ToString());
490 495
            }
branches/src/ProcessManagement/ProcessManagement/DataModel/CostDataOfDepartment.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5

  
6
namespace ProcessManagement.DataModel
7
{
8
    /// <summary>
9
    /// 部署毎経費データ
10
    /// </summary>
11
    public class CostDataOfDepartment
12
    {
13
        #region 定数
14

  
15
        #region 出納フラグ定義
16
        /// <summary>
17
        /// 出納フラグ定義
18
        /// </summary>
19
        public enum SendReceiveFlgDef
20
        {
21
            /// <summary>
22
            /// 支払データ
23
            /// </summary>
24
            Payment = -1,
25
            /// <summary>
26
            /// データ無し
27
            /// </summary>
28
            NonData = 0,
29
            /// <summary>
30
            /// 収入データ
31
            /// </summary>
32
            Revenue = 1,
33
        }
34
        #endregion
35

  
36
        #endregion
37

  
38
        #region メンバ変数
39
        /// <summary>
40
        /// 部署コード
41
        /// </summary>
42
        private int         m_DepartmentCode = 0;
43
        /// <summary>
44
        /// 工事期数・年数
45
        /// </summary>
46
        private int         m_ConstrYear = 0;
47
        /// <summary>
48
        /// データ番号
49
        /// </summary>
50
        private int         m_SeqNo = 0;
51
        /// <summary>
52
        /// 対象日付
53
        /// </summary>
54
        private DateTime    m_CostDate = DateTime.Now;
55
        /// <summary>
56
        /// 出納先コード
57
        /// </summary>
58
        private int         m_SuppliersCode = 0;
59
        /// <summary>
60
        /// 部署名
61
        /// </summary>
62
        private string      m_DepartmentName = string.Empty;
63
        /// <summary>
64
        /// 支払先名称
65
        /// </summary>
66
        private string      m_SuppliersName = string.Empty;
67
        /// <summary>
68
        /// 支払内容
69
        /// </summary>
70
        private string      m_PaymentContent = string.Empty;
71
        /// <summary>
72
        /// 出納フラグ
73
        /// </summary>
74
        private int         m_SendReceiveFlg = 0;
75
        /// <summary>
76
        /// 金額(税抜)
77
        /// </summary>
78
        private double      m_EntryPrice = 0;
79
        /// <summary>
80
        /// 金額(税込)
81
        /// </summary>
82
        private double      m_EntryTax = 0;
83
        /// <summary>
84
        /// 備考
85
        /// </summary>
86
        private string      m_Coment = string.Empty;
87
        /// <summary>
88
        /// 登録日付
89
        /// </summary>
90
        private DateTime    m_EntryDate = DateTime.Now;
91
        /// <summary>
92
        /// 更新日付
93
        /// </summary>
94
        private DateTime    m_UpdateDate = DateTime.Now;
95
        #endregion
96

  
97
        #region コンストラクタ
98
        #endregion
99

  
100
        #region プロパティ
101
        /// <summary>
102
        /// 担当者コード
103
        /// </summary>
104
        public int DepartmentCode
105
        {
106
            get { return m_DepartmentCode; }
107
            set { m_DepartmentCode = value; }
108
        }
109
        /// <summary>
110
        /// 工事期数・年数
111
        /// </summary>
112
        public int ConstrYear
113
        {
114
            get { return m_ConstrYear; }
115
            set { m_ConstrYear = value; }
116
        }
117
        /// <summary>
118
        /// データ番号
119
        /// </summary>
120
        public int SeqNo
121
        {
122
            get { return m_SeqNo; }
123
            set { m_SeqNo = value; }
124
        }
125
        /// <summary>
126
        /// 対象日付
127
        /// </summary>
128
        public DateTime CostDate
129
        {
130
            get { return m_CostDate; }
131
            set { m_CostDate = value; }
132
        }
133
        /// <summary>
134
        /// 出納先コード
135
        /// </summary>
136
        public int SuppliersCode
137
        {
138
            get { return m_SuppliersCode; }
139
            set { m_SuppliersCode = value; }
140
        }
141
        /// <summary>
142
        /// 部署名
143
        /// </summary>
144
        public string DepartmentName
145
        {
146
            get { return m_DepartmentName; }
147
            set { m_DepartmentName = value; }
148
        }
149
        /// <summary>
150
        /// 支払先名称
151
        /// </summary>
152
        public string SuppliersName
153
        {
154
            get { return m_SuppliersName; }
155
            set { m_SuppliersName = value; }
156
        }
157
        /// <summary>
158
        /// 支払内容
159
        /// </summary>
160
        public string PaymentContent
161
        {
162
            get { return m_PaymentContent; }
163
            set { m_PaymentContent = value; }
164
        }
165
        /// <summary>
166
        /// 出納フラグ
167
        /// </summary>
168
        public int SendReceiveFlg
169
        {
170
            get { return m_SendReceiveFlg; }
171
            set { m_SendReceiveFlg = value; }
172
        }
173
        /// <summary>
174
        /// 金額(税抜)
175
        /// </summary>
176
        public double EntryPrice
177
        {
178
            get { return m_EntryPrice; }
179
            set { m_EntryPrice = value; }
180
        }
181
        /// <summary>
182
        /// 金額(税込)
183
        /// </summary>
184
        public double EntryTax
185
        {
186
            get { return m_EntryTax; }
187
            set { m_EntryTax = value; }
188
        }
189
        /// <summary>
190
        /// 備考
191
        /// </summary>
192
        public string Coment
193
        {
194
            get { return m_Coment; }
195
            set { m_Coment = value; }
196
        }
197

  
198
        /// <summary>
199
        /// 登録日付
200
        /// </summary>
201
        public DateTime EntryDate
202
        {
203
            set { m_EntryDate = value; }
204
            get { return m_EntryDate; }
205
        }
206
        /// <summary>
207
        /// 更新日付
208
        /// </summary>
209
        public DateTime UpdateDate
210
        {
211
            set { m_UpdateDate = value; }
212
            get { return m_UpdateDate; }
213
        }
214
        #endregion
215
    }
216
}
branches/src/ProcessManagement/ProcessManagement/DataModel/GridCellStyleMember.cs
9 9
namespace ProcessManagement.DataModel
10 10
{
11 11
    /// <summary>
12
    /// DataGridView.Cell.styleメンバー退避クラス
12
    /// DataGridViewEX.Cell.styleメンバー退避クラス
13 13
    /// </summary>
14 14
    public class GridCellStyleMember
15 15
    {
branches/src/ProcessManagement/ProcessManagement/DataModel/PurchaseOrderDetail.cs
72 72
        private int     m_SourceDetailCnt = 0;              // 台帳明細番号
73 73

  
74 74
        private int     m_DataTypeFlag = 0;                 // 明細行データタイプフラグ
75
        private double  m_StatutoryWelfareRate = 0.0;       // 法定福利費比率
75 76

  
76 77
        private DateTime m_EntryDate = DateTime.Now;        // 登録日付
77 78
        private DateTime m_UpdateDate = DateTime.Now;       // 更新日付
......
203 204
            get { return m_DataTypeFlag; }
204 205
            set { m_DataTypeFlag = value; }
205 206
        }
206
        
207

  
207 208
        /// <summary>
209
        /// 法定福利費比率
210
        /// </summary>
211
        public double StatutoryWelfareRate
212
        {
213
            get { return m_StatutoryWelfareRate; }
214
            set { m_StatutoryWelfareRate = value; }
215
        }
216

  
217
        /// <summary>
208 218
        /// 登録日付
209 219
        /// </summary>
210 220
        public DateTime EntryDate
branches/src/ProcessManagement/ProcessManagement/Forms/ControlsAction/DataGridViewAction.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using System.Windows.Forms;
7

  
8
using log4net;
9
using log4net.Appender;
10
using log4net.Repository.Hierarchy;
11

  
12
using ProcessManagement.Common;
13
using System.Collections;
14

  
15
namespace ProcessManagement.Forms.ControlsAction
16
{
17
    /// <summary>
18
    /// データグリッドビュー汎用動作クラス
19
    /// </summary>
20
    public static class DataGridViewAction
21
    {
22
        #region 使用定義
23
        //log4netログを使用する
24
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
25
        #endregion
26

  
27
        #region 定数
28
        #endregion
29

  
30
        #region 1行データアップ
31
        /// <summary>
32
        /// アップキー押下
33
        /// </summary>
34
        /// <param name="dgv">DataGridViewオブジェクト</param>
35
        /// <param name="StartPoint">行内移動開始カラム位置</param>
36
        /// <param name="EndPoint">行内移動終了カラム位置</param>
37
        public static void GridRowUpAction(DataGridView dgv, int StartPoint, int EndPoint)
38
        {
39
            try
40
            {
41
                // カレント行数取得
42
                int curRow = dgv.CurrentCell.RowIndex;
43
                int curCol = dgv.CurrentCell.ColumnIndex;
44

  
45
                // カレント行退避
46
                DataGridViewRow currentrow = dgv.CurrentRow;
47

  
48
                // 1行前を退避
49
                DataGridViewRow frontrow = dgv.Rows[dgv.CurrentRow.Index - 1];
50

  
51
                // 入れ替え
52
                // カレント行→退避
53
                DataGridViewRow SaveRow = (DataGridViewRow)currentrow.Clone();
54
                for (int i = StartPoint; i <= EndPoint; i++)
55
                {
56
                    SaveRow.Cells[i].Value = currentrow.Cells[i].Value;
57
                    SaveRow.Cells[i].Style = currentrow.Cells[i].Style;
58
                    SaveRow.Cells[i].ReadOnly = currentrow.Cells[i].ReadOnly;
59

  
60
                }
61

  
62
                // 前行→カレント行
63
                for (int i = StartPoint; i <= EndPoint; i++)
64
                {
65
                    currentrow.Cells[i].Value = frontrow.Cells[i].Value;
66
                    currentrow.Cells[i].Style = frontrow.Cells[i].Style;
67
                    currentrow.Cells[i].ReadOnly = frontrow.Cells[i].ReadOnly;
68
                }
69

  
70
                // カレント行→前行
71
                for (int i = StartPoint; i <= EndPoint; i++)
72
                {
73
                    frontrow.Cells[i].Value = SaveRow.Cells[i].Value;
74
                    frontrow.Cells[i].Style = SaveRow.Cells[i].Style;
75
                    frontrow.Cells[i].ReadOnly = SaveRow.Cells[i].ReadOnly;
76
                }
77

  
78
                //dgv.FirstDisplayedScrollingRowIndex = curRow;
79
                dgv.CurrentCell = dgv[curCol, curRow - 1];
80
            }
81
            catch (System.Exception ex)
82
            {
83
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
84
            }
85
        }
86
        #endregion
87

  
88
        #region 1行データダウン
89
        /// <summary>
90
        /// ダウンキー押下処理
91
        /// </summary>
92
        /// <param name="sender"></param>
93
        /// <param name="e"></param>
94
        public static void GridRowDownAction(DataGridView dgv, int StartPoint, int EndPoint)
95
        {
96
            try
97
            {
98
                // 最終行は処理しない
99
                if ((dgv.CurrentRow.Index + 1) == dgv.Rows.Count) return;
100

  
101
                // カレント行数取得
102
                int curRow = dgv.CurrentCell.RowIndex;
103
                int curCol = dgv.CurrentCell.ColumnIndex;
104

  
105
                // カレント行退避
106
                DataGridViewRow currentrow = dgv.CurrentRow;
107

  
108
                // 1行後ろを退避
109
                DataGridViewRow rearrow = dgv.Rows[dgv.CurrentRow.Index + 1];
110

  
111
                // 入れ替え
112
                // カレント行→退避
113
                DataGridViewRow SaveRow = (DataGridViewRow)currentrow.Clone();
114
                for (int i = StartPoint; i <= EndPoint; i++)
115
                {
116
                    SaveRow.Cells[i].Value = currentrow.Cells[i].Value;
117
                    SaveRow.Cells[i].Style = currentrow.Cells[i].Style;
118
                    SaveRow.Cells[i].ReadOnly = currentrow.Cells[i].ReadOnly;
119
                }
120

  
121
                // 後行→カレント行
122
                for (int i = StartPoint; i <= EndPoint; i++)
123
                {
124
                    currentrow.Cells[i].Value = rearrow.Cells[i].Value;
125
                    currentrow.Cells[i].Style = rearrow.Cells[i].Style;
126
                    currentrow.Cells[i].ReadOnly = rearrow.Cells[i].ReadOnly;
127
                }
128

  
129
                // カレント行→後行
130
                for (int i = StartPoint; i <= EndPoint; i++)
131
                {
132
                    rearrow.Cells[i].Value = SaveRow.Cells[i].Value;
133
                    rearrow.Cells[i].Style = SaveRow.Cells[i].Style;
134
                    rearrow.Cells[i].ReadOnly = SaveRow.Cells[i].ReadOnly;
135
                }
136

  
137
                //dgv.FirstDisplayedScrollingRowIndex = curRow;
138
                dgv.CurrentCell = dgv[curCol, curRow + 1];
139

  
140
            }
141
            catch (System.Exception ex)
142
            {
143
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
144
            }
145
        }
146
        #endregion
147

  
148
        #region 複数行ダウン
149
        /// <summary>
150
        /// 複数行ダウン処理
151
        /// </summary>
152
        /// <param name="dgv"></param>
153
        /// <param name="StartPoint"></param>
154
        /// <param name="EndPoint"></param>
155
        /// <param name="ToRowPoint"></param>
156
        public static void GridRowDownMultiLine(DataGridView dgv, int StartPoint, int EndPoint, int ToRowPoint)
157
        {
158
            try
159
            {
160
                // 現在グリッド情報取得
161
                int CurrentLineCount = dgv.CurrentRow.Index;
162
                int addLine = (EndPoint - StartPoint) + 1;
163
                int curCol = dgv.CurrentCell.ColumnIndex;
164
                
165
                // コピー先がグリッド行より大きい場合は行追加してから処理を行う
166
                if (CurrentLineCount > dgv.RowCount)
167
                {
168
                    if (addLine != 0) dgv.Rows.Add(addLine);
169
                }
170

  
171
                dgv.Rows.Insert(ToRowPoint, addLine);
172
                
173
                // 行コピー
174
                for (int iy = StartPoint; iy <= EndPoint; iy++)
175
                {
176
                    for (int ix = 0; ix < dgv.ColumnCount; ix++)
177
                    {
178
                        dgv.Rows[ToRowPoint].Cells[ix].Value = dgv.Rows[iy].Cells[ix].Value;
179
                        dgv.Rows[ToRowPoint].Cells[ix].Style = dgv.Rows[iy].Cells[ix].Style;
180
                        dgv.Rows[ToRowPoint].Cells[ix].ReadOnly = dgv.Rows[iy].Cells[ix].ReadOnly;
181
                    }
182
                    ToRowPoint++;
183
                }
184

  
185
                // コピー元行削除
186
                for (int i = EndPoint; i >= StartPoint; i--)
187
                {
188
                    dgv.Rows.RemoveAt(i);
189
                }
190

  
191
                // 表示カーソルのセット
192
                dgv.CurrentCell = dgv[curCol, EndPoint];
193
            }
194
            catch (System.Exception ex)
195
            {
196
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
197
            }
198
        }
199
        #endregion
200

  
201
        #region 新しい行を作成する
202
        /// <summary>
203
        /// 新しい行を作成する
204
        /// </summary>
205
        /// <param name="dgvwork">対象データグリッド</param>
206
        /// <param name="DirectionRet">進行方向:Yes(後)No:(前) Cancel(キャンセル)</param>
207
        /// <param name="TergetRow">対象行</param>
208
        public static void CreateNewLine(DataGridView dgvwork, ref int TergetRow)
209
        {
210
            try
211
            {
212
                // 現在行が無い
213
                if (dgvwork.RowCount == 0)
214
                {
215
                    dgvwork.Rows.Add();
216
                    TergetRow = dgvwork.RowCount - 1;
217
                }
218
                else if (TergetRow > dgvwork.RowCount - 1)
219
                {
220
                    // 最終行
221
                    dgvwork.Rows.Add();
222
                    TergetRow = dgvwork.RowCount - 1;
223
                }
224
                else
225
                {
226
                    dgvwork.Rows.Insert(TergetRow, 1);
227
                }
228
            }
229
            catch (Exception ex)
230
            {
231
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
232
            }
233
        }
234
        #endregion
235
    }
236
}
branches/src/ProcessManagement/ProcessManagement/Forms/CustomControls/ComboBoxEX.cs
6 6
using System.Text;
7 7
using System.Windows.Forms;
8 8

  
9
//*---------------------------- 拡張DataGridViewコード ------------------------*
9
//*---------------------------- 拡張ComboBoxEXコード --------------------------*
10 10
//  2015/12/08  Ver1.0.0.0      Create Source           
11 11
//
12 12
//
branches/src/ProcessManagement/ProcessManagement/Forms/CustomControls/DataGridViewEX.cs
6 6
using System.Text;
7 7
using System.Windows.Forms;
8 8

  
9
//*---------------------------- ?g??DataGridView?R?[?h ------------------------*
9
using log4net;
10
using log4net.Appender;
11
using log4net.Repository.Hierarchy;
12

  
13
using ProcessManagement.Common;
14
using System.Collections;
15

  
16
//*---------------------------- ?g??DataGridViewEX?R?[?h ------------------------*
10 17
//  2015/07/14  Ver1.0.0.0      Create Source           
11 18
//
12 19
//
......
16 23
{
17 24
    public class DataGridViewEX : DataGridView
18 25
    {
26
        #region ?g?p??`
27
        //log4net???O???g?p????
28
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
29
        #endregion
30

  
19 31
        #region ?R???X?g???N?^
20 32
        /// <summary>
21 33
        /// ?R???X?g???N?^
......
40 52
            // 
41 53
            // DataGridViewEX
42 54
            // 
43
            this.RowTemplate.Height = 21;
55
            //this.RowTemplate.Height = 21;
44 56
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.DataGridViewEX_KeyDown);
45 57
            ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
46 58
            this.ResumeLayout(false);
......
56 68
        /// <returns></returns>
57 69
        protected override bool ProcessDialogKey(Keys keyData)
58 70
        {
59
            // ?R?????g??t?H?[?J?X????????????????
60
            Form frmParent = FindForm();
61
            //if (frmParent.ActiveControl.GetType().Equals(typeof(MoveTextBox))
62
            //    || frmParent.ActiveControl.GetType().Equals(typeof(ShapeContainer))
63
            //    || frmParent.ActiveControl.GetType().Equals(typeof(LineShape))) return false;
64
         
65
            //Enter?L?[????????????ATab?L?[???????????????
66
            if ((keyData & Keys.KeyCode) == Keys.Enter)
71
            try
67 72
            {
68
                //return this.ProcessTabKey(keyData);
69
                return this.ProcessDownKey(keyData);
73
                // ?R?????g??t?H?[?J?X????????????????
74
                Form frmParent = FindForm();
75
                //if (frmParent.ActiveControl.GetType().Equals(typeof(MoveTextBox))
76
                //    || frmParent.ActiveControl.GetType().Equals(typeof(ShapeContainer))
77
                //    || frmParent.ActiveControl.GetType().Equals(typeof(LineShape))) return false;
78

  
79
                // Enter?L?[????????????ADownKey???????????????
80
                // ??I?s??Tab?L?[???????????????
81
                if ((keyData & Keys.KeyCode) == Keys.Enter)
82
                {
83
                    if (CurrentCell.RowIndex == (base.RowCount - 1))
84
                        return this.ProcessTabKey(keyData);
85
                    else
86
                        return this.ProcessDownKey(keyData);
87
                }
88
                return base.ProcessDialogKey(keyData);
70 89
            }
71
            return base.ProcessDialogKey(keyData);
90
            catch (Exception ex)
91
            {
92
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
93
                return false;
94
            }
72 95
        }
73 96
        #endregion
74 97

  
......
81 104
        /// <returns></returns>
82 105
        protected override bool ProcessDataGridViewKey(KeyEventArgs e)
83 106
        {
84
            // ?R?????g??t?H?[?J?X????????????????
85
            Form frmParent = FindForm();
86
            //if (frmParent.ActiveControl.GetType().Equals(typeof(MoveTextBox))
87
            //    || frmParent.ActiveControl.GetType().Equals(typeof(ShapeContainer))
88
            //    || frmParent.ActiveControl.GetType().Equals(typeof(LineShape))) return false;
107
            try
108
            {
109
                // ?R?????g??t?H?[?J?X????????????????
110
                Form frmParent = FindForm();
111
                //if (frmParent.ActiveControl.GetType().Equals(typeof(MoveTextBox))
112
                //    || frmParent.ActiveControl.GetType().Equals(typeof(ShapeContainer))
113
                //    || frmParent.ActiveControl.GetType().Equals(typeof(LineShape))) return false;
89 114

  
90
            //Enter?L?[????????????ATab?L?[???????????????
91
            if (e.KeyCode == Keys.Enter)
115
                //Enter?L?[????????????ATab?L?[???????????????
116
                if (e.KeyCode == Keys.Enter)
117
                {
118
                    //return this.ProcessTabKey(e.KeyCode);
119
                    return this.ProcessDownKey(e.KeyCode);
120
                }
121
                return base.ProcessDataGridViewKey(e);
122
            }
123
            catch (Exception ex)
92 124
            {
93
                //return this.ProcessTabKey(e.KeyCode);
94
                return this.ProcessDownKey(e.KeyCode);
125
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
126
                return false;
95 127
            }
96
            return base.ProcessDataGridViewKey(e);
97 128
        }
98 129
        #endregion
99 130

  
......
106 137
        /// <param name="e"></param>
107 138
        private void DataGridViewEX_KeyDown(object sender, KeyEventArgs e)
108 139
        {
109
            DataGridView dgv = (DataGridView)(sender);
110
            int CurrentCellX = dgv.CurrentCellAddress.X;
111
            int CurrentCellY = dgv.CurrentCellAddress.Y;
140
            try
141
            {
142
                DataGridViewEX dgv = (DataGridViewEX)(sender);
143
                int CurrentCellX = dgv.CurrentCellAddress.X;
144
                int CurrentCellY = dgv.CurrentCellAddress.Y;
112 145

  
113
            if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
146
                if (e.KeyCode == Keys.Delete || e.KeyCode == Keys.Back)
147
                {
148
                    foreach (DataGridViewCell c in dgv.SelectedCells)
149
                    {
150
                        if (((DataGridViewEX)sender).CurrentCell.ReadOnly == false)
151
                        {
152
                            // ?Z??????e??????
153
                            dgv[c.ColumnIndex, c.RowIndex].Value = "";
154
                        }
155
                    }
156
                }
157
                else if ((e.Modifiers & Keys.Control) == Keys.Control && e.KeyCode == Keys.V)
158
                {
159
                    // ?N???b?v?{?[?h????e????
160
                    String clipText = Clipboard.GetText();
161
                    // ???s????
162
                    clipText = clipText.Replace("\r\n", "\n");
163
                    clipText = clipText.Replace("\r", "\n");
164
                    // ???s?????
165
                    String[] lines = clipText.Split('\n');
166

  
167
                    int srcLineCnt;
168
                    Boolean nflag = true;
169
                    for (srcLineCnt = 0; srcLineCnt <= lines.GetLength(0) - 1; srcLineCnt++)
170
                    {
171
                        // ????NULL?s???R?s?[?????????
172
                        if (srcLineCnt >= lines.GetLength(0) - 1 && "".Equals(lines[srcLineCnt]) && nflag == false) break;
173
                        if ("".Equals(lines[srcLineCnt]) == false) nflag = false;
174

  
175
                        // ?^?u?????
176
                        String[] vals = lines[srcLineCnt].Split('\t');
177

  
178
                        // ?e?Z????l????
179
                        int srcCellCnt = 0;
180
                        int DestCellCnt = 0;
181
                        for (srcCellCnt = 0; srcCellCnt <= vals.GetLength(0) - 1; srcCellCnt++)
182
                        {
183
                            // ?Z???????????????\??t?????
184
                            if (!(CurrentCellX + DestCellCnt >= 0 && CurrentCellX + DestCellCnt < dgv.ColumnCount && CurrentCellY + srcLineCnt >= 0 && CurrentCellY + srcLineCnt < dgv.RowCount))
185
                            {
186
                                continue;
187
                            }
188
                            // ??\???Z?????\??t?????
189
                            if (dgv[CurrentCellX + DestCellCnt, CurrentCellY + srcLineCnt].Visible == false)
190
                            {
191
                                //srcCellCnt = srcCellCnt - 1;
192
                                continue;
193
                            }
194
                            // ?\??t??????(?????\?????`?F?b?N???????)------------
195
                            // ?s??????[?h&(??I?s?????s???)
196
                            if (CurrentCellY + srcLineCnt == dgv.RowCount - 1 && dgv.AllowUserToAddRows == true)
197
                            {
198
                                dgv.RowCount = dgv.RowCount + 1;
199
                            }
200
                            // Lock???|?????????Cell??R?s?[??????
201
                            if (dgv[CurrentCellX + DestCellCnt, CurrentCellY + srcLineCnt].ReadOnly == false)
202
                                // ?\??t??
203
                                dgv[CurrentCellX + DestCellCnt, CurrentCellY + srcLineCnt].Value = vals[srcCellCnt];
204
                            // ------------------------------------------------------
205
                            //// ?\??t??????(?????\?????`?F?b?N?L????)------------
206
                            //String pststr = "";
207
                            //for (int i = 0; i <= vals[srcCellCnt].Length - 1; i++)
208
                            //{
209
                            //    _editingColumn = x + DestCellCnt;
210
                            //    byte[] cc = Encoding.GetEncoding("SHIFT-JIS").GetBytes(vals[srcCellCnt].Substring(i, 1));
211
                            //    KeyPressEventArgs tmpe = new KeyPressEventArgs((char)cc[0]);
212
                            //    tmpe.Handled = false;
213
                            //    DataGridViewPlus_CellKeyPress(sender, tmpe);
214
                            //    if (tmpe.Handled == false)
215
                            //    {
216
                            //        pststr = pststr + vals[srcCellCnt].Substring(i, 1);
217
                            //    }
218
                            //}
219
                            //// ?s??????[?h????I?s?????s???
220
                            //if (CurrentCellY + srcLineCnt == dgv.RowCount - 1 && dgv.AllowUserToAddRows == true)
221
                            //{
222
                            //    dgv.RowCount = dgv.RowCount + 1;
223
                            //}
224
                            //// ?\??t??
225
                            //dgv[CurrentCellX + destCellCnt, CurrentCellY + srcLineCnt].Value = pststr;
226
                            // ------------------------------------------------------
227
                            // ????Z????
228
                            DestCellCnt = DestCellCnt + 1;
229
                        }
230
                    }
231
                }
232
            }
233
            catch (Exception ex)
114 234
            {
115
                foreach (DataGridViewCell c in dgv.SelectedCells)
235
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
236
            }
237
        }
238
        #endregion
239

  
240
        #region // <---------> ??????\?b?h
241

  
242
        #region 1?s?f?[?^?A?b?v
243
        /// <summary>
244
        /// ?A?b?v?L?[????
245
        /// </summary>
246
        /// <param name="StartPoint">?s??????J?n?J??????u</param>
247
        /// <param name="EndPoint">?s??????I???J??????u</param>
248
        public void GridRowUpAction(int StartPoint, int EndPoint)
249
        {
250
            try
251
            {
252
                // ?J?????g?s????
253
                int nCurRow = base.CurrentCell.RowIndex;
254
                int nCurCol = base.CurrentCell.ColumnIndex;
255

  
256
                // ?J?????g?s???
257
                DataGridViewRow currentrow = base.CurrentRow;
258

  
259
                // ?P?s?O????
260
                DataGridViewRow frontrow = base.Rows[nCurRow - 1];
261

  
262
                // ??????
263
                // ?J?????g?s?????
264
                DataGridViewRow SaveRow = (DataGridViewRow)currentrow.Clone();
265
                for (int i = StartPoint; i <= EndPoint; i++)
116 266
                {
117
                    if (((DataGridView)sender).CurrentCell.ReadOnly == false)
267
                    SaveRow.Cells[i].Value = currentrow.Cells[i].Value;
268
                    SaveRow.Cells[i].Style = currentrow.Cells[i].Style;
269
                    SaveRow.Cells[i].ReadOnly = currentrow.Cells[i].ReadOnly;
270

  
271
                }
272

  
273
                // ?O?s???J?????g?s
274
                for (int i = StartPoint; i <= EndPoint; i++)
275
                {
276
                    currentrow.Cells[i].Value = frontrow.Cells[i].Value;
277
                    currentrow.Cells[i].Style = frontrow.Cells[i].Style;
278
                    currentrow.Cells[i].ReadOnly = frontrow.Cells[i].ReadOnly;
279
                }
280

  
281
                // ?J?????g?s???O?s
282
                for (int i = StartPoint; i <= EndPoint; i++)
283
                {
284
                    frontrow.Cells[i].Value = SaveRow.Cells[i].Value;
285
                    frontrow.Cells[i].Style = SaveRow.Cells[i].Style;
286
                    frontrow.Cells[i].ReadOnly = SaveRow.Cells[i].ReadOnly;
287
                }
288

  
289
                //dgv.FirstDisplayedScrollingRowIndex = curRow;
290
                base.CurrentCell = base[nCurCol, nCurRow - 1];
291
            }
292
            catch (System.Exception ex)
293
            {
294
                logger.ErrorFormat("?V?X?e???G???[?F{0}?F{1}", CommonMotions.GetMethodName(), ex.Message);
295
            }
296
        }
297
        #endregion
298

  
299
        #region 1?s?f?[?^?_?E??
300
        /// <summary>
301
        /// ?_?E???L?[????????
302
        /// </summary>
303
        /// <param name="sender"></param>
304
        /// <param name="e"></param>
305
        public void GridRowDownAction(int StartPoint, int EndPoint)
306
        {
307
            try
308
            {
309
                // ??I?s??????????
310
                if ((base.CurrentRow.Index + 1) == base.Rows.Count) return;
311

  
312
                // ?J?????g?s????
313
                int curRow = base.CurrentCell.RowIndex;
314
                int curCol = base.CurrentCell.ColumnIndex;
315

  
316
                // ?J?????g?s???
317
                DataGridViewRow currentrow = base.CurrentRow;
318

  
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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