プロジェクト

全般

プロフィール

リビジョン 412

堀内6年以上前に追加

担当者マスタメンテ:削除解除・完全削除処理追加

差分を表示:

trunk/src/ProcessManagement/ProcessManagement/Forms/Master/PersonInCharge/FrmPersonInCharge.cs
163 163
        /// </summary>
164 164
        const int s_FixRowsRefAssGrid = 4;
165 165
        #endregion
166

  
167
        #region ボタントップ文字
168
        /// <summary>
169
        /// ボタントップ文字
170
        /// </summary>
171
        string[,] ButtonString = new string[,] { { "内容登録", "内容削除" }
172
                                                ,{ "削除解除", "完全削除"} };
166 173
        #endregion
174
        
175
        #endregion
167 176

  
168 177
        #region 変数
169 178
        /// <summary>
......
369 378
        {
370 379
            try
371 380
            {
372
                //データチェック
373
                if (!DispFeildCheck()) return;
381
                if (rdbMode1.Checked)
382
                {
383
                    //データチェック
384
                    if (!DispFeildCheck()) return;
374 385

  
375
                // データ登録
376
                if (!DataEntry()) return;
386
                    // データ登録
387
                    if (!DataEntry()) return;
377 388

  
378
                CommonMotions.EntryEndMessage("担当者情報データ");
389
                    CommonMotions.EntryEndMessage("担当者情報データ");
390
                }
391
                else if (rdbMode2.Checked)
392
                {
393
                    // 削除解除
394
                    if (!RelaseRemoveData()) return;
379 395

  
396
                    CommonMotions.EntryEndMessage("担当者削除データ","削除解除");
397
                }
398

  
380 399
                // 更新エリアクリア
381 400
                ClearDisplay();
382 401

  
......
420 439
                if (MessageBox.Show("表示中のデータを削除します。", "削除確認"
421 440
                    , MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes) return;
422 441

  
423
                // データ削除処理
424
                if (!RemoveData()) return;
442
                if (rdbMode1.Checked)
443
                {
444
                    // データ削除処理
445
                    if (!RemoveData()) return;
446
                }
447
                else if (rdbMode2.Checked)
448
                {
449
                    // データ完全削除処理
450
                    if (!DeleteRemoveData()) return;
451
                }
425 452

  
426 453
                CommonMotions.RemoveEndMessage("担当者情報データ");
427 454

  
......
841 868
        /// <param name="e"></param>
842 869
        private void rdbMode_CheckedChanged(object sender, EventArgs e)
843 870
        {
844
            // クリア
845
            ClearDisplay();
846

  
847
            // 初期表示
848
            DispGridData();
849

  
850
            // 登録処理ボタンの表示・非表示
851
            bool bDsp = true;
852
            if (rdbMode2.Checked) bDsp = false;
853

  
854
            panel3.Visible = bDsp;
855
            btnDataLineEntry.Visible = bDsp;
856
            btnDataEntry.Visible = bDsp;
857
            btnDataDelete.Visible = bDsp;
858
            btnSalaryAdd.Visible = bDsp;
859
            btnSalaryDel.Visible = bDsp;
860
            btnRefDepAdd.Visible = bDsp;
861
            btnRefDepDel.Visible = bDsp;
871
            RadioButtonChanged();
862 872
        }
863 873
        #endregion
864 874
    }
trunk/src/ProcessManagement/ProcessManagement/Forms/Master/PersonInCharge/FrmPersonInCharge.designer.cs
659 659
            this.cmbDepartment.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
660 660
            this.cmbDepartment.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
661 661
            this.cmbDepartment.FormattingEnabled = true;
662
            this.cmbDepartment.Location = new System.Drawing.Point(148, 360);
662
            this.cmbDepartment.Location = new System.Drawing.Point(148, 362);
663 663
            this.cmbDepartment.Name = "cmbDepartment";
664 664
            this.cmbDepartment.Size = new System.Drawing.Size(429, 24);
665 665
            this.cmbDepartment.TabIndex = 8;
......
706 706
            this.cmbLedgerFlg.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
707 707
            this.cmbLedgerFlg.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
708 708
            this.cmbLedgerFlg.FormattingEnabled = true;
709
            this.cmbLedgerFlg.Location = new System.Drawing.Point(148, 645);
709
            this.cmbLedgerFlg.Location = new System.Drawing.Point(148, 647);
710 710
            this.cmbLedgerFlg.Name = "cmbLedgerFlg";
711 711
            this.cmbLedgerFlg.Size = new System.Drawing.Size(139, 24);
712 712
            this.cmbLedgerFlg.TabIndex = 13;
......
732 732
            this.cmbSecManage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
733 733
            this.cmbSecManage.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
734 734
            this.cmbSecManage.FormattingEnabled = true;
735
            this.cmbSecManage.Location = new System.Drawing.Point(148, 680);
735
            this.cmbSecManage.Location = new System.Drawing.Point(148, 682);
736 736
            this.cmbSecManage.Name = "cmbSecManage";
737 737
            this.cmbSecManage.Size = new System.Drawing.Size(284, 24);
738 738
            this.cmbSecManage.TabIndex = 14;
......
1020 1020
            this.cmbRefDepartment.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
1021 1021
            this.cmbRefDepartment.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
1022 1022
            this.cmbRefDepartment.FormattingEnabled = true;
1023
            this.cmbRefDepartment.Location = new System.Drawing.Point(148, 965);
1023
            this.cmbRefDepartment.Location = new System.Drawing.Point(148, 967);
1024 1024
            this.cmbRefDepartment.Name = "cmbRefDepartment";
1025 1025
            this.cmbRefDepartment.Size = new System.Drawing.Size(429, 24);
1026 1026
            this.cmbRefDepartment.TabIndex = 19;
trunk/src/ProcessManagement/ProcessManagement/Forms/Master/PersonInCharge/FrmPersonInChargeAuxiliary.cs
2397 2397
            }
2398 2398
        }
2399 2399
        #endregion
2400

  
2401
        #region 削除ラジオボタン変更時処理
2402
        /// <summary>
2403
        /// 削除ラジオボタン変更時処理
2404
        /// </summary>
2405
        private void RadioButtonChanged()
2406
        {
2407
            try
2408
            {
2409
                // クリア
2410
                ClearDisplay();
2411

  
2412
                // 初期表示
2413
                DispGridData();
2414

  
2415
                // デフォルト文字セット
2416
                btnDataEntry.Text = ButtonString[0, 0];
2417
                btnDataDelete.Text = ButtonString[0, 1];
2418

  
2419
                // 登録処理ボタンの表示・非表示
2420
                bool bDsp = true;
2421
                if (rdbMode2.Checked) bDsp = false;
2422

  
2423
                panel3.Visible = bDsp;
2424
                btnDataLineEntry.Visible = bDsp;
2425
                btnDataEntry.Visible = bDsp;
2426
                btnDataDelete.Visible = bDsp;
2427
                btnSalaryAdd.Visible = bDsp;
2428
                btnSalaryDel.Visible = bDsp;
2429
                btnRefDepAdd.Visible = bDsp;
2430
                btnRefDepDel.Visible = bDsp;
2431

  
2432
                // 最高責任者は削除解除を表示する
2433
                if (rdbMode2.Checked)
2434
                {
2435
                    int TopSec = CommonDefine.SecurityRankList[(int)CommonDefine.SecurityRankPos.SpecialAuthority].Key;
2436
                    if (CommonMotions.LoginUserData.PersonCode == CommonDefine.AdminCode
2437
                        || CommonMotions.LoginUserData.SecurityManagement == TopSec)
2438
                    {
2439
                        // デフォルト文字セット
2440
                        btnDataEntry.Text = ButtonString[1, 0];
2441
                        btnDataDelete.Text = ButtonString[1, 1];
2442
                        btnDataEntry.Visible = true;
2443
                        btnDataDelete.Visible = true;
2444
                    }
2445
                }
2446
            }
2447
            catch (System.Exception ex)
2448
            {
2449
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2450
            }
2451
        }
2452
        #endregion
2453

  
2454
        #region 削除解除処理
2455
        /// <summary>
2456
        /// 削除解除処理
2457
        /// </summary>
2458
        /// <returns></returns>
2459
        private bool RelaseRemoveData()
2460
        {
2461
            IOMPersonInCharge picDB = new IOMPersonInCharge();
2462
            IOMChgChargeDep chgDepDB = new IOMChgChargeDep();
2463
            try
2464
            {
2465
                int PersonCode = CommonMotions.cnvInt(m_dispControl[(int)DispCtrl.PersonCode].Text);
2466

  
2467
                picDB.connect(); picDB.beginTran();
2468
                chgDepDB.connect(); chgDepDB.beginTran();
2469

  
2470
                // 担当者マスタ:終了年月日・削除フラグ更新
2471
                StringBuilder strSQL = new StringBuilder();
2472
                strSQL.Append("UPDATE PersonInChargeMaster");
2473
                strSQL.AppendFormat(" SET EndDate = DATE('{0}')", DateTime.MinValue.ToShortDateString());
2474
                strSQL.AppendFormat(", DeleteFlg = {0}", (int)CommonDefine.DataDeleteDef.Exists);
2475
                strSQL.Append("      , UpdateDate = NOW()");
2476
                strSQL.Append(picDB.CreatePrimarykeyString(PersonCode));
2477
                if (!picDB.ExecuteNonQuery(strSQL.ToString(), false))
2478
                {
2479
                    picDB.rollback();
2480
                    MessageBox.Show("担当者マスタ:更新に失敗しました。", "更新エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
2481
                    return false;
2482
                }
2483

  
2484
                // 担当者部署履歴データ:最終データ終了年月日更新
2485
                strSQL.Clear();
2486
                strSQL.Append("UPDATE ChgChargeDep");
2487
                strSQL.AppendFormat(" SET CompDate = DATE('{0}')", DateTime.MaxValue.ToShortDateString());
2488
                strSQL.Append("      , UpdateDate = NOW()");
2489
                strSQL.Append(picDB.CreatePrimarykeyString(PersonCode));
2490
                if (!chgDepDB.ExecuteNonQuery(strSQL.ToString(), false))
2491
                {
2492
                    picDB.rollback();
2493
                    chgDepDB.rollback();
2494
                    MessageBox.Show("担当者部署履歴データ:更新に失敗しました。", "更新エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
2495
                    return false;
2496
                }
2497

  
2498
                picDB.commit();
2499
                chgDepDB.commit();
2500

  
2501
                return true;
2502
            }
2503
            catch (System.Exception ex)
2504
            {
2505
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2506
                return false;
2507
            }
2508
            finally
2509
            {
2510
                picDB.close(); picDB = null;
2511
                chgDepDB.close(); chgDepDB = null;
2512
            }
2513
        }
2514
        #endregion
2515

  
2516
        #region データ完全削除処理
2517
        /// <summary>
2518
        /// データ完全削除処理
2519
        /// </summary>
2520
        /// <returns></returns>
2521
        private bool DeleteRemoveData()
2522
        {
2523
            IOMPersonInCharge picDB = new IOMPersonInCharge();
2524
            IOMChgChargeDep chgDepDB = new IOMChgChargeDep();
2525
            try
2526
            {
2527
                picDB.connect(); picDB.beginTran();
2528
                chgDepDB.connect(); chgDepDB.beginTran();
2529

  
2530
                int PersonCode = CommonMotions.cnvInt(m_dispControl[(int)DispCtrl.PersonCode].Text);
2531
                StringBuilder strSQL = new StringBuilder();
2532
                strSQL.AppendFormat(picDB.CreatePrimarykeyString(PersonCode));
2533

  
2534
                // 担当者マスタデータ完全削除
2535
                if (!picDB.DeleteAction(strSQL.ToString(), false))
2536
                {
2537
                    MessageBox.Show("担当者マスタ:削除に失敗しました。", "削除エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
2538
                    return false;
2539
                }
2540

  
2541
                // 担当者部署履歴データ存在確認
2542
                if (!chgDepDB.DeleteAction(strSQL.ToString(), false))
2543
                {
2544
                    MessageBox.Show("担当者部署履歴データ:削除に失敗しました。", "削除エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
2545
                    return false;
2546
                }
2547

  
2548
                picDB.commit();
2549
                chgDepDB.commit();
2550

  
2551
                return true;
2552
            }
2553
            catch (System.Exception ex)
2554
            {
2555
                logger.ErrorFormat("システムエラー:{0}:{1}", CommonMotions.GetMethodName(), ex.Message);
2556
                return false;
2557
            }
2558
            finally
2559
            {
2560
                picDB.close(); picDB = null;
2561
                chgDepDB.close(); chgDepDB = null;
2562
            }
2563
        }
2564
        #endregion
2400 2565
    }
2401 2566
}
trunk/src/ProcessManagement/ProcessManagement/Properties/AssemblyInfo.cs
9 9
[assembly: AssemblyTitle("現場監督秘書")]
10 10
[assembly: AssemblyDescription("建築業管理シリーズ 現場監督秘書")]
11 11
[assembly: AssemblyConfiguration("")]
12
[assembly: AssemblyCompany("H-YOUシステム開発")]
12
[assembly: AssemblyCompany("どうぐ箱ソフト 株式会社")]
13 13
[assembly: AssemblyProduct("現場監督秘書")]
14
[assembly: AssemblyCopyright("H-YOU Systems Copyright ©  2015-2018")]
14
[assembly: AssemblyCopyright("Dougubako Soft Copyright ©  2018")]
15 15
[assembly: AssemblyTrademark("")]
16 16
[assembly: AssemblyCulture("")]
17 17

  

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