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.
269 lines
11 KiB
269 lines
11 KiB
Imports System.Data
|
|
Imports System.Data.SqlTypes
|
|
Imports System.Data.SqlClient
|
|
Imports System.ComponentModel
|
|
Imports Microsoft.VisualBasic
|
|
Public Class frmFavoritenZuordnung
|
|
Inherits System.Windows.Forms.Form
|
|
|
|
#Region " Vom Windows Form Designer generierter Code "
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
|
|
InitializeComponent()
|
|
|
|
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
|
|
|
|
End Sub
|
|
|
|
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen.
|
|
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
|
If disposing Then
|
|
If Not (components Is Nothing) Then
|
|
components.Dispose()
|
|
End If
|
|
End If
|
|
MyBase.Dispose(disposing)
|
|
End Sub
|
|
|
|
' Für Windows Form-Designer erforderlich
|
|
Private components As System.ComponentModel.IContainer
|
|
|
|
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich
|
|
'Sie kann mit dem Windows Form-Designer modifiziert werden.
|
|
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
|
|
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
|
|
Friend WithEvents Label1 As System.Windows.Forms.Label
|
|
Friend WithEvents Label2 As System.Windows.Forms.Label
|
|
Friend WithEvents Label3 As System.Windows.Forms.Label
|
|
Friend WithEvents TreeView1 As System.Windows.Forms.TreeView
|
|
Friend WithEvents btnOk As System.Windows.Forms.Button
|
|
Friend WithEvents btnAbbruch As System.Windows.Forms.Button
|
|
Friend WithEvents btnNeuerOrdner As System.Windows.Forms.Button
|
|
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
|
|
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
|
|
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
|
Me.components = New System.ComponentModel.Container()
|
|
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmFavoritenZuordnung))
|
|
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
|
|
Me.Label1 = New System.Windows.Forms.Label()
|
|
Me.Label2 = New System.Windows.Forms.Label()
|
|
Me.Label3 = New System.Windows.Forms.Label()
|
|
Me.TreeView1 = New System.Windows.Forms.TreeView()
|
|
Me.btnOk = New System.Windows.Forms.Button()
|
|
Me.btnAbbruch = New System.Windows.Forms.Button()
|
|
Me.btnNeuerOrdner = New System.Windows.Forms.Button()
|
|
Me.TextBox1 = New System.Windows.Forms.TextBox()
|
|
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
|
|
Me.SuspendLayout()
|
|
'
|
|
'PictureBox1
|
|
'
|
|
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap)
|
|
Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
|
|
Me.PictureBox1.Name = "PictureBox1"
|
|
Me.PictureBox1.Size = New System.Drawing.Size(40, 40)
|
|
Me.PictureBox1.TabIndex = 0
|
|
Me.PictureBox1.TabStop = False
|
|
'
|
|
'Label1
|
|
'
|
|
Me.Label1.Location = New System.Drawing.Point(48, 16)
|
|
Me.Label1.Name = "Label1"
|
|
Me.Label1.Size = New System.Drawing.Size(264, 23)
|
|
Me.Label1.TabIndex = 1
|
|
Me.Label1.Text = "Das Dokument wird zu den Favoriten hinzu gefügt"
|
|
'
|
|
'Label2
|
|
'
|
|
Me.Label2.Location = New System.Drawing.Point(8, 56)
|
|
Me.Label2.Name = "Label2"
|
|
Me.Label2.Size = New System.Drawing.Size(48, 23)
|
|
Me.Label2.TabIndex = 2
|
|
Me.Label2.Text = "Name:"
|
|
'
|
|
'Label3
|
|
'
|
|
Me.Label3.Location = New System.Drawing.Point(8, 80)
|
|
Me.Label3.Name = "Label3"
|
|
Me.Label3.Size = New System.Drawing.Size(64, 23)
|
|
Me.Label3.TabIndex = 3
|
|
Me.Label3.Text = "Erstellen in:"
|
|
'
|
|
'TreeView1
|
|
'
|
|
Me.TreeView1.ImageList = Me.ImageList1
|
|
Me.TreeView1.Location = New System.Drawing.Point(72, 80)
|
|
Me.TreeView1.Name = "TreeView1"
|
|
Me.TreeView1.Size = New System.Drawing.Size(264, 216)
|
|
Me.TreeView1.TabIndex = 4
|
|
'
|
|
'btnOk
|
|
'
|
|
Me.btnOk.Location = New System.Drawing.Point(344, 16)
|
|
Me.btnOk.Name = "btnOk"
|
|
Me.btnOk.Size = New System.Drawing.Size(88, 23)
|
|
Me.btnOk.TabIndex = 5
|
|
Me.btnOk.Text = "&OK"
|
|
'
|
|
'btnAbbruch
|
|
'
|
|
Me.btnAbbruch.Location = New System.Drawing.Point(344, 48)
|
|
Me.btnAbbruch.Name = "btnAbbruch"
|
|
Me.btnAbbruch.Size = New System.Drawing.Size(88, 23)
|
|
Me.btnAbbruch.TabIndex = 6
|
|
Me.btnAbbruch.Text = "&Abbrechen"
|
|
'
|
|
'btnNeuerOrdner
|
|
'
|
|
Me.btnNeuerOrdner.Location = New System.Drawing.Point(344, 80)
|
|
Me.btnNeuerOrdner.Name = "btnNeuerOrdner"
|
|
Me.btnNeuerOrdner.Size = New System.Drawing.Size(88, 23)
|
|
Me.btnNeuerOrdner.TabIndex = 7
|
|
Me.btnNeuerOrdner.Text = "&Neuer Ordner"
|
|
'
|
|
'TextBox1
|
|
'
|
|
Me.TextBox1.Location = New System.Drawing.Point(72, 56)
|
|
Me.TextBox1.Name = "TextBox1"
|
|
Me.TextBox1.ReadOnly = True
|
|
Me.TextBox1.Size = New System.Drawing.Size(264, 20)
|
|
Me.TextBox1.TabIndex = 8
|
|
Me.TextBox1.Text = "TextBox1"
|
|
'
|
|
'ImageList1
|
|
'
|
|
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
|
|
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
|
|
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
|
|
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
|
|
'
|
|
'frmFavoritenZuordnung
|
|
'
|
|
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
|
Me.ClientSize = New System.Drawing.Size(440, 317)
|
|
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.btnNeuerOrdner, Me.btnAbbruch, Me.btnOk, Me.TreeView1, Me.Label3, Me.Label2, Me.Label1, Me.PictureBox1})
|
|
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
|
|
Me.Name = "frmFavoritenZuordnung"
|
|
Me.Text = "Zu Favoriten Hinzufügen"
|
|
Me.ResumeLayout(False)
|
|
|
|
End Sub
|
|
|
|
#End Region
|
|
|
|
Dim m_dokumenttypnr As Long
|
|
Property Dokumenttypnr() As Long
|
|
Get
|
|
Return m_dokumenttypnr
|
|
End Get
|
|
Set(ByVal Value As Long)
|
|
m_dokumenttypnr = Value
|
|
End Set
|
|
End Property
|
|
|
|
Private Sub frmFavoritenZuordnung_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
|
load_struktur()
|
|
End Sub
|
|
|
|
Private Sub Load_Struktur()
|
|
Dim struktur As New edokadb.clsMyDokumentart()
|
|
struktur.Load_FavoritenStruktur(Me.TreeView1, "", True)
|
|
struktur.Dispose()
|
|
Me.TreeView1.ExpandAll()
|
|
End Sub
|
|
|
|
Private Sub btnAbbruch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAbbruch.Click
|
|
Me.Close()
|
|
End Sub
|
|
|
|
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOk.Click
|
|
Try
|
|
Dim i As Integer
|
|
i = Me.TreeView1.SelectedNode.Tag
|
|
Catch
|
|
MyMsg.show_standardmessage(97, MsgBoxStyle.Critical)
|
|
Me.TreeView1.SelectedNode = Me.TreeView1.Nodes(0)
|
|
Exit Sub
|
|
End Try
|
|
If AlreadyExists() Then Exit Sub
|
|
Dim pf As New edokadb.clsDokumentfavoriten()
|
|
pf.cpMainConnectionProvider = conn
|
|
conn.OpenConnection()
|
|
pf.iDokumentfavoritenstrukturnr = New SqlInt32(CType(Me.TreeView1.SelectedNode.Tag, Int32))
|
|
pf.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
pf.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
pf.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
pf.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
pf.iDokumenttypnr = New SqlInt32(CType(Me.Dokumenttypnr / 10000, Int32))
|
|
pf.Insert()
|
|
conn.CloseConnection(True)
|
|
pf.Dispose()
|
|
Me.Close()
|
|
End Sub
|
|
Private Function AlreadyExists() As Boolean
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
AlreadyExists = False
|
|
Try
|
|
scmCmdToExecute.CommandText = "dbo.SP_Favorit_bereits_vorhanden"
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@strukturnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.TreeView1.SelectedNode.Tag))
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@doktypnr", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Dokumenttypnr / 10000))
|
|
sdaAdapter.Fill(dtToReturn)
|
|
Catch ex As Exception
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
Throw New Exception("Dokumenterstellung::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
Finally
|
|
scmCmdToExecute.Dispose()
|
|
sdaAdapter.Dispose()
|
|
End Try
|
|
If dtToReturn.Rows.Count > 0 Then
|
|
If MyMsg.Show_MessageYesNo(23) = MsgBoxResult.Yes Then
|
|
AlreadyExists = False
|
|
Else
|
|
AlreadyExists = True
|
|
End If
|
|
End If
|
|
End Function
|
|
|
|
Private Sub btnNeuerOrdner_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNeuerOrdner.Click
|
|
Dim a As String
|
|
Dim b As Integer
|
|
a = InputBox("Neuer Ordnername", "Neuer Favoritenordner hinzufügen")
|
|
If a = "" Then Exit Sub
|
|
Dim fs As New edokadb.clsDokumentfavoriten_struktur()
|
|
fs.cpMainConnectionProvider = conn
|
|
fs.sBezeichnung = New SqlString(CType(a, String))
|
|
fs.bAktiv = New SqlBoolean(CType(True, Boolean))
|
|
fs.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
fs.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
fs.iMandantnr = New SqlInt32(CType(Globals.MandantNr, Int32))
|
|
fs.iMitarbeiternr = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
fs.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
fs.iParentid = New SqlInt32(CType(Me.TreeView1.SelectedNode.Tag, Int32))
|
|
fs.iSort = New SqlInt32(CType(0, Int32))
|
|
fs.iSprache = New SqlInt32(CType(Globals.Sprache, Int32))
|
|
fs.iImageindex = New SqlInt32(CType(2, Int32))
|
|
fs.iImageindexopen = New SqlInt32(CType(2, Int32))
|
|
conn.OpenConnection()
|
|
Try
|
|
fs.Insert()
|
|
b = fs.iDokumentfavoritennr.Value
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
Finally
|
|
conn.CloseConnection(True)
|
|
fs.Dispose()
|
|
End Try
|
|
Me.TreeView1.BeginUpdate()
|
|
Load_Struktur()
|
|
Me.TreeView1.EndUpdate()
|
|
End Sub
|
|
End Class
|