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.

259 lines
9.3 KiB

Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports UtilityLibrary.Win32
Public Class frmcoldviewer
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 ToolBar1 As System.Windows.Forms.ToolBar
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents ToolBtnExit As System.Windows.Forms.ToolBarButton
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents OnDemand As AxARSOLELib.AxArsOle
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmcoldviewer))
Me.ToolBar1 = New System.Windows.Forms.ToolBar()
Me.ToolBtnExit = New System.Windows.Forms.ToolBarButton()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.Panel1 = New System.Windows.Forms.Panel()
Me.OnDemand = New AxARSOLELib.AxArsOle()
Me.Panel1.SuspendLayout()
CType(Me.OnDemand, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'ToolBar1
'
Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBtnExit})
Me.ToolBar1.DropDownArrows = True
Me.ToolBar1.ImageList = Me.ImageList1
Me.ToolBar1.Name = "ToolBar1"
Me.ToolBar1.ShowToolTips = True
Me.ToolBar1.Size = New System.Drawing.Size(824, 25)
Me.ToolBar1.TabIndex = 0
'
'ToolBtnExit
'
Me.ToolBtnExit.ImageIndex = 0
'
'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
'
'Panel1
'
Me.Panel1.Controls.AddRange(New System.Windows.Forms.Control() {Me.OnDemand})
Me.Panel1.Dock = System.Windows.Forms.DockStyle.Fill
Me.Panel1.Location = New System.Drawing.Point(0, 25)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(824, 557)
Me.Panel1.TabIndex = 2
'
'OnDemand
'
Me.OnDemand.ContainingControl = Me
Me.OnDemand.Dock = System.Windows.Forms.DockStyle.Top
Me.OnDemand.Enabled = True
Me.OnDemand.Location = New System.Drawing.Point(100, 100)
Me.OnDemand.Name = "OnDemand"
Me.OnDemand.OcxState = CType(resources.GetObject("OnDemand.OcxState"), System.Windows.Forms.AxHost.State)
Me.OnDemand.Size = New System.Drawing.Size(824, 1600)
Me.OnDemand.TabIndex = 0
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.AutoScroll = True
Me.AutoScrollMargin = New System.Drawing.Size(100, 0)
Me.AutoScrollMinSize = New System.Drawing.Size(100, 100)
Me.ClientSize = New System.Drawing.Size(824, 582)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Panel1, Me.ToolBar1})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "Form1"
Me.ShowInTaskbar = False
Me.Text = "Edoka-Cold-Dokumentviewer"
Me.TransparencyKey = System.Drawing.Color.White
Me.Panel1.ResumeLayout(False)
CType(Me.OnDemand, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
#Region "Deklarationen"
Dim m_dokumentid As String
Property DokumentId() As String
Get
Return m_dokumentid
End Get
Set(ByVal Value As String)
m_dokumentid = Value
End Set
End Property
Dim m_colddokumentid As String
Dim m_coldfolder As String
Dim server
Dim user
Dim pw
Dim xnumdocs
Dim xname As String
Dim i
Dim v1
Dim v2
Dim numservers
Dim rc As Short
Dim ret As Short
Dim hscrol As New HScrollBar()
Dim vscrol As New VScrollBar()
#End Region
#Region "Datenzugriffe"
Private Function Get_Cold_Data()
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.sp_get_coldfolder_by_documentid"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
Try
scmCmdToExecute.Connection = conn.scoDBConnection
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.DokumentId))
sdaAdapter.Fill(dtToReturn)
Me.m_colddokumentid = dtToReturn.Rows(0).Item(1)
Me.m_coldfolder = dtToReturn.Rows(0).Item(0)
Catch ex As Exception
Throw New Exception("Get_Cold_Folder :" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
#End Region
#Region "COLD_Ondemand_Funktionen"
Public Function Cold_Login() As Boolean
user = "tgsystkb"
pw = "tgsystkb"
server = "Test_System"
Me.OnDemand.SetUserMessageMode(2)
Me.OnDemand.Logon(server, user, pw)
If ret <> 0 And ret <> 8 Then
MsgBox("Die Anmeldung am COLD ist fehlgeschlagen", MsgBoxStyle.Exclamation)
Cold_Login = False
Exit Function
End If
Cold_Login = True
End Function
Public Function Show_Dokument(ByVal folder As String, ByVal dokumentid As String)
Dim rc
Dim ret
Dim xnumdocs
Try
ret = Me.OnDemand.SetUserMessageMode(0)
ret = Me.OnDemand.OpenFolder(folder)
If ret <> 0 Then
MsgBox("Der gewählte Order " & folder & " kann nicht geöffnet werden", MsgBoxStyle.Critical)
Me.OnDemand.Logoff()
Exit Function
End If
ret = Me.OnDemand.ClearFolderSearchFields()
If ret <> 0 Then
MsgBox("Die Suchliste konnte nicht initialisiert werden", MsgBoxStyle.Critical)
Me.OnDemand.Logoff()
Exit Function
End If
Dim xx As String
xx = ""
ret = Me.OnDemand.SetFolderSearchFieldData("Dokument-Id", 11, dokumentid, xx)
If ret <> 0 Then
MsgBox("Fehler beim setzen des Suchkriteriums", MsgBoxStyle.Critical)
Me.OnDemand.Logoff()
Exit Function
End If
ret = Me.OnDemand.SearchFolder(False)
If ret <> 0 Then
MsgBox("Beim Zugriff auf das COLD ist ein Fehler aufgetreten", MsgBoxStyle.Critical)
Me.OnDemand.Logoff()
Exit Function
End If
ret = Me.OnDemand.GetNumDocsInList(xnumdocs)
If xnumdocs < 1 Then
MsgBox("Es sind keine Dokumente gefunden worden.", MsgBoxStyle.Critical)
Me.OnDemand.Logoff()
Exit Function
End If
Me.OnDemand.OpenDoc(0, "", 0)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
#End Region
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
hscrol.Dock = DockStyle.Bottom
vscrol.Dock = DockStyle.Right
Me.Controls.Add(hscrol)
Me.Controls.Add(vscrol)
Me.OnDemand.dock = DockStyle.Fill
Dim m_dokument As New edokadb.clsDokument()
Get_Cold_Data()
If Not Cold_Login() Then Exit Sub
If Me.m_coldfolder = "TGKB Kredite" Then
Show_Dokument("TGKB Kredite ab Einführung EDOKA", Me.m_colddokumentid)
Else
Show_Dokument(Me.m_coldfolder, Me.m_colddokumentid)
End If
End Sub
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Me.Close()
End Sub
End Class