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.

367 lines
14 KiB

Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.IO
Public Class frmDokumentpaketInfo
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 lblBezeichnung As System.Windows.Forms.Label
Friend WithEvents txtBezeichnung As System.Windows.Forms.TextBox
Friend WithEvents GrpDokumentvorlagen As System.Windows.Forms.GroupBox
Friend WithEvents lblOwner As System.Windows.Forms.Label
Friend WithEvents txtOwner As System.Windows.Forms.TextBox
Friend WithEvents GrpBeschreibung As System.Windows.Forms.GroupBox
Friend WithEvents RichTextBoxHS1 As EDOKAApp.RichTextBoxHS
Friend WithEvents GrpAllgemein As System.Windows.Forms.GroupBox
Friend WithEvents GrpHinweis As System.Windows.Forms.GroupBox
Friend WithEvents btnOK As System.Windows.Forms.Button
Friend WithEvents ImageList3 As System.Windows.Forms.ImageList
Friend WithEvents TreeVorlagen As System.Windows.Forms.TreeView
Friend WithEvents PicHinweis As System.Windows.Forms.PictureBox
Friend WithEvents txtHinweis As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmDokumentpaketInfo))
Me.lblBezeichnung = New System.Windows.Forms.Label()
Me.txtBezeichnung = New System.Windows.Forms.TextBox()
Me.GrpDokumentvorlagen = New System.Windows.Forms.GroupBox()
Me.TreeVorlagen = New System.Windows.Forms.TreeView()
Me.ImageList3 = New System.Windows.Forms.ImageList(Me.components)
Me.lblOwner = New System.Windows.Forms.Label()
Me.txtOwner = New System.Windows.Forms.TextBox()
Me.GrpBeschreibung = New System.Windows.Forms.GroupBox()
Me.RichTextBoxHS1 = New EDOKAApp.RichTextBoxHS()
Me.GrpAllgemein = New System.Windows.Forms.GroupBox()
Me.GrpHinweis = New System.Windows.Forms.GroupBox()
Me.txtHinweis = New System.Windows.Forms.Label()
Me.PicHinweis = New System.Windows.Forms.PictureBox()
Me.btnOK = New System.Windows.Forms.Button()
Me.GrpDokumentvorlagen.SuspendLayout()
Me.GrpBeschreibung.SuspendLayout()
Me.GrpAllgemein.SuspendLayout()
Me.GrpHinweis.SuspendLayout()
Me.SuspendLayout()
'
'lblBezeichnung
'
Me.lblBezeichnung.Location = New System.Drawing.Point(16, 16)
Me.lblBezeichnung.Name = "lblBezeichnung"
Me.lblBezeichnung.Size = New System.Drawing.Size(88, 24)
Me.lblBezeichnung.TabIndex = 1
Me.lblBezeichnung.Text = "Dokumentpaket"
'
'txtBezeichnung
'
Me.txtBezeichnung.BackColor = System.Drawing.Color.White
Me.txtBezeichnung.Location = New System.Drawing.Point(104, 16)
Me.txtBezeichnung.Name = "txtBezeichnung"
Me.txtBezeichnung.ReadOnly = True
Me.txtBezeichnung.Size = New System.Drawing.Size(368, 20)
Me.txtBezeichnung.TabIndex = 2
Me.txtBezeichnung.Text = "TextBox1"
'
'GrpDokumentvorlagen
'
Me.GrpDokumentvorlagen.Controls.AddRange(New System.Windows.Forms.Control() {Me.TreeVorlagen})
Me.GrpDokumentvorlagen.Location = New System.Drawing.Point(8, 160)
Me.GrpDokumentvorlagen.Name = "GrpDokumentvorlagen"
Me.GrpDokumentvorlagen.Size = New System.Drawing.Size(240, 360)
Me.GrpDokumentvorlagen.TabIndex = 3
Me.GrpDokumentvorlagen.TabStop = False
Me.GrpDokumentvorlagen.Text = "Dokumentvorlagen"
'
'TreeVorlagen
'
Me.TreeVorlagen.CheckBoxes = True
Me.TreeVorlagen.Dock = System.Windows.Forms.DockStyle.Fill
Me.TreeVorlagen.ImageList = Me.ImageList3
Me.TreeVorlagen.Location = New System.Drawing.Point(3, 16)
Me.TreeVorlagen.Name = "TreeVorlagen"
Me.TreeVorlagen.Size = New System.Drawing.Size(234, 341)
Me.TreeVorlagen.TabIndex = 0
'
'ImageList3
'
Me.ImageList3.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList3.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList3.ImageStream = CType(resources.GetObject("ImageList3.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList3.TransparentColor = System.Drawing.Color.Transparent
'
'lblOwner
'
Me.lblOwner.Location = New System.Drawing.Point(488, 16)
Me.lblOwner.Name = "lblOwner"
Me.lblOwner.Size = New System.Drawing.Size(80, 24)
Me.lblOwner.TabIndex = 4
Me.lblOwner.Text = "Verantwortlich:"
'
'txtOwner
'
Me.txtOwner.BackColor = System.Drawing.Color.White
Me.txtOwner.Location = New System.Drawing.Point(576, 16)
Me.txtOwner.Name = "txtOwner"
Me.txtOwner.ReadOnly = True
Me.txtOwner.Size = New System.Drawing.Size(208, 20)
Me.txtOwner.TabIndex = 5
Me.txtOwner.Text = "TextBox1"
'
'GrpBeschreibung
'
Me.GrpBeschreibung.Controls.AddRange(New System.Windows.Forms.Control() {Me.RichTextBoxHS1})
Me.GrpBeschreibung.Location = New System.Drawing.Point(256, 160)
Me.GrpBeschreibung.Name = "GrpBeschreibung"
Me.GrpBeschreibung.Size = New System.Drawing.Size(544, 360)
Me.GrpBeschreibung.TabIndex = 6
Me.GrpBeschreibung.TabStop = False
Me.GrpBeschreibung.Text = "Beschreibung"
'
'RichTextBoxHS1
'
Me.RichTextBoxHS1.AcceptsTab = True
Me.RichTextBoxHS1.Dock = System.Windows.Forms.DockStyle.Fill
Me.RichTextBoxHS1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.RichTextBoxHS1.Location = New System.Drawing.Point(3, 16)
Me.RichTextBoxHS1.Name = "RichTextBoxHS1"
Me.RichTextBoxHS1.ReadOnly = True
Me.RichTextBoxHS1.Size = New System.Drawing.Size(538, 341)
Me.RichTextBoxHS1.TabIndex = 4
Me.RichTextBoxHS1.Text = ""
'
'GrpAllgemein
'
Me.GrpAllgemein.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtBezeichnung, Me.lblBezeichnung, Me.txtOwner, Me.lblOwner})
Me.GrpAllgemein.Location = New System.Drawing.Point(8, 8)
Me.GrpAllgemein.Name = "GrpAllgemein"
Me.GrpAllgemein.Size = New System.Drawing.Size(800, 48)
Me.GrpAllgemein.TabIndex = 7
Me.GrpAllgemein.TabStop = False
Me.GrpAllgemein.Text = "Allgemeines"
'
'GrpHinweis
'
Me.GrpHinweis.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtHinweis, Me.PicHinweis})
Me.GrpHinweis.Location = New System.Drawing.Point(8, 64)
Me.GrpHinweis.Name = "GrpHinweis"
Me.GrpHinweis.Size = New System.Drawing.Size(800, 88)
Me.GrpHinweis.TabIndex = 8
Me.GrpHinweis.TabStop = False
Me.GrpHinweis.Text = "Wichtiger Hinweis"
'
'txtHinweis
'
Me.txtHinweis.Location = New System.Drawing.Point(72, 24)
Me.txtHinweis.Name = "txtHinweis"
Me.txtHinweis.Size = New System.Drawing.Size(720, 56)
Me.txtHinweis.TabIndex = 60
Me.txtHinweis.Text = "Label1"
'
'PicHinweis
'
Me.PicHinweis.Image = CType(resources.GetObject("PicHinweis.Image"), System.Drawing.Bitmap)
Me.PicHinweis.Location = New System.Drawing.Point(16, 24)
Me.PicHinweis.Name = "PicHinweis"
Me.PicHinweis.Size = New System.Drawing.Size(40, 46)
Me.PicHinweis.TabIndex = 59
Me.PicHinweis.TabStop = False
Me.PicHinweis.Visible = False
'
'btnOK
'
Me.btnOK.Location = New System.Drawing.Point(720, 528)
Me.btnOK.Name = "btnOK"
Me.btnOK.TabIndex = 9
Me.btnOK.Text = "OK"
'
'frmDokumentpaketInfo
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(802, 557)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnOK, Me.GrpHinweis, Me.GrpAllgemein, Me.GrpBeschreibung, Me.GrpDokumentvorlagen})
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmDokumentpaketInfo"
Me.Text = "Informationen zum Dokumentpaket:"
Me.GrpDokumentvorlagen.ResumeLayout(False)
Me.GrpBeschreibung.ResumeLayout(False)
Me.GrpAllgemein.ResumeLayout(False)
Me.GrpHinweis.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
#Region "Deklarationen"
Dim m_key As Integer
Property Key() As Integer
Get
Return m_key
End Get
Set(ByVal Value As Integer)
m_key = Value
End Set
End Property
Dim m_title As String
Property Titel() As String
Get
Return m_title
End Get
Set(ByVal Value As String)
m_title = Value
End Set
End Property
Dim on_Load As Boolean = True
#End Region
#Region "Init_Load"
Private Sub frmDokumentpaketInfo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim i As Integer
Dim tn As TreeNode
Me.Text = Me.Text + " " + Me.Titel
Dim tb As DataTable = Generic_Select(1)
If tb.Rows.Count > 0 Then
Me.txtBezeichnung.Text = tb.Rows(0).Item("bezeichnung")
Me.txtOwner.Text = tb.Rows(0).Item("owner")
Me.txtHinweis.Text = tb.Rows(0).Item("wichtigehinweise")
For i = 0 To tb.Rows.Count - 1
tn = Me.TreeVorlagen.Nodes.Add(tb.Rows(i).Item("DTBezeichnung"))
tn.Tag = i
tn.ImageIndex = tb.Rows(i).Item("imageindex")
tn.SelectedImageIndex = tb.Rows(i).Item("imageindex")
tn.Checked = tb.Rows(i).Item("zwingend") = 1
Next
Load_Beschreibung()
End If
If Me.txtHinweis.Text.Length > 0 Then Me.PicHinweis.Visible = True Else Me.PicHinweis.Visible = False
Me.on_Load = False
End Sub
Private Sub Load_Beschreibung()
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("Select * From EDEX_dokumentpaket where dokumentpaketnr=" + Str(Me.Key), connection)
Dim CB As SqlCommandBuilder = New SqlCommandBuilder(da)
Dim ds As New DataSet()
Dim dokname As String
dokname = Globals.Applikationsdaten.Rows(Globals.AppldataRow).Item("pfad_temporaer_dokumente") + "tmp.rtf"
Try
connection.ConnectionString = Globals.sConnectionString
connection.Open()
da.Fill(ds, "docbeschreibung")
Dim myRow As DataRow
myRow = ds.Tables(0).Rows(0)
Dim MyData() As Byte
MyData = myRow.Item(5)
Dim K As Long
K = UBound(MyData)
Dim fs As New FileStream(dokname, FileMode.OpenOrCreate, FileAccess.Write)
fs.Write(MyData, 0, K)
fs.Close()
fs = Nothing
Me.RichTextBoxHS1.LoadFile(dokname)
Catch ex As Exception
Finally
CB = Nothing
ds = Nothing
da = Nothing
connection.Close()
connection = Nothing
End Try
End Sub
#End Region
#Region "Datenbank"
Private Function Generic_Select(ByVal typ As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Select Case typ
Case 1
scmCmdToExecute.CommandText = "edex_sp_dokumentpaketinfo"
Case Else
End Select
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
Select Case typ
Case 1
scmCmdToExecute.Parameters.Add(New SqlParameter("@dpnr", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Key))
End Select
scmCmdToExecute.Connection = conn.scoDBConnection
Try
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
Throw New Exception("Dokumentpaket::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#End Region
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
Me.Close()
End Sub
Dim CheckValue As Boolean
Private Sub TreeVorlagen_BeforeCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeVorlagen.BeforeCheck
If Me.on_Load Then Exit Sub
Try
e.Cancel = True
Catch
End Try
End Sub
Private Sub TreeVorlagen_AfterCheck(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeVorlagen.AfterCheck
End Sub
End Class