프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / Mapping.vb @ 265a1e83

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

1

2

    
3
Imports DevExpress.XtraEditors.Repository
4

    
5
Public Class Mapping
6

    
7
    Dim oPidSymbolCombobox As DevExpress.XtraEditors.Repository.RepositoryItemComboBox
8
    Dim _PID_Ds As DataSet
9
    Dim _PIDSymbol_Dt As DataTable = New DataTable
10
    Dim _Gembox As New CGembox()
11

    
12
    Sub New(ByVal oDt As DataTable)
13
        ' 디자이너에서 이 호출이 필요합니다.
14
        InitializeComponent()
15
        _PIDSymbol_Dt = oDt
16
        LoadSymbolLibrary()
17
        ' InitializeComponent() 호출 뒤에 초기화 코드를 추가하세요.
18
    End Sub
19

    
20

    
21
    Private Function LoadSymbolDataset() As DataSet
22
        Dim oPID_Ds As DataSet
23
        _Gembox.isLoadFile(My.Settings.SymbolLibrary)
24
        oPID_Ds = _Gembox.LoadFileFunc()
25
        Return oPID_Ds
26
    End Function
27

    
28
    Private Sub LoadSymbolLibrary()
29

    
30
        _Gembox.isLoadFile(My.Settings.SymbolLibrary)
31
        _PID_Ds = _Gembox.LoadFileFunc()
32

    
33
        XtraTabControl1.TabPages.Clear()
34
        For Each oDt As DataTable In _PID_Ds.Tables
35

    
36
            Dim bCheckImageColumn As Boolean = False
37
            'Image Pid ComboBox 추가
38
            For Each oColumn As DataColumn In oDt.Columns
39
                If oColumn.ColumnName = _Column_ImageSymbol Then
40
                    bCheckImageColumn = True
41
                End If
42
            Next
43
            If bCheckImageColumn = False Then
44
                Try
45
                    Dim iIndex As Integer = oDt.Columns(oDt.Columns.Count - 1).Namespace + 1
46
                    Dim oAddCol As DataColumn = oDt.Columns.Add(_Column_ImageSymbol)
47
                    oAddCol.Namespace = iIndex
48
                Catch ex As Exception
49

    
50
                End Try
51

    
52
            End If
53

    
54
            Dim oTabPage As New DevExpress.XtraTab.XtraTabPage
55
            oTabPage.Name = oDt.TableName
56
            oTabPage.Text = oDt.TableName
57
            Dim oGridControl As New DevExpress.XtraGrid.GridControl
58
            Dim oGridview As New DevExpress.XtraGrid.Views.Grid.GridView
59
            '   oGridview.CustomRowCellEdit += New DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventHandler(GridView_Mapping_CustomRowCellEdit);
60

    
61
            oGridControl.ViewCollection.Add(oGridview)
62
            oGridControl.MainView = oGridview
63
            oGridControl.DataSource = oDt
64
            oGridControl.BindingContext = New BindingContext()
65
            oGridControl.ForceInitialize()
66
            oGridview.Columns(_Column_ImageSymbol).ColumnEdit = GetComboEdit(oDt.TableName)
67
            oGridview.OptionsView.BestFitMode = DevExpress.XtraGrid.Views.Grid.GridBestFitMode.Full
68
            oGridview.OptionsView.ColumnAutoWidth = False
69
            oGridview.BestFitColumns()
70
            oGridControl.Dock = DockStyle.Fill
71
            oTabPage.Controls.Add(oGridControl)
72
            XtraTabControl1.TabPages.Add(oTabPage)
73
        Next
74
    End Sub
75

    
76
    Private Function GetComboEdit(ByVal sType As String) As RepositoryItemComboBox
77
        Dim oSymbolCombo As New RepositoryItemComboBox()
78
        oSymbolCombo.DropDownRows = 30
79
        If _PIDSymbol_Dt IsNot Nothing Then
80
            Dim oDataRows() As DataRow = _PIDSymbol_Dt.Select("category = '" & sType & "'")
81

    
82
            For Each oRow In oDataRows
83

    
84
                Dim sCategory As String = oRow("name").ToString()
85
                oSymbolCombo.Items.Add(sCategory)
86
            Next
87

    
88
        End If
89

    
90
        Return oSymbolCombo
91

    
92
    End Function
93

    
94
    Private Sub GridView_Mapping_CustomRowCellEdit(ByVal oObject As Object, ByVal e As DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs)
95
        If e.Column.FieldName = _Column_ImageSymbol Then
96
            e.RepositoryItem = oPidSymbolCombobox
97
        Else
98
            Return
99
        End If
100
    End Sub
101

    
102
    Private Sub TabControl_Mapping_Paint(sender As Object, e As PaintEventArgs) Handles TabControl_Mapping.Paint
103

    
104
    End Sub
105

    
106
    Private Sub TabControl_Mapping_MouseDown(sender As Object, e As MouseEventArgs) Handles TabControl_Mapping.MouseDown
107

    
108
    End Sub
109

    
110
    Private Sub Btn_Save_Click(sender As Object, e As EventArgs) Handles Btn_Save.Click
111

    
112
        'Dim oSaveFileDialog As New SaveFileDialog
113
        'oSaveFileDialog.Filter = "xlsx Files (*.xlsx)|*.xlsx"
114
        'If oSaveFileDialog.ShowDialog() = DialogResult.OK Then
115
        '    If oSaveFileDialog.FileName <> "" Then
116

    
117
        '    End If
118
        'End If
119
        If _PID_Ds IsNot Nothing Then
120
            Dim iAddColCnt As Integer = 0
121
            Dim oPidSymbol_Dt As DataTable = _Gembox.AddImageLibrary(_PID_Ds, _PIDSymbol_Dt)
122
            For Each oDt As DataTable In _PID_Ds.Tables
123
                'Dim oGembox As New CGembox
124
                _Gembox.SaveSymbolLibrary(oDt, oPidSymbol_Dt)
125
                '_Gembox.outputToExcelFile(oDt, oDt.TableName, oSaveFileDialog.FileName)
126
                _Gembox.SetSaveFile(My.Settings.SymbolLibrary)
127
            Next
128
            MessageBox.Show("저장 완료")
129
            '  System.Diagnostics.Process.Start(My.Settings.SymbolLibrary)
130
        Else
131
            MessageBox.Show("Symbol DB가 없습니다.")
132
        End If
133
    End Sub
134

    
135
    Private Sub Btn_Load_Click(sender As Object, e As EventArgs) Handles Btn_Load.Click
136

    
137
    End Sub
138
End Class
클립보드 이미지 추가 (최대 크기: 500 MB)