プロジェクト

全般

プロフィール

リビジョン 100

堀内7年以上前に追加

出勤日報MySQL化・テーブル追加・行動予定入力修正・車両予約入力修正・未作成台帳確認修正(Div99マージ済み)

差分を表示:

branches/src/ProcessManagement/ProcessManagement/Common/CommonVersion.cs
14 14
        /// <summary>
15 15
        /// 本体バージョン
16 16
        /// </summary>
17
        public static int s_SystemVersion = 18;
17
        public static int s_SystemVersion = 1;
18 18

  
19 19
        /// <summary>
20 20
        /// コピー・環境バージョン
branches/src/ProcessManagement/ProcessManagement/DB/Core/ABaseDBProcess.cs
462 462
                mycmd = null;
463 463
            }
464 464
        }
465

  
465
        #endregion
466 466
    }
467
    #endregion
468 467
}
branches/src/ProcessManagement/ProcessManagement/DB/IOAccess/IOVehicleScheduleData.cs
29 29

  
30 30
        #region 定数
31 31
        /// <summary>
32
        /// 行動予定フィールド並び
32
        /// 車両予約フィールド並び
33 33
        /// </summary>
34 34
        public enum NameColumn
35 35
        {
......
57 57

  
58 58
        #endregion
59 59

  
60
        #region 行動予定検索
60
        #region 車両予約検索
61 61
        /// <summary>
62
        /// 行動予定検索
62
        /// 車両予約検索
63 63
        /// </summary>
64 64
        /// <param name="AddSQLString">検索条件SQL文字列</param>
65
        /// <param name="data">行動予定データ</param>
65
        /// <param name="data">車両予約データ</param>
66 66
        /// <returns>true:成功 false:失敗</returns>
67 67
        public bool SelectAction(string AddSQLString, ref List<VehicleScheduleData> data, bool bConnect = true)
68 68
        {
......
108 108
        }
109 109
        #endregion
110 110

  
111
        #region 行動予定複数追加
111
        #region 車両予約複数追加
112 112
        /// <summary>
113
        /// 行動予定複数追加
113
        /// 車両予約複数追加
114 114
        /// </summary>
115
        /// <param name="data">行動予定データ</param>
115
        /// <param name="data">車両予約データ</param>
116 116
        /// <returns>true:成功 false:失敗</returns>
117 117
        public bool InsertAction(List<VehicleScheduleData> data, bool bConnect = true)
118 118
        {
......
163 163
        }
164 164
        #endregion
165 165

  
166
        #region 行動予定1件追加
166
        #region 車両予約1件追加
167 167
        /// <summary>
168
        /// 行動予定1件追加
168
        /// 車両予約1件追加
169 169
        /// </summary>
170 170
        /// <param name="data"></param>
171 171
        /// <param name="bConnect"></param>
......
211 211
        }
212 212
        #endregion
213 213

  
214
        #region 行動予定更新
214
        #region 車両予約更新
215 215
        /// <summary>
216
        /// 行動予定更新
216
        /// 車両予約更新
217 217
        /// </summary>
218 218
        /// <param name="AddSQLString">更新条件SQL文字列</param>
219
        /// <param name="data">行動予定データ</param>
219
        /// <param name="data">車両予約データ</param>
220 220
        /// <returns>true:成功 false:失敗</returns>
221 221
        public bool UpdateAction(string AddSQLString, VehicleScheduleData data, bool bConnect = true)
222 222
        {
......
251 251
        }
252 252
        #endregion
253 253

  
254
        #region 行動予定削除
254
        #region 車両予約削除
255 255
        /// <summary>
256
        /// 行動予定削除
256
        /// 車両予約削除
257 257
        /// </summary>
258 258
        /// <param name="AddSQLString">削除条件SQL文字列</param>
259
        /// <param name="data">行動予定データ</param>
259
        /// <param name="data">車両予約データ</param>
260 260
        /// <returns>true:成功 false:失敗</returns>
261 261
        public bool DeleteAction(string AddSQLString, bool bConnect = true)
262 262
        {
branches/src/ProcessManagement/ProcessManagement/Forms/DataEntry/DRWork/FrmDRWorkAuxiliary.cs
208 208
                m_DspControl[(int)DspCtrlName.ConstructionDayFrom].Text = "1";
209 209
                m_DspControl[(int)DspCtrlName.ConstructionDayTo].Text = m_LastDays.ToString("00");
210 210

  
211
                string strSQL = "SELECT AX.DT, DATE_FORMAT(C.HOLIDAY,'%Y/%m/%d'), D.ACTIONRESULT, D.OVERTIMEHOURS, D.WORKINGCOMMENT FROM";
212
                strSQL += " (SELECT DATE_FORMAT((st+ROWNUM-1), '%Y/%m/%d') DT";
213
                strSQL += " FROM SYS.ALL_CATALOG A,";
214
                strSQL += string.Format(" (SELECT STR_TO_DATE('{0}','%Y%m%d') st,", (WorktDate.Year.ToString() + WorktDate.Month.ToString("00") + "01"));
215
                strSQL += string.Format(" STR_TO_DATE('{0}','%Y%m%d') ed FROM SYS.DUAL) B", (WorktDate.Year.ToString() + WorktDate.Month.ToString("00") + m_LastDays.ToString("00")));
216
                strSQL += " WHERE ROWNUM <= (ed - st + 1)) AX";
217
                strSQL += " LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = AX.DT";
218
                strSQL += string.Format(" LEFT JOIN ATTENDANCEDAILYDATA D ON  D.PERSONCODE = {0} AND D.ATTENDANCEDATE = AX.DT", PersonCode);
219
                strSQL += " ORDER BY AX.DT, D.SEQNO";
211
                // 指定日の翌日より指定日数分の日付を取得する
212
                string strSQL = "SELECT";
213
                strSQL += " t1.d, DATE_FORMAT(C.HOLIDAY, '%Y/%m/%d') HOLIDAY, D.ACTIONRESULT, D.OVERTIMEHOURS, D.WORKINGCOMMENT";
214
                strSQL += " FROM";
215
                
216
                strSQL += " (SELECT A1.years, A2.month, A3.days, CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as  DATE) as d";
217
                strSQL += " FROM yearmaster as A1, monthmaster as A2, daymaster as A3";
218
                strSQL += string.Format(" WHERE A1.years = {0}", WorktDate.Year);
219
                strSQL += string.Format(" AND A2.month = {0}", WorktDate.Month);
220
                strSQL += " AND CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as DATE) IS NOT NULL) t1";
220 221

  
222
                strSQL += " LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = t1.d";
223
                strSQL += " LEFT JOIN ATTENDANCEDAILYDATA D ON D.PERSONCODE = 20010104 AND D.ATTENDANCEDATE = t1.d";
224
                strSQL += " ORDER BY t1.d, D.SEQNO";
225

  
221 226
                ArrayList arList = new ArrayList();
222 227
                if (!calDB.ExecuteReader(strSQL, ref arList)) return;
223 228
                DateTime DispDate = DateTime.Now;
......
322 327
                m_DspControl[(int)DspCtrlName.ConstructionDayFrom].Text = "1";
323 328
                m_DspControl[(int)DspCtrlName.ConstructionDayTo].Text = m_LastDays.ToString("00");
324 329

  
325
                string strSQL = "SELECT AX.DT,";                        // 0
330
                string strSQL = "SELECT t1.d,";                         // 0
326 331
                strSQL += " DATE_FORMAT(C.HOLIDAY,'%Y/%m/%d'),";        // 1
327 332
                strSQL += " D.StartDistance,";                          // 2
328 333
                strSQL += " D.ComplateDistance,";                       // 3
......
333 338
                strSQL += " D.TrancePayOutFlg,";                        // 8
334 339
                strSQL += " D.WareHouseFlg";                            // 9
335 340
                strSQL += " FROM";
336
                strSQL += " (SELECT DATE_FORMAT((st+ROWNUM-1), '%Y/%m/%d') DT FROM SYS.ALL_CATALOG A,";
337
                strSQL += string.Format(" (SELECT STR_TO_DATE('{0}','%Y%m%d') st,", (WorktDate.Year.ToString() + WorktDate.Month.ToString("00") + "01"));
338
                strSQL += string.Format(" STR_TO_DATE('{0}','%Y%m%d') ed FROM DUAL) B", (WorktDate.Year.ToString() + WorktDate.Month.ToString("00") + m_LastDays.ToString("00")));
339
                strSQL += " WHERE ROWNUM <= (ed - st + 1)) AX";
340
                strSQL += " LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = AX.DT";
341
                strSQL += string.Format(" LEFT JOIN TRANCEPORTDAILYDATA D ON  D.PERSONCODE = {0} AND D.ATTENDANCEDATE = AX.DT", PersonCode);
342
                strSQL += " ORDER BY AX.DT";
343 341

  
342
                strSQL += " (SELECT A1.years, A2.month, A3.days, CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as  DATE) as d";
343
                strSQL += " FROM yearmaster as A1, monthmaster as A2, daymaster as A3";
344
                strSQL += string.Format(" WHERE A1.years = {0}", WorktDate.Year);
345
                strSQL += string.Format(" AND A2.month = {0}", WorktDate.Month);
346
                strSQL += " AND CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as DATE) IS NOT NULL) t1";
347

  
348
                strSQL += " LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = t1.d";
349
                strSQL += string.Format(" LEFT JOIN TRANCEPORTDAILYDATA D ON  D.PERSONCODE = {0} AND D.ATTENDANCEDATE = t1.d", PersonCode);
350
                strSQL += " ORDER BY t1.d";
351

  
344 352
                ArrayList arList = new ArrayList();
345 353
                if (!calDB.ExecuteReader(strSQL, ref arList)) return;
346 354
                DateTime DispDate = DateTime.Now;
......
1233 1241

  
1234 1242
                // まず削除する
1235 1243
                string strSQL = string.Format(" WHERE PersonCode = {0}", PersonCode);
1236
                strSQL += string.Format(" AND DATE_FORMAT(AttendanceMonth,'YYYY/MM') = '{0}'", TargetMonth);
1244
                strSQL += string.Format(" AND DATE_FORMAT(AttendanceMonth,'%Y/%m') = '{0}'", TargetMonth);
1237 1245
                AttendanceDB.DeleteAction(strSQL, false);
1238 1246

  
1239 1247
                // グリッド取得
......
1282 1290

  
1283 1291
                // まず削除する
1284 1292
                string strSQL = string.Format(" WHERE PersonCode = {0}", PersonCode);
1285
                strSQL += string.Format(" AND DATE_FORMAT(ATTENDANCEMONTH,'YYYY/MM') = '{0}'", TargetMonth);
1293
                strSQL += string.Format(" AND DATE_FORMAT(AttendanceDate,'%Y/%m') = '{0}'", TargetMonth);
1286 1294
                AttendanceDB.DeleteAction(strSQL, false);
1287 1295

  
1288 1296
                // グリッド取得
......
1314 1322
                        LineCnt = 1;
1315 1323
                    }
1316 1324

  
1317
                    // SQL作成
1318
                    SetRowToSQL1(wrkRow, LineCnt++, ref NewList);
1325
                    // データ作成
1326
                    SetRowToStruct1(wrkRow, LineCnt++, ref NewList);
1319 1327
                }
1320 1328

  
1321 1329
                if (NewList.Count < 1) return true;
......
1336 1344
        }
1337 1345
        #endregion
1338 1346

  
1339
        #region 出勤日報データ作成SQL
1347
        #region 登録出勤日報データ作成
1340 1348
        /// <summary>
1341
        /// 出勤日報データ作成SQL
1349
        /// 登録出勤日報データ作成
1342 1350
        /// </summary>
1343 1351
        /// <param name="wrkRow"></param>
1344 1352
        /// <param name="LineCnt"></param>
1345 1353
        /// <param name="strSQL"></param>
1346
        private void SetRowToSQL1(DataGridViewRow wrkRow, int LineCnt, ref List<AttendanceDailyData> NewList)
1354
        private void SetRowToStruct1(DataGridViewRow wrkRow, int LineCnt, ref List<AttendanceDailyData> NewList)
1347 1355
        {
1348 1356
            try
1349 1357
            {
......
1390 1398

  
1391 1399
                // まず削除する
1392 1400
                string strSQL = string.Format(" WHERE PersonCode = {0}", PersonCode);
1393
                strSQL += string.Format(" AND DATE_FORMAT(ATTENDANCEMONTH,'%Y/%m') = '{0}'", TargetMonth);
1401
                strSQL += string.Format(" AND DATE_FORMAT(AttendanceDate,'%Y/%m') = '{0}'", TargetMonth);
1394 1402
                TranceportDB.DeleteAction(strSQL, false);
1395 1403

  
1396 1404
                string strInsert = string.Empty;
......
1401 1409
                    // 有効行のチェック
1402 1410
                    if (!ChkTranTraceportRow(wrkRow)) continue;
1403 1411

  
1404
                    SetRowToSQL2(PersonCode, wrkRow, ref NewList);
1412
                    SetRowToStruct2(PersonCode, wrkRow, ref NewList);
1405 1413
                    
1406 1414
                }
1407 1415

  
......
1410 1418
                    // 有効行のチェック
1411 1419
                    if (!ChkTranTraceportRow(wrkRow)) continue;
1412 1420

  
1413
                    SetRowToSQL2(PersonCode, wrkRow, ref NewList);
1421
                    SetRowToStruct2(PersonCode, wrkRow, ref NewList);
1414 1422

  
1415 1423
                }
1416 1424

  
......
1481 1489
        }
1482 1490
        #endregion
1483 1491

  
1484
        #region 出勤交通費データ取り込み
1492
        #region 登録出勤交通費データ作成
1485 1493
        /// <summary>
1486
        /// 出勤交通費データ取り込み
1494
        /// 登録出勤交通費データ作成
1487 1495
        /// </summary>
1488 1496
        /// <returns></returns>
1489
        private void SetRowToSQL2(int PersonCode, DataGridViewRow wrkRow, ref List<TranceportDailyData> NewList)
1497
        private void SetRowToStruct2(int PersonCode, DataGridViewRow wrkRow, ref List<TranceportDailyData> NewList)
1490 1498
        {
1491 1499
            try
1492 1500
            {
......
1557 1565

  
1558 1566
                // 削除する
1559 1567
                string strSQL = string.Format(" WHERE PersonCode = {0}", PersonCode);
1560
                strSQL += string.Format(" AND DATE_FORMAT(ATTENDANCEMONTH,'%Y/%m') = '{0}'", TargetMonth);
1568
                strSQL += string.Format(" AND DATE_FORMAT(AttendanceDate,'%Y/%m') = '{0}'", TargetMonth);
1561 1569
                AttendanceDB.DeleteAction(strSQL, false);
1562 1570

  
1563 1571
                // 削除する
branches/src/ProcessManagement/ProcessManagement/Forms/Master/Calender/FrmCalendarAuxiliary.cs
386 386
                for (int i = 0; i < MonthCnt; i++)
387 387
                {
388 388
                    if (m_CalendPage.lblMonthTitle[i].Text.Length == 0) continue;
389

  
390
                    // 該当年を検索する
391
                    string nen = m_CalendPage.lblMonthTitle[i].Text.Substring(0, m_CalendPage.lblMonthTitle[i].Text.IndexOf("年"));
392
                    int tergetYear = CommonMotions.cnvInt(nen);
389 393
                    // 該当月を検索する
390 394
                    string wrkTuki = m_CalendPage.lblMonthTitle[i].Text.Substring(m_CalendPage.lblMonthTitle[i].Text.IndexOf("年") + 1, 2);
391 395
                    int tergetMonth = CommonMotions.cnvInt(wrkTuki);
392 396

  
393
                    int DayCnt = m_CalendPage.MonthryData[i].lblDayData.Length;
394
                    for (int ix = 0; ix < DayCnt; ix++)
397
                    string strGetMonth = "SELECT t1.d, DATE_FORMAT(C.HOLIDAY, '%Y/%m/%d') HOLIDAY FROM";
398
                    strGetMonth += " (SELECT A1.years, A2.month, A3.days, CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as  DATE) as d";
399
                    strGetMonth += " FROM yearmaster as A1, monthmaster as A2, daymaster as A3";
400
                    strGetMonth += string.Format(" WHERE A1.years = {0}", tergetYear);
401
                    strGetMonth += string.Format(" AND A2.month = {0}", tergetMonth);
402
                    strGetMonth += " AND CAST(CONCAT(A1.years, '/', A2.month, '/', A3.days) as DATE) IS NOT NULL) t1";
403
                    strGetMonth += " LEFT JOIN HOLIDAYCALENDERMASTER C ON C.HOLIDAY = t1.d";
404
                    strGetMonth += " ORDER BY t1.d";
405

  
406
                    ArrayList dataList = new ArrayList();
407
                    if (!hcDB.ExecuteReader(strGetMonth, ref dataList)) continue;
408
                    if (dataList.Count == 0) continue;
409

  
410
                    int lblDayCnt = m_CalendPage.MonthryData[i].lblDayData.Length;
411
                    object[] CurData = null;
412
                    for (int ix = 0; ix < lblDayCnt; ix++)
395 413
                    {
396 414
                        if (m_CalendPage.MonthryData[i].lblDayData[ix].Text.Length == 0) continue;
397 415

  
398
                        // 該当日を検索する
399
                        string wrkHi = m_CalendPage.MonthryData[i].lblDayData[ix].Text;
400
                        int tergetDay = CommonMotions.cnvInt(wrkHi);
416
                        // ラベルの日付より取得データの位置を取る
417
                        int daycnt = CommonMotions.cnvInt(m_CalendPage.MonthryData[i].lblDayData[ix].Text) - 1;
418
                        CurData = (object[])dataList[daycnt];
419
                        if (CommonMotions.cnvDate(CurData[1]) == DateTime.MinValue) continue;
401 420

  
402
                        string nen = m_CalendPage.lblMonthTitle[i].Text.Substring(0, m_CalendPage.lblMonthTitle[i].Text.IndexOf("年"));
403
                        DateTime dtter = DateTime.Parse(nen + "/" + wrkTuki + "/" + wrkHi);
404
                        string strSQL = hcDB.CreatePrimarykeyString(dtter);
405

  
406
                        //string strSQL = hcDB.CreateSubkeyString(ClsCommon.cnvInt(txtInput01.Text), tergetMonth, tergetDay);
407
                        List<HolidayCalenderMaster> dataList = new List<HolidayCalenderMaster>();
408
                        //Console.Write("Start Time={0}   {1}\n", DateTime.Now.ToString("HH:mm:ss.fff"), strSQL);
409

  
410
                        if (!hcDB.SelectAction(strSQL, ref dataList)) continue;
411
                        if (dataList.Count == 0) continue;
412
                        
413
                        //Console.Write("End   Time={0}\n", DateTime.Now.ToString("HH:mm:ss.fff"));
414

  
415 421
                        m_CalendPage.MonthryData[i].lblDayData[ix].BackColor = Color.Red;
416 422
                    }
417 423
                }
branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/_FrmConstructionType.designer.cs
1
using ProcessManagement.Forms.CustomControls;
2

  
3
namespace ProcessManagement.Forms.Master
4
{
5
    partial class FrmConstructionType
6
    {
7
        /// <summary>
8
        /// 必要なデザイナ変数です。
9
        /// </summary>
10
        private System.ComponentModel.IContainer components = null;
11

  
12
        /// <summary>
13
        /// 使用中のリソースをすべてクリーンアップします。
14
        /// </summary>
15
        /// <param name="disposing">マネージ リソースが破棄される場合 true、破棄されない場合は false です。</param>
16
        protected override void Dispose(bool disposing)
17
        {
18
            if (disposing && (components != null))
19
            {
20
                components.Dispose();
21
            }
22
            base.Dispose(disposing);
23
        }
24

  
25
        #region Windows フォーム デザイナで生成されたコード
26

  
27
        /// <summary>
28
        /// デザイナ サポートに必要なメソッドです。このメソッドの内容を
29
        /// コード エディタで変更しないでください。
30
        /// </summary>
31
        private void InitializeComponent()
32
        {
33
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
34
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
35
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
36
            this.btnDataEntry = new System.Windows.Forms.Button();
37
            this.btnLineEntry = new System.Windows.Forms.Button();
38
            this.btnLineDelete = new System.Windows.Forms.Button();
39
            this.btnEnd = new System.Windows.Forms.Button();
40
            this.lblTitile = new System.Windows.Forms.Label();
41
            this.dgvMaster = new ProcessManagement.Forms.CustomControls.DataGridViewEX();
42
            this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
43
            this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
44
            this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
45
            this.Column5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
46
            this.btnDispDown = new System.Windows.Forms.Button();
47
            this.btnDispUp = new System.Windows.Forms.Button();
48
            ((System.ComponentModel.ISupportInitialize)(this.dgvMaster)).BeginInit();
49
            this.SuspendLayout();
50
            // 
51
            // btnDataEntry
52
            // 
53
            this.btnDataEntry.BackColor = System.Drawing.Color.Green;
54
            this.btnDataEntry.ForeColor = System.Drawing.Color.White;
55
            this.btnDataEntry.Location = new System.Drawing.Point(144, 650);
56
            this.btnDataEntry.Name = "btnDataEntry";
57
            this.btnDataEntry.Size = new System.Drawing.Size(120, 30);
58
            this.btnDataEntry.TabIndex = 1;
59
            this.btnDataEntry.Text = "登 録";
60
            this.btnDataEntry.UseVisualStyleBackColor = false;
61
            this.btnDataEntry.Click += new System.EventHandler(this.btnDataEntry_Click);
62
            // 
63
            // btnLineEntry
64
            // 
65
            this.btnLineEntry.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(255)))), ((int)(((byte)(128)))));
66
            this.btnLineEntry.Location = new System.Drawing.Point(272, 650);
67
            this.btnLineEntry.Name = "btnLineEntry";
68
            this.btnLineEntry.Size = new System.Drawing.Size(120, 30);
69
            this.btnLineEntry.TabIndex = 2;
70
            this.btnLineEntry.Text = "追 加";
71
            this.btnLineEntry.UseVisualStyleBackColor = false;
72
            this.btnLineEntry.Click += new System.EventHandler(this.btnLineEntry_Click);
73
            // 
74
            // btnLineDelete
75
            // 
76
            this.btnLineDelete.BackColor = System.Drawing.Color.Red;
77
            this.btnLineDelete.ForeColor = System.Drawing.Color.White;
78
            this.btnLineDelete.Location = new System.Drawing.Point(400, 650);
79
            this.btnLineDelete.Name = "btnLineDelete";
80
            this.btnLineDelete.Size = new System.Drawing.Size(120, 30);
81
            this.btnLineDelete.TabIndex = 3;
82
            this.btnLineDelete.Text = "削 除";
83
            this.btnLineDelete.UseVisualStyleBackColor = false;
84
            this.btnLineDelete.Click += new System.EventHandler(this.btnLineDelete_Click);
85
            // 
86
            // btnEnd
87
            // 
88
            this.btnEnd.BackColor = System.Drawing.Color.Blue;
89
            this.btnEnd.ForeColor = System.Drawing.Color.White;
90
            this.btnEnd.Location = new System.Drawing.Point(528, 650);
91
            this.btnEnd.Name = "btnEnd";
92
            this.btnEnd.Size = new System.Drawing.Size(120, 30);
93
            this.btnEnd.TabIndex = 4;
94
            this.btnEnd.Text = "終 了";
95
            this.btnEnd.UseVisualStyleBackColor = false;
96
            this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click);
97
            // 
98
            // lblTitile
99
            // 
100
            this.lblTitile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(128)))));
101
            this.lblTitile.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
102
            this.lblTitile.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
103
            this.lblTitile.ForeColor = System.Drawing.Color.Black;
104
            this.lblTitile.Location = new System.Drawing.Point(100, 10);
105
            this.lblTitile.Name = "lblTitile";
106
            this.lblTitile.Size = new System.Drawing.Size(500, 20);
107
            this.lblTitile.TabIndex = 6;
108
            this.lblTitile.Text = "工事種別マスタメンテナンス";
109
            this.lblTitile.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
110
            // 
111
            // dgvMaster
112
            // 
113
            this.dgvMaster.AllowUserToAddRows = false;
114
            this.dgvMaster.AllowUserToDeleteRows = false;
115
            this.dgvMaster.AllowUserToResizeColumns = false;
116
            this.dgvMaster.AllowUserToResizeRows = false;
117
            this.dgvMaster.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
118
            dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
119
            dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
120
            dataGridViewCellStyle1.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
121
            dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
122
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
123
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
124
            dataGridViewCellStyle1.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
125
            this.dgvMaster.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
126
            this.dgvMaster.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
127
            this.dgvMaster.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
128
            this.Column1,
129
            this.Column2,
130
            this.Column3,
131
            this.Column5});
132
            this.dgvMaster.Location = new System.Drawing.Point(8, 40);
133
            this.dgvMaster.Name = "dgvMaster";
134
            this.dgvMaster.RowHeadersWidth = 20;
135
            this.dgvMaster.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
136
            this.dgvMaster.RowTemplate.Height = 21;
137
            this.dgvMaster.Size = new System.Drawing.Size(640, 602);
138
            this.dgvMaster.TabIndex = 0;
139
            this.dgvMaster.CellEnter += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvMaster_CellEnter);
140
            this.dgvMaster.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvMaster_CellValueChanged);
141
            // 
142
            // Column1
143
            // 
144
            dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
145
            dataGridViewCellStyle2.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
146
            this.Column1.DefaultCellStyle = dataGridViewCellStyle2;
147
            this.Column1.Frozen = true;
148
            this.Column1.HeaderText = "№";
149
            this.Column1.Name = "Column1";
150
            this.Column1.ReadOnly = true;
151
            this.Column1.Resizable = System.Windows.Forms.DataGridViewTriState.False;
152
            this.Column1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
153
            // 
154
            // Column2
155
            // 
156
            this.Column2.Frozen = true;
157
            this.Column2.HeaderText = "名称コード";
158
            this.Column2.Name = "Column2";
159
            this.Column2.ReadOnly = true;
160
            this.Column2.Visible = false;
161
            // 
162
            // Column3
163
            // 
164
            dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
165
            dataGridViewCellStyle3.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
166
            this.Column3.DefaultCellStyle = dataGridViewCellStyle3;
167
            this.Column3.Frozen = true;
168
            this.Column3.HeaderText = "名   称";
169
            this.Column3.MaxInputLength = 50;
170
            this.Column3.Name = "Column3";
171
            this.Column3.Resizable = System.Windows.Forms.DataGridViewTriState.False;
172
            this.Column3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable;
173
            this.Column3.Width = 500;
174
            // 
175
            // Column5
176
            // 
177
            this.Column5.HeaderText = "NewFlg";
178
            this.Column5.Name = "Column5";
179
            this.Column5.ReadOnly = true;
180
            this.Column5.Visible = false;
181
            // 
182
            // btnDispDown
183
            // 
184
            this.btnDispDown.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
185
            this.btnDispDown.Location = new System.Drawing.Point(653, 300);
186
            this.btnDispDown.Name = "btnDispDown";
187
            this.btnDispDown.Size = new System.Drawing.Size(40, 40);
188
            this.btnDispDown.TabIndex = 10;
189
            this.btnDispDown.Text = "▼";
190
            this.btnDispDown.UseVisualStyleBackColor = true;
191
            this.btnDispDown.Click += new System.EventHandler(this.btnDispDown_Click);
192
            // 
193
            // btnDispUp
194
            // 
195
            this.btnDispUp.Font = new System.Drawing.Font("MS 明朝", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
196
            this.btnDispUp.Location = new System.Drawing.Point(653, 236);
197
            this.btnDispUp.Name = "btnDispUp";
198
            this.btnDispUp.Size = new System.Drawing.Size(40, 40);
199
            this.btnDispUp.TabIndex = 9;
200
            this.btnDispUp.Text = "▲";
201
            this.btnDispUp.UseVisualStyleBackColor = true;
202
            this.btnDispUp.Click += new System.EventHandler(this.btnDispUp_Click);
203
            // 
204
            // FrmConstructionType
205
            // 
206
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
207
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
208
            this.BackColor = System.Drawing.Color.Black;
209
            this.ClientSize = new System.Drawing.Size(700, 687);
210
            this.Controls.Add(this.btnDispDown);
211
            this.Controls.Add(this.btnDispUp);
212
            this.Controls.Add(this.lblTitile);
213
            this.Controls.Add(this.btnDataEntry);
214
            this.Controls.Add(this.btnLineEntry);
215
            this.Controls.Add(this.btnLineDelete);
216
            this.Controls.Add(this.btnEnd);
217
            this.Controls.Add(this.dgvMaster);
218
            this.Font = new System.Drawing.Font("MS 明朝", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
219
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
220
            this.KeyPreview = true;
221
            this.MaximizeBox = false;
222
            this.Name = "FrmConstructionType";
223
            this.ShowIcon = false;
224
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
225
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmConstructionType_FormClosing);
226
            this.Load += new System.EventHandler(this.FrmConstructionType_Load);
227
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.FrmConstructionType_KeyDown);
228
            ((System.ComponentModel.ISupportInitialize)(this.dgvMaster)).EndInit();
229
            this.ResumeLayout(false);
230

  
231
        }
232

  
233
        #endregion
234

  
235
        private DataGridViewEX dgvMaster;
236
        private System.Windows.Forms.Button btnDataEntry;
237
        private System.Windows.Forms.Button btnLineEntry;
238
        private System.Windows.Forms.Button btnLineDelete;
239
        private System.Windows.Forms.Button btnEnd;
240
        private System.Windows.Forms.Label lblTitile;
241
        private System.Windows.Forms.Button btnDispDown;
242
        private System.Windows.Forms.Button btnDispUp;
243
        private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
244
        private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
245
        private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
246
        private System.Windows.Forms.DataGridViewTextBoxColumn Column5;
247
    }
248
}
branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/_FrmConstructionType.cs
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Text;
7
using System.Windows.Forms;
8

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

  
13
using ProcessManagement.Common;
14
using ProcessManagement.DB.IOAccess;
15
using ProcessManagement.DataModel;
16
using ProcessManagement.DB.Core;
17
using ProcessManagement.Forms.SubForms;
18
using ProcessManagement.Forms.CustomControls;
19
using ProcessManagement.Forms.ControlsAction;
20
//*------------------------ 工事種別メンテ画面 ------------------------------*
21
//  2015/11/07  Ver1.0.0.0      Create Source           
22
//
23
//
24
//
25
//*----------------------------------------------------------------------------*
26
namespace ProcessManagement.Forms.Master
27
{
28
    public partial class FrmConstructionType : Form
29
    {
30
        #region 使用定義
31
        //log4netログを使用する
32
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
33
        #endregion
34

  
35
        #region 定数
36
        /// <summary>
37
        /// 表示カラム
38
        /// </summary>
39
        private enum DispColumn
40
        {
41
            No = 0,
42
            TypeCode,
43
            NameString,
44
            NewFlg,
45
        }
46

  
47
        /// <summary>
48
        /// マスタリストMAXライン
49
        /// </summary>
50
        private const int s_ListMaxLineCount = 53;
51
        #endregion
52

  
53
        #region 変数
54
        /// <summary>
55
        /// フィールド値変化フラグ
56
        /// </summary>
57
        private bool m_bChengeAns = false;
58

  
59
        /// <summary>
60
        /// 初期時グリッドカウント
61
        /// </summary>
62
        private int m_initDataCount = 0;
63

  
64
        /// <summary>
65
        /// 名称キー
66
        /// </summary>
67
        private int m_NameCode = 0;
68
        /// <summary>
69
        /// ダイアログ使用時フラグ
70
        /// </summary>
71
        private bool m_DialogFlg = false;
72
        #endregion
73

  
74
        #region プロパティ
75
        /// <summary>
76
        /// ダイアログ使用時フラグ
77
        /// </summary>
78
        public bool DialogUsed
79
        {
80
            set { m_DialogFlg = value; }
81
        }
82
        /// <summary>
83
        /// 名称コード
84
        /// </summary>
85
        public int NameCode
86
        {
87
            get { return m_NameCode; }
88
            set { m_NameCode = value; }
89
        }
90
        #endregion
91

  
92
        #region コンストラクタ
93
        public FrmConstructionType()
94
        {
95
            InitializeComponent();
96
        }
97
        #endregion
98
        #region デストラクタ
99
        ~FrmConstructionType()
100
        {
101
            try
102
            {
103
                GC.Collect();
104
            }
105
            catch (Exception ex)
106
            {
107
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
108
            }
109
        }
110
        #endregion
111

  
112
        #region イベントメソッド
113
        /// <summary>
114
        /// ×ボタン押下処理
115
        /// </summary>
116
        /// <param name="sender"></param>
117
        /// <param name="e"></param>
118
        private void FrmConstructionType_FormClosing(object sender, FormClosingEventArgs e)
119
        {
120
            if (m_bChengeAns)
121
            {
122
                if (MessageBox.Show("データに変更があります、登録せずに終了してよろしいですか?。", "終了確認"
123
                                , MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.No)
124
                {
125
                    e.Cancel = true;
126
                    return;
127
                }
128
            }
129
            // 前プロセスに戻る
130
            ClsExcute.BackProcess();
131
        }
132
        /// <summary>
133
        /// 終了ボタン押下
134
        /// </summary>
135
        /// <param name="sender"></param>
136
        /// <param name="e"></param>
137
        private void btnEnd_Click(object sender, EventArgs e)
138
        {
139
            this.Close();
140
        }
141

  
142
        /// <summary>
143
        /// フォームロード
144
        /// </summary>
145
        /// <param name="sender"></param>
146
        /// <param name="e"></param>
147
        private void FrmConstructionType_Load(object sender, EventArgs e)
148
        {
149
            // 初期表示
150
            InitDataLoad();
151
            // ダイアログ使用時
152
            if (m_DialogFlg)
153
            {
154
                //フォームの幅だけを変更する
155
                this.SetBounds(this.Left, this.Top, (this.Width - 40), this.Height, BoundsSpecified.Width);
156
            }
157
            // フォームサイズ固定
158
            this.MaximizedBounds = new Rectangle(this.Left, this.Top, this.Width, this.Height);
159
        }
160

  
161
        /// <summary>
162
        /// 行データクリア
163
        /// </summary>
164
        /// <param name="iIndex">行カウント</param>
165
        private void SetRowClearData(int iIndex, bool bfront = true)
166
        {
167
            // クリアデータセット
168
            dgvMaster[(int)DispColumn.No, iIndex].Value = "0";
169
            dgvMaster[(int)DispColumn.TypeCode, iIndex].Value = "";
170
            dgvMaster[(int)DispColumn.NameString, iIndex].Value = "";
171
            dgvMaster[(int)DispColumn.NewFlg, iIndex].Value = "1";
172

  
173
        }
174
        /// <summary>
175
        /// グリッド採番処理
176
        /// </summary>
177
        private void LineReNumbering()
178
        {
179
            int icnt = 1;
180
            foreach (DataGridViewRow r in dgvMaster.Rows)
181
            {
182
                if (CommonMotions.chkObjectIsNull(r.Cells[(int)DispColumn.NameString].Value)) continue;
183
                if (r.Cells[(int)DispColumn.NameString].Value.ToString().Length == 0) continue;
184

  
185
                // 表示されているものだけ採番
186
                if (r.Visible)
187
                    r.Cells[(int)DispColumn.No].Value = (icnt++).ToString();
188
                else
189
                    r.Cells[(int)DispColumn.No].Value = "0";
190
            }
191
        }
192
        /// <summary>
193
        /// 行追加ボタン押下
194
        /// </summary>
195
        /// <param name="sender"></param>
196
        /// <param name="e"></param>
197
        private void btnLineEntry_Click(object sender, EventArgs e)
198
        {
199
            // 行がない場合は作成して抜ける
200
            if (dgvMaster.Rows.Count == 0)
201
            {
202
                if (MessageBox.Show("行を追加します", "追加確認"
203
                                    , MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel) return;
204

  
205
                // 行追加
206
                dgvMaster.Rows.Add();
207
                // クリアデータセット
208
                SetRowClearData(0);
209
                // №再採番
210
                LineReNumbering();
211
                // 変更フラグOn
212
                valueChange(sender, e);
213
                // フォーカス移動
214
                dgvMaster.Focus();
215
                return;
216
            }
217

  
218
            // メッセージ表示
219
            BtnTextCustomMessageBox msg = new BtnTextCustomMessageBox();
220
            msg.ButtonText.No = "前へ追加";
221
            msg.ButtonText.Yes = "後へ追加";
222
            msg.ButtonText.Cancel = "キャンセル";
223
            DialogResult resRet = msg.Show("行の前・後を選択してください。", "追加確認"
224
                                            , MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
225

  
226
            // キャンセルは処理しない
227
            if (resRet == DialogResult.Cancel) return;
228

  
229
            // カレント行取得
230
            int iIndex = dgvMaster.CurrentRow.Index;
231

  
232
            // 最終行
233
            if (iIndex == dgvMaster.RowCount - 1)
234
            {
235
                if (resRet == DialogResult.No)
236
                {
237
                    // 前
238
                    dgvMaster.Rows.Insert(iIndex);
239
                }
240
                else if (resRet == DialogResult.Yes)
241
                {
242
                    // 後
243
                    dgvMaster.Rows.Add();
244
                    iIndex = (dgvMaster.RowCount - 1);
245
                }
246
            }
247
            else
248
            {
249
                if (resRet == DialogResult.Yes)
250
                {
251
                    // 後ろ
252
                    ++iIndex;
253
                }
254
                dgvMaster.Rows.Insert(iIndex);
255
            }
256

  
257
            // クリアデータセット
258
            if ((iIndex + 1) >= dgvMaster.Rows.Count)
259
                SetRowClearData(iIndex, true);
260
            else
261
                SetRowClearData(iIndex, false);
262

  
263
            // №再採番
264
            LineReNumbering();
265

  
266
            // 変更フラグOn
267
            valueChange(sender, e);
268

  
269
            // フォーカス移動
270
            dgvMaster.Focus();
271
            //dgvMaster.FirstDisplayedScrollingRowIndex = iIndex;
272
            //dgvMaster.CurrentCell = dgvMaster[0, iIndex];
273
        }
274

  
275
        /// <summary>
276
        /// フィールド値変更フラグ
277
        /// </summary>
278
        /// <param name="sender"></param>
279
        /// <param name="e"></param>
280
        private void valueChange(object sender, EventArgs e)
281
        {
282
            m_bChengeAns = true;
283
        }
284

  
285
        /// <summary>
286
        /// セル値変化
287
        /// </summary>
288
        /// <param name="sender"></param>
289
        /// <param name="e"></param>
290
        private void dgvMaster_CellValueChanged(object sender, DataGridViewCellEventArgs e)
291
        {
292
            // インデックス外は処理しない
293
            if (e.RowIndex < 0 || e.ColumnIndex < 0) return;
294
            // null値は処理しない
295
            if (CommonMotions.chkObjectIsNull(dgvMaster.Rows[e.RowIndex].Cells[e.ColumnIndex].Value)) return;
296

  
297
            dgvMaster.Rows[e.RowIndex].Cells[e.ColumnIndex].ToolTipText
298
                = ((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
299
            
300
            // 変更フラグON
301
            m_bChengeAns = true;
302
        }
303
        /// <summary>
304
        /// 行削除ボタン押下
305
        /// </summary>
306
        /// <param name="sender"></param>
307
        /// <param name="e"></param>
308
        private void btnLineDelete_Click(object sender, EventArgs e)
309
        {
310
            
311
            IOMConstructionType ctDB = new IOMConstructionType();
312
            IOMConstructionSpecUnitPrice csuDB = new IOMConstructionSpecUnitPrice();
313
            try
314
            {
315
                if (CommonMotions.chkCellBlank(dgvMaster.CurrentRow.Cells[(int)DispColumn.NameString].Value)) return;
316

  
317
                if (MessageBox.Show("選択した行データを削除します。", "削除確認"
318
                    , MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes) return;
319

  
320

  
321
                // 表示行退避
322
                int iIndex = dgvMaster.FirstDisplayedScrollingRowIndex;
323

  
324
                ctDB.connect(); ctDB.beginTran();
325
                csuDB.connect(); csuDB.beginTran();
326

  
327
                int TypeCode = CommonMotions.cnvInt(dgvMaster.CurrentRow.Cells[(int)DispColumn.TypeCode].Value.ToString());
328
                string strSQL = ctDB.CreatePrimarykeyString(TypeCode);
329
                if (!ctDB.DeleteAction(strSQL, false))
330
                {
331
                    ctDB.rollback();
332
                    MessageBox.Show("工事種別マスタ削除に失敗しました。", "削除エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
333
                    return;
334
                }
335

  
336
                strSQL = string.Format(" Where ConstructionTypeCode = {0}", TypeCode);
337
                if (!csuDB.DeleteAction(strSQL, false))
338
                {
339
                    ctDB.rollback();
340
                    csuDB.rollback();
341
                    MessageBox.Show("作業単価マスタ削除に失敗しました。", "削除エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
342
                    return;
343
                }
344

  
345
                ctDB.commit();
346
                csuDB.commit();
347

  
348
                // データ表示
349
                if (!DispGridData()) return;
350

  
351
                // 表示行復元
352
                dgvMaster.FirstDisplayedScrollingRowIndex = iIndex;
353

  
354
                // 変更フラグOff
355
                m_bChengeAns = false;
356
            }
357
            catch (System.Exception ex)
358
            {
359
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
360
            }
361
            finally
362
            {
363
                ctDB.close(); ctDB = null;
364
                csuDB.close(); csuDB = null;
365
            }
366
        }
367

  
368
        /// <summary>
369
        /// 登録ボタン押下
370
        /// </summary>
371
        /// <param name="sender"></param>
372
        /// <param name="e"></param>
373
        private void btnDataEntry_Click(object sender, EventArgs e)
374
        {
375
            //データ無は抜ける
376
            if (dgvMaster.Rows.Count == 0) return;
377

  
378
            try
379
            {
380
                //データチェック
381
                if (!DispFeildCheck()) return;
382

  
383
                if (MessageBox.Show("表示中のデータを登録します。", "登録確認"
384
                        , MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return;
385

  
386
                // 表示行退避
387
                int iIndex = dgvMaster.FirstDisplayedScrollingRowIndex;
388

  
389
                // データ登録
390
                ConstructionTypeMasterDataEntry();
391

  
392
                // データ表示
393
                if (!DispGridData()) return;
394

  
395
                // 表示行復元
396
                dgvMaster.FirstDisplayedScrollingRowIndex = iIndex;
397

  
398
                // 変更フラグクリア
399
                m_bChengeAns = false;
400
            }
401
            catch (System.Exception ex)
402
            {
403
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
404
            }
405
        }
406
        /// <summary>
407
        /// IMEのコントロール
408
        /// </summary>
409
        /// <param name="sender"></param>
410
        /// <param name="e"></param>
411
        private void dgvMaster_CellEnter(object sender, DataGridViewCellEventArgs e)
412
        {
413
            try
414
            {
415
                DataGridView dgv = (DataGridView)sender;
416

  
417
                if (dgv.CurrentCell.ReadOnly) return;
418

  
419
                //列によってIMEのモードを変更する
420
                if (dgv.Columns[e.ColumnIndex].Name.Equals("Column3"))
421
                {
422
                    dgv.ImeMode = ImeMode.On;
423
                }
424
                else
425
                {
426
                    dgv.ImeMode = ImeMode.Disable;
427
                }
428
            }
429
            catch (System.Exception ex)
430
            {
431
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
432
            }
433
        }
434

  
435
        /// <summary>
436
        /// アップキー押下
437
        /// </summary>
438
        /// <param name="sender"></param>
439
        /// <param name="e"></param>
440
        private void btnDispUp_Click(object sender, EventArgs e)
441
        {
442
            try
443
            {
444
                // 先頭は処理しない
445
                if (dgvMaster.CurrentRow.Index == 0) return;
446

  
447
                int irowcnt = dgvMaster.CurrentRow.Index;
448
                if (irowcnt == 0) return;
449
                if (CommonMotions.chkObjectIsNull(dgvMaster.Rows[irowcnt - 1].Cells[(int)DispColumn.NameString].Value)) return;
450

  
451
                // グリッドアップキー処理
452
                DataGridViewAction.GridRowUpAction((DataGridView)dgvMaster, (int)DispColumn.TypeCode, (int)DispColumn.NewFlg);
453

  
454
                m_bChengeAns = true;
455
            }
456
            catch (System.Exception ex)
457
            {
458
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
459
            }
460
        }
461
        /// <summary>
462
        /// ダウンキー押下処理
463
        /// </summary>
464
        /// <param name="sender"></param>
465
        /// <param name="e"></param>
466
        private void btnDispDown_Click(object sender, EventArgs e)
467
        {
468
            try
469
            {
470
                // 最終行は処理しない
471
                if ((dgvMaster.CurrentRow.Index + 1) == dgvMaster.Rows.Count) return;
472

  
473
                int irowcnt = dgvMaster.CurrentRow.Index;
474
                if (CommonMotions.chkObjectIsNull(dgvMaster.Rows[irowcnt + 1].Cells[(int)DispColumn.NameString].Value)) return;
475
                if (dgvMaster.Rows[irowcnt + 1].Cells[(int)DispColumn.NameString].Value.ToString() == "") return;
476

  
477
                // グリッドダウンキー処理
478
                DataGridViewAction.GridRowDownAction((DataGridView)dgvMaster, (int)DispColumn.TypeCode, (int)DispColumn.NewFlg);
479

  
480
                m_bChengeAns = true;
481
            }
482
            catch (System.Exception ex)
483
            {
484
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
485
            }
486
        }
487

  
488
        /// セルクリック
489
        /// </summary>
490
        /// <param name="sender"></param>
491
        /// <param name="e"></param>
492
        private void dgvMaster_CellClick(object sender, DataGridViewCellEventArgs e)
493
        {
494
            dgvMaster_CellDoubleClick(sender, e);
495
        }
496

  
497
        /// <summary>
498
        /// セルダブルクリック
499
        /// </summary>
500
        /// <param name="sender"></param>
501
        /// <param name="e"></param>
502
        private void dgvMaster_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
503
        {
504
            // ダイアログとして使用するとき以外は処理しない
505
            if (!m_DialogFlg) return;
506

  
507
            if (e.RowIndex < 0) return;
508

  
509
            m_NameCode = int.Parse(dgvMaster.CurrentRow.Cells[(int)DispColumn.TypeCode].Value.ToString());
510

  
511
            this.Close();
512
        }
513

  
514
        /// <summary>
515
        /// Formキーダウン処理
516
        /// </summary>
517
        /// <param name="sender"></param>
518
        /// <param name="e"></param>
519
        private void FrmConstructionType_KeyDown(object sender, KeyEventArgs e)
520
        {
521
            // DataGridviewは処理しない
522
            if (ActiveControl.Name.Equals("dgvMaster"))
523
            {
524
                // 最終行時の処理
525
                GridLastLine();
526
                return;
527
            }
528
        }
529
        #endregion
530

  
531
        #region プライベートメソッド
532
        /// <summary>
533
        /// 初期表示処理
534
        /// </summary>
535
        private void InitDataLoad()
536
        {
537
            try
538
            {
539
                // グリッドの行を0に戻す
540
                dgvMaster.Rows.Clear();
541

  
542
                // 初期表示
543
                DispGridData();
544

  
545
                // 初期時フラグ
546
                m_bChengeAns = false;
547
            }
548
            catch (Exception ex)
549
            {
550
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
551
            }
552
        }
553

  
554
        /// <summary>
555
        /// 画面項目のチェック
556
        /// </summary>
557
        /// <returns></returns>
558
        private bool DispFeildCheck()
559
        {
560
            bool bRet = true;
561
            bool bAns = true;
562
            try
563
            {
564
                foreach (DataGridViewRow r in dgvMaster.Rows)
565
                {
566
                    //名称
567
                    bAns = true;
568
                    if (CommonMotions.chkObjectIsNull(r.Cells[(int)DispColumn.NameString].Value)) continue;
569
                    if (r.Cells[(int)DispColumn.NameString].Value.ToString().Length == 0) continue;
570

  
571
                    // レングスチェック
572
                    bAns = CommonMotions.chkStringLength(r.Cells[(int)DispColumn.NameString].Value.ToString(), 100);
573

  
574
                    // 背景色変更
575
                    CommonMotions.chgBackColor(r.Cells[(int)DispColumn.NameString], bAns);
576
                    bRet &= bAns;
577
                }
578

  
579
                if (!bRet)
580
                {
581
                    MessageBox.Show("入力エラーがあります、確認してください。", "データ確認"
582
                                                , MessageBoxButtons.OK, MessageBoxIcon.Warning);
583
                }
584

  
585
                return bRet;
586
            }
587
            catch (System.Exception ex)
588
            {
589
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
590
                return false;
591
            }
592
      }
593

  
594
        /// <summary>
595
        /// 工事種別データ登録
596
        /// </summary>
597
        private void ConstructionTypeMasterDataEntry()
598
        {
599
            IOMConstructionType ctDB = new IOMConstructionType();
600
            try
601
            {
602
                // 番号降り直し
603
                int ino = 0;
604
                foreach (DataGridViewRow r in dgvMaster.Rows)
605
                {
606
                    // 入力無は処理しない
607
                    if (CommonMotions.chkObjectIsNull(r.Cells[(int)DispColumn.NameString].Value)) continue;
608
                    // 番号セット
609
                    r.Cells[(int)DispColumn.No].Value = (++ino).ToString();
610
                }
611
                //// 一括処理なので接続を行う
612
                ctDB.connect();
613
                ctDB.beginTran();
614

  
615
                // データを画面より取得
616
                foreach (DataGridViewRow r in dgvMaster.Rows)
617
                {
618
                    // 入力無は処理しない
619
                    if (CommonMotions.chkObjectIsNull(r.Cells[(int)DispColumn.NameString].Value)) continue;
620
                    if (r.Cells[(int)DispColumn.NameString].Value.ToString().Length == 0) continue;
621

  
622
                    ConstructionTypeMaster ctRec = new ConstructionTypeMaster();
623

  
624
                    // データセット
625
                    ctRec.NameString = r.Cells[(int)DispColumn.NameString].Value.ToString();
626
                    ctRec.DisplayOrder = int.Parse(r.Cells[(int)DispColumn.No].Value.ToString());
627
                    ctRec.DeleteFlg = 0;
628

  
629
                    // データセット
630
                    if (CommonMotions.chkCellBlank(r.Cells[(int)DispColumn.TypeCode].Value))
631
                    {
632
                        // 新規時キーセット
633
                        // 履歴がない場合は過去の最大値をとる
634
                        ctRec.TypeCode = ctDB.SelectMaxCategoryHistoryCount(string.Empty, false) + 1;
635
                    }
636
                    else
637
                    {
638
                        ctRec.TypeCode = int.Parse(r.Cells[(int)DispColumn.TypeCode].Value.ToString());
639
                    }
640
                    ctRec.DisplayOrder = int.Parse(r.Cells[(int)DispColumn.No].Value.ToString());
641
                    ctRec.NameString = r.Cells[(int)DispColumn.NameString].Value.ToString();
642

  
643
                    // SQL作成
644
                    string strSelect = ctDB.CreatePrimarykeyString(ctRec.TypeCode);
645
                    List<ConstructionTypeMaster> ctList = new List<ConstructionTypeMaster>();
646
                    // 業種マスタ取得
647
                    if (!ctDB.SelectAction(strSelect, ref ctList, false))
648
                    {
649
                        ctDB.rollback();
650
                        MessageBox.Show("登録確認に失敗しました。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
651
                        return;
652
                    }
653

  
654
                    if (ctList.Count == 0)
655
                    {
656
                        // データがない場合は追加
657
                        ctList.Clear();
658
                        ctList.Add(ctRec);
659

  
660
                        // データ登録
661
                        if (!ctDB.InsertAction(ctList, false))
662
                        {
663
                            ctDB.rollback();
664
                            MessageBox.Show("登録に失敗しました。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
665
                            return;
666
                        }
667
                    }
668
                    else
669
                    {
670
                        // データ登録
671
                        if (!ctDB.UpdateAction(strSelect, ctRec, false))
672
                        {
673
                            ctDB.rollback();
674
                            MessageBox.Show("更新に失敗しました。", "登録エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
675
                            return;
676
                        }
677
                    }
678
                }
679

  
680
                // 成功したらcommit
681
                ctDB.commit();
682

  
683
            }
684
            catch (System.Exception ex)
685
            {
686
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
687
            }
688
            finally
689
            {
690
                ctDB.close();
691
                ctDB = null;
692
            }
693
        }
694

  
695
        /// <summary>
696
        /// 名称マスタ表示
697
        /// </summary>
698
        /// <returns></returns>
699
        private bool DispGridData()
700
        {
701
            IOMConstructionType cmDB = new IOMConstructionType();
702
            List<ConstructionTypeMaster> cm = new List<ConstructionTypeMaster>();
703

  
704
            try
705
            {
706
                // グリッドの行を0に戻す
707
                dgvMaster.Rows.Clear();
708

  
709

  
710
                // SQL作成
711
                string strSQL = " Where DeleteFlg = 0 Order By DisplayOrder ASC";
712
                // 表示順マスタ取得
713
                if (!cmDB.SelectAction(strSQL, ref cm)) return false;
714

  
715
                // データ表示
716
                int icnt = 0;
717
                foreach (ConstructionTypeMaster work in cm)
718
                {
719
                    dgvMaster.Rows.Add((icnt + 1)
720
                                        , work.TypeCode
721
                                        , work.NameString.ToString()
722
                                        , 0);
723
                    dgvMaster.Rows[icnt++].Cells[(int)DispColumn.NameString].ToolTipText = work.NameString.ToString();
724
                }
725
                // №再採番
726
                LineReNumbering();
727

  
728
                // 表示行が足りない場合は追加する
729
                if (dgvMaster.Rows.Count <= CommonDefine.s_MaxInitLineCountMastamente)
730
                {
731
                    int iAddLine = CommonDefine.s_MaxInitLineCountMastamente - dgvMaster.Rows.Count;
732
                    for (int i = 0; i < iAddLine; i++)
733
                    {
734
                        dgvMaster.Rows.Add();
735
                    }
736
                }
737

  
738
                dgvMaster.Rows.Add();
739
                // クリアデータセット
740
                SetRowClearData(dgvMaster.Rows.Count - 1);
741

  
742
                // 読込時データカウント取得
743
                m_initDataCount = cm.Count;
744

  
745
                return true;
746
            }
747
            catch (Exception ex)
748
            {
749
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
750
                return false;
751
            }
752
            finally
753
            {
754
                cmDB.close();
755
                cmDB = null;
756
            }
757
        }
758

  
759
        /// <summary>
760
        /// グリッド最終行での処理
761
        /// </summary>
762
        private void GridLastLine()
763
        {
764
            // 最終行判定
765
            if (dgvMaster.CurrentCell.RowIndex == dgvMaster.Rows.Count - 1)
766
            {
767
                // 最終列判定
768
                if (dgvMaster.CurrentCell.ColumnIndex == (int)DispColumn.NameString)
769
                {
770
                    // 1行追加
771
                    dgvMaster.Rows.Add();
772
                    // クリアデータセット
773
                    SetRowClearData(dgvMaster.Rows.Count - 1);
774
                    // №再採番
775
                    LineReNumbering();
776
                }
777

  
778
            }
779
        }
780
        #endregion
781
    }
782
}
branches/src/ProcessManagement/ProcessManagement/Forms/Master/ConstructionType/_FrmConstructionType.resx
1
<?xml version="1.0" encoding="utf-8"?>
2
<root>
3
  <!-- 
4
    Microsoft ResX Schema 
5
    
6
    Version 2.0
7
    
8
    The primary goals of this format is to allow a simple XML format 
9
    that is mostly human readable. The generation and parsing of the 
10
    various data types are done through the TypeConverter classes 
11
    associated with the data types.
12
    
13
    Example:
14
    
15
    ... ado.net/XML headers & schema ...
16
    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
    <resheader name="version">2.0</resheader>
18
    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
    </data>
25
    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
        <comment>This is a comment</comment>
28
    </data>
29
                
30
    There are any number of "resheader" rows that contain simple 
31
    name/value pairs.
32
    
33
    Each data row contains a name, and value. The row also contains a 
34
    type or mimetype. Type corresponds to a .NET class that support 
35
    text/value conversion through the TypeConverter architecture. 
36
    Classes that don't support this are serialized and stored with the 
37
    mimetype set.
38
    
39
    The mimetype is used for serialized objects, and tells the 
40
    ResXResourceReader how to depersist the object. This is currently not 
41
    extensible. For a given mimetype the value must be set accordingly:
42
    
43
    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
    that the ResXResourceWriter will generate, however the reader can 
45
    read any of the formats listed below.
46
    
47
    mimetype: application/x-microsoft.net.object.binary.base64
48
    value   : The object must be serialized with 
49
            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
            : and then encoded with base64 encoding.
51
    
52
    mimetype: application/x-microsoft.net.object.soap.base64
53
    value   : The object must be serialized with 
54
            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
            : and then encoded with base64 encoding.
56

  
57
    mimetype: application/x-microsoft.net.object.bytearray.base64
58
    value   : The object must be serialized into a byte array 
59
            : using a System.ComponentModel.TypeConverter
60
            : and then encoded with base64 encoding.
61
    -->
62
  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
    <xsd:element name="root" msdata:IsDataSet="true">
65
      <xsd:complexType>
66
        <xsd:choice maxOccurs="unbounded">
67
          <xsd:element name="metadata">
68
            <xsd:complexType>
69
              <xsd:sequence>
70
                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
              </xsd:sequence>
72
              <xsd:attribute name="name" use="required" type="xsd:string" />
73
              <xsd:attribute name="type" type="xsd:string" />
74
              <xsd:attribute name="mimetype" type="xsd:string" />
75
              <xsd:attribute ref="xml:space" />
76
            </xsd:complexType>
77
          </xsd:element>
78
          <xsd:element name="assembly">
79
            <xsd:complexType>
80
              <xsd:attribute name="alias" type="xsd:string" />
81
              <xsd:attribute name="name" type="xsd:string" />
82
            </xsd:complexType>
83
          </xsd:element>
84
          <xsd:element name="data">
85
            <xsd:complexType>
86
              <xsd:sequence>
87
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
              </xsd:sequence>
90
              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
              <xsd:attribute ref="xml:space" />
94
            </xsd:complexType>
95
          </xsd:element>
96
          <xsd:element name="resheader">
97
            <xsd:complexType>
98
              <xsd:sequence>
99
                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
              </xsd:sequence>
101
              <xsd:attribute name="name" type="xsd:string" use="required" />
102
            </xsd:complexType>
103
          </xsd:element>
104
        </xsd:choice>
105
      </xsd:complexType>
106
    </xsd:element>
107
  </xsd:schema>
108
  <resheader name="resmimetype">
109
    <value>text/microsoft-resx</value>
110
  </resheader>
... 差分の行数が表示可能な上限を超えました。超過分は表示しません。

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