프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter_AutoModeling / SelectUnitForm.cs @ eb5697b1

이력 | 보기 | 이력해설 | 다운로드 (2.39 KB)

1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Threading.Tasks;
9
using System.Windows.Forms;
10
using Telerik.WinControls.UI;
11
using SPPID.DB;
12

    
13
namespace SPPIDConverter_AutoModeling
14
{
15
    public partial class SelectUnitForm : RadForm
16
    {
17
        public string SelectedUnit { get { return _SelectedUnit; } }
18
        private string _SelectedUnit;
19

    
20
        private DataTable dUnit;
21

    
22
        public SelectUnitForm(DataTable dUnit)
23
        {
24
            InitializeComponent();
25
            this.dUnit = dUnit;
26
            InitUnitTree();
27
        }
28

    
29
        private void InitUnitTree()
30
        {
31
            treeViewUnit.BeginUpdate();
32
            treeViewUnit.Nodes.Clear();
33
            foreach (DataRow row in dUnit.Rows)
34
            {
35
                RadTreeNode node = new RadTreeNode();
36
                node.Name = row["SP_ID"].ToString();
37
                node.Text = row["Name"].ToString();
38

    
39
                RadTreeNode parentNode = treeViewUnit.GetNodeByName(row["PARENTID"].ToString());
40
                if (parentNode == null)
41
                    treeViewUnit.Nodes.Add(node);
42
                else
43
                    parentNode.Nodes.Add(node);
44
            }
45
            treeViewUnit.EndUpdate();
46
            treeViewUnit.ExpandAll();
47
        }
48

    
49
        private void treeViewUnit_NodeMouseDoubleClick(object sender, RadTreeViewEventArgs e)
50
        {
51
            int level = e.Node.Level;
52
            if (level == 2)
53
            {
54
                _SelectedUnit = e.Node.Text;
55
                DialogResult = DialogResult.OK;
56
            }
57
            else
58
            {
59
                MessageBox.Show("Please Select Unit!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
60
            }
61
        }
62

    
63
        private void btnOK_Click(object sender, EventArgs e)
64
        {
65
            int level = treeViewUnit.SelectedNode.Level;
66
            if (level == 2)
67
            {
68
                _SelectedUnit = treeViewUnit.SelectedNode.Text;
69
                DialogResult = DialogResult.OK;
70
            }
71
            else
72
            {
73
                MessageBox.Show("Please Select Unit!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
74
            }
75
        }
76

    
77
        private void btnCancel_Click(object sender, EventArgs e)
78
        {
79
            DialogResult = DialogResult.Cancel;
80
        }
81

    
82
        
83
    }
84
}
클립보드 이미지 추가 (최대 크기: 500 MB)