You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
297 lines
11 KiB
297 lines
11 KiB
Imports System.Data.SqlClient
|
|
Imports System.Data.SqlTypes
|
|
Imports System.Drawing
|
|
Imports System.Drawing.Color
|
|
Public Class frmDomainDokumentart
|
|
Const CtrlMask As Byte = 8
|
|
Dim todelete(50) As Integer
|
|
Dim itodelete As Integer
|
|
Dim ssort As Integer
|
|
Dim eintrag As String
|
|
Dim dokumentart As New edokadb.clsMyDokumentart()
|
|
Dim m_ToSelect As Boolean
|
|
Dim m_TransferKey As Integer
|
|
Dim m_ShowLevel As Integer
|
|
|
|
#Region "Properties"
|
|
Property ToSelect() As Boolean
|
|
Get
|
|
Return m_ToSelect
|
|
End Get
|
|
Set(ByVal Value As Boolean)
|
|
m_ToSelect = Value
|
|
End Set
|
|
End Property
|
|
Property Transferkey()
|
|
Get
|
|
Return m_TransferKey
|
|
End Get
|
|
Set(ByVal Value)
|
|
m_TransferKey = Value
|
|
End Set
|
|
End Property
|
|
Property showlevel() As Integer
|
|
Get
|
|
Return m_ShowLevel
|
|
End Get
|
|
Set(ByVal Value As Integer)
|
|
m_ShowLevel = Value
|
|
End Set
|
|
End Property
|
|
|
|
#End Region
|
|
|
|
|
|
Private Sub MnuSchliessen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuSchliessen.Click
|
|
Toolbtn_Schliessen_ButtonClick(sender, e)
|
|
End Sub
|
|
|
|
|
|
Private Sub Toolbtn_Schliessen_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles Toolbtn_Schliessen.ButtonClick
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub FrmSysadminMenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
Me.SysMenu.ContextMenu = Me.ContextMenu1
|
|
Me.SysMenu.ImageList = Globals.DokumentartenImages
|
|
If ToSelect Then
|
|
dokumentart.LoadTreeMenu(SysMenu, Me.showlevel)
|
|
Me.SysMenu.ContextMenu = Nothing
|
|
Me.AllowDrop = False
|
|
Else
|
|
dokumentart.LoadTreeMenu(SysMenu, 0)
|
|
End If
|
|
SysMenu.ExpandAll()
|
|
itodelete = 0
|
|
End Sub
|
|
|
|
Private Sub MnuNeuerKnoten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuNeuerKnoten.Click
|
|
Dim a As String
|
|
Dim tn As New TreeNode()
|
|
Dim tnnew As New TreeNode()
|
|
a = InputBox(Globals.MyMsg.Get_Meldungstext(500))
|
|
If a = "" Then Exit Sub
|
|
tn = Me.SysMenu.SelectedNode
|
|
tnnew = tn.Nodes.Add(a)
|
|
With tnnew
|
|
.Tag() = 0
|
|
.ImageIndex() = 1
|
|
.SelectedImageIndex() = 2
|
|
End With
|
|
If tn.ImageIndex <> 5 And tn.ImageIndex <> 6 Then
|
|
tn.ImageIndex = 1
|
|
tn.SelectedImageIndex = 2
|
|
End If
|
|
If tn.GetNodeCount(True) > 0 Then
|
|
If tn.ImageIndex <> 5 And tn.ImageIndex <> 6 Then
|
|
tn.ImageIndex = 1
|
|
tn.SelectedImageIndex = 2
|
|
End If
|
|
End If
|
|
Me.SysMenu.Refresh()
|
|
End Sub
|
|
|
|
Private Sub MnuKnotenLoeschen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuKnotenLoeschen.Click
|
|
Dim tn As New TreeNode()
|
|
Dim tnp As New TreeNode()
|
|
Dim i As Integer
|
|
tn = Me.SysMenu.SelectedNode
|
|
tnp = tn.Parent
|
|
If tn.ImageIndex = 5 Or tn.ImageIndex = 6 Then
|
|
MyMsg.show_standardmessage(5, MsgBoxStyle.Critical)
|
|
Exit Sub
|
|
End If
|
|
If Not (Me.SysMenu.SelectedNode Is Nothing) Then
|
|
itodelete = itodelete + 1
|
|
todelete(itodelete) = tn.Tag
|
|
If Globals.MyMsg.Show_MessageYesNo(3) = MsgBoxResult.Yes Then
|
|
tn.Remove()
|
|
End If
|
|
If tnp.GetNodeCount(True) = 0 Then
|
|
If tnp.ImageIndex <> 5 And tnp.ImageIndex <> 6 Then
|
|
tnp.ImageIndex = 1
|
|
tnp.SelectedImageIndex = 2
|
|
End If
|
|
End If
|
|
Me.SysMenu.Refresh()
|
|
End If
|
|
End Sub
|
|
|
|
'Drag and Drop innerhalb des Systemmenus
|
|
Private Sub TreeView_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles SysMenu.DragDrop
|
|
Dim OriginationNode As TreeNode = CType(e.Data.GetData("System.Windows.Forms.TreeNode"), TreeNode)
|
|
If OriginationNode.ImageIndex = 5 Or OriginationNode.ImageIndex = 6 Then
|
|
MyMsg.show_standardmessage(6, MsgBoxStyle.Critical)
|
|
Exit Sub
|
|
End If
|
|
|
|
If e.Data.GetDataPresent("System.Windows.Forms.TreeNode", False) Then
|
|
Dim pt As Point
|
|
Dim DestinationNode As TreeNode
|
|
pt = CType(sender, TreeView).PointToClient(New Point(e.X, e.Y))
|
|
DestinationNode = CType(sender, TreeView).GetNodeAt(pt)
|
|
DestinationNode.Nodes.Add(CType(OriginationNode.Clone, TreeNode))
|
|
DestinationNode.Expand()
|
|
If (e.KeyState And CtrlMask) <> CtrlMask Then
|
|
OriginationNode.Remove()
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub TreeView_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles SysMenu.DragEnter
|
|
If (e.Data.GetDataPresent("System.Windows.Forms.TreeNode")) Then
|
|
If (e.KeyState And CtrlMask) = CtrlMask Then
|
|
e.Effect = DragDropEffects.Copy
|
|
Else
|
|
e.Effect = DragDropEffects.Move
|
|
End If
|
|
Else
|
|
e.Effect = DragDropEffects.None
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub TreeView_ItemDrag(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ItemDragEventArgs) Handles SysMenu.ItemDrag
|
|
If e.Button = MouseButtons.Left Then
|
|
DoDragDrop(e.Item, DragDropEffects.Move Or DragDropEffects.Copy)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MnuSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MnuSave.Click
|
|
Dim i As Integer
|
|
conn.OpenConnection()
|
|
ListNodeCollectionRecursive(Me.SysMenu.Nodes(0), 0)
|
|
i = conn.CloseConnection(True)
|
|
End Sub
|
|
|
|
Private Sub ListNodeCollectionRecursive(ByVal tnParent As TreeNode, ByRef iSort As Integer)
|
|
Dim tn As TreeNode
|
|
If tnParent.GetNodeCount(False) > 0 Then
|
|
tn = tnParent.Nodes(0)
|
|
Else
|
|
tn = Nothing
|
|
End If
|
|
ssort = 0
|
|
Do Until tn Is Nothing
|
|
iSort = iSort + 1
|
|
ListNodeSave(tn, iSort)
|
|
If tn.GetNodeCount(False) > 0 Then
|
|
Call ListNodeCollectionRecursive(tn, iSort)
|
|
End If
|
|
tn = tn.NextNode
|
|
Loop
|
|
End Sub
|
|
|
|
Private Sub ListNodeSave(ByVal tn As TreeNode, ByRef isort As Integer)
|
|
Dim dbkey As New edokadb.clsMyKey_Tabelle()
|
|
Dim t As DataTable
|
|
Dim key As Long
|
|
Dim i As Integer
|
|
Dim dokumentart As New edokadb.clsMyDokumentart()
|
|
dbkey.cpMainConnectionProvider = conn
|
|
dokumentart.cpMainConnectionProvider = conn
|
|
|
|
If tn.Tag <> 0 Then
|
|
dokumentart.iDokumentartnr = New SqlInt32(CType(tn.Tag, Int32))
|
|
dokumentart.SelectOne()
|
|
End If
|
|
|
|
dokumentart.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
dokumentart.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
dokumentart.sBezeichnung = New SqlString(CType(tn.Text, String))
|
|
dokumentart.sBeschreibung = New SqlString(CType("", String))
|
|
dokumentart.iParentid = New SqlInt32(CType(tn.Parent.Tag, Int32))
|
|
dokumentart.iImageindex = New SqlInt32(CType(tn.ImageIndex, Int32))
|
|
dokumentart.iImageindexopen = New SqlInt32(CType(tn.SelectedImageIndex, Int32))
|
|
dokumentart.iSort = New SqlInt32(CType(isort, Int32))
|
|
dokumentart.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
dokumentart.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
dokumentart.iSprache = New SqlInt32(CType(Globals.Sprache, Int32))
|
|
dokumentart.iMandantnr = New SqlInt32(CType(Globals.MandantNr, Int32))
|
|
If tn.Tag <> 0 Then
|
|
dokumentart.iDokumentartnr = New SqlInt32(CType(tn.Tag, Int32))
|
|
dokumentart.Update()
|
|
Else
|
|
key = dbkey.get_dbkey("dokumentart")
|
|
conn.OpenConnection()
|
|
dokumentart.iDokumentartnr = New SqlInt32(CType(key, Int32))
|
|
dokumentart.Insert()
|
|
tn.Tag = key
|
|
End If
|
|
|
|
For i = 1 To itodelete
|
|
dokumentart.iDokumentartnr = New SqlInt32(CType(todelete(i), Int32))
|
|
t = dokumentart.SelectOne
|
|
If t.Rows.Count > 0 Then
|
|
dokumentart.Delete()
|
|
End If
|
|
Next
|
|
End Sub
|
|
|
|
|
|
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
|
|
Dim a As String
|
|
a = InputBox("Neuer Name:")
|
|
If a = "" Then Exit Sub
|
|
Me.SysMenu.SelectedNode.Text = a
|
|
End Sub
|
|
|
|
Private Sub TreeView_DblClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SysMenu.DoubleClick
|
|
If ToSelect Then
|
|
Me.Transferkey = Me.SysMenu.SelectedNode.Tag
|
|
Me.Close()
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub MenuItem5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem5.Click
|
|
Dim s As String
|
|
Dim split
|
|
Me.OpenFileDialog1.ShowDialog()
|
|
If Me.OpenFileDialog1.FileName = "" Then Exit Sub
|
|
FileOpen(1, Me.OpenFileDialog1.FileName, OpenMode.Input)
|
|
Do While Not EOF(1)
|
|
s = LineInput(1)
|
|
insert_dokumenttyp(s)
|
|
Loop
|
|
FileClose(1)
|
|
conn.CloseConnection(True)
|
|
End Sub
|
|
Private Sub insert_dokumenttyp(ByVal s As String)
|
|
Dim splits
|
|
Dim dt As New edokadb.clsDokumenttyp()
|
|
Dim dbkey As New edokadb.clsMyKey_Tabelle()
|
|
Dim key As Long
|
|
|
|
dt.cpMainConnectionProvider = conn
|
|
conn.OpenConnection()
|
|
dt.iDokumenttypnr = New SqlInt32(CType(13, Int32))
|
|
dt.SelectOne()
|
|
|
|
splits = Split(s, " ")
|
|
dt.iOffice_vorlagenr = New SqlInt32(CType(2, Int32))
|
|
dt.bHostdokument = New SqlBoolean(CType(True, Boolean))
|
|
dt.sHostdokumenttyp = New SqlString(CType(splits(1), String))
|
|
dt.sBezeichnung = New SqlString(CType(splits(2) + " " + splits(3), String))
|
|
dt.iDokumentart_host = New SqlInt32(CType(splits(0), Int32))
|
|
dt.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
dt.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
dt.iMutierer = New SqlInt32(CType(-1, Int32))
|
|
|
|
dbkey.cpMainConnectionProvider = conn
|
|
key = dbkey.get_dbkey("dokumenttyp")
|
|
conn.OpenConnection()
|
|
dt.iDokumenttypnr = New SqlInt32(CType(key, Int32))
|
|
dt.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
dt.Insert()
|
|
conn.CloseConnection(True)
|
|
End Sub
|
|
|
|
Private Sub MenuItem7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem7.Click
|
|
Dim f As New frmIconSelector()
|
|
f.ShowDialog()
|
|
If f.DialogResult = DialogResult.OK Then
|
|
Me.SysMenu.SelectedNode.SelectedImageIndex = f.SelectedImage
|
|
Me.SysMenu.SelectedNode.ImageIndex = f.SelectedImage
|
|
End If
|
|
f.Dispose()
|
|
End Sub
|
|
End Class |