Imports System.Data Imports System.Data.SqlTypes Imports System.Data.SqlClient Imports System.ComponentModel Imports Microsoft.VisualBasic Public Class frmBarcodeKleber 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 btnOK As System.Windows.Forms.Button Friend WithEvents brnAbbruch As System.Windows.Forms.Button Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents pnlimport As Panel Friend WithEvents Button2 As Button Friend WithEvents Label5 As Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmBarcodeKleber)) Me.btnOK = New System.Windows.Forms.Button() Me.brnAbbruch = New System.Windows.Forms.Button() Me.Label1 = New System.Windows.Forms.Label() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.Button1 = New System.Windows.Forms.Button() Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog() Me.Label2 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label() Me.Label4 = New System.Windows.Forms.Label() Me.pnlimport = New System.Windows.Forms.Panel() Me.Label5 = New System.Windows.Forms.Label() Me.Button2 = New System.Windows.Forms.Button() Me.pnlimport.SuspendLayout() Me.SuspendLayout() ' 'btnOK ' Me.btnOK.Location = New System.Drawing.Point(241, 112) Me.btnOK.Name = "btnOK" Me.btnOK.Size = New System.Drawing.Size(75, 23) Me.btnOK.TabIndex = 0 Me.btnOK.Text = "&OK" ' 'brnAbbruch ' Me.brnAbbruch.DialogResult = System.Windows.Forms.DialogResult.Abort Me.brnAbbruch.Location = New System.Drawing.Point(11, 112) Me.brnAbbruch.Name = "brnAbbruch" Me.brnAbbruch.Size = New System.Drawing.Size(75, 23) Me.brnAbbruch.TabIndex = 1 Me.brnAbbruch.Text = "&Abbruch" ' 'Label1 ' Me.Label1.Location = New System.Drawing.Point(8, 16) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(304, 23) Me.Label1.TabIndex = 2 Me.Label1.Text = "Bitte geben Sie die Nummer auf dem Barcodekleber ein." ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(100, 42) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(120, 20) Me.TextBox1.TabIndex = 3 ' 'Button1 ' Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Image) Me.Button1.Location = New System.Drawing.Point(15, 34) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(35, 37) Me.Button1.TabIndex = 4 Me.Button1.UseVisualStyleBackColor = True ' 'OpenFileDialog1 ' Me.OpenFileDialog1.FileName = "OpenFileDialog1" ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(75, 85) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(0, 13) Me.Label2.TabIndex = 5 ' 'Label3 ' Me.Label3.Location = New System.Drawing.Point(12, 16) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(304, 15) Me.Label3.TabIndex = 6 Me.Label3.Text = "Wählen Sie ein PDF-Dokument für den Import aus:" ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(12, 85) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(61, 13) Me.Label4.TabIndex = 7 Me.Label4.Text = "Dateiname:" ' 'pnlimport ' Me.pnlimport.Controls.Add(Me.Button2) Me.pnlimport.Controls.Add(Me.Label5) Me.pnlimport.Location = New System.Drawing.Point(11, 6) Me.pnlimport.Name = "pnlimport" Me.pnlimport.Size = New System.Drawing.Size(305, 129) Me.pnlimport.TabIndex = 8 ' 'Label5 ' Me.Label5.AutoSize = True Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Label5.ForeColor = System.Drawing.Color.Red Me.Label5.Location = New System.Drawing.Point(10, 16) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(291, 17) Me.Label5.TabIndex = 0 Me.Label5.Text = "PDF-Dokumente bitte direk in OnBase importieren" ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(110, 79) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(75, 23) Me.Button2.TabIndex = 1 Me.Button2.Text = "&OK" ' 'frmBarcodeKleber ' Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.ClientSize = New System.Drawing.Size(328, 144) Me.ControlBox = False Me.Controls.Add(Me.pnlimport) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.brnAbbruch) Me.Controls.Add(Me.btnOK) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "frmBarcodeKleber" Me.ShowInTaskbar = False Me.Text = "Barcode-Dokument erstellen" Me.pnlimport.ResumeLayout(False) Me.pnlimport.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() End Sub #End Region Dim ElDokImport As Boolean = False Sub New(ByVal Dokumentimport As Boolean) MyBase.New() InitializeComponent() Me.ElDokImport = Dokumentimport End Sub Dim m_barcodeid As String Property BarcodeID() As String Get Return m_barcodeid End Get Set(ByVal Value As String) m_barcodeid = Value End Set End Property Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click If Me.ElDokImport = True Then If Me.Label2.Text = "" Or System.IO.File.Exists(Me.Label2.Text) = False Then MyMsg.show_standardmessage(50201, MsgBoxStyle.Critical) Exit Sub End If Dim dm As New DocMgmt If LCase(System.IO.Path.GetExtension(Me.Label2.Text)) <> ".pdf" Then MsgBox("Bei der ausgewählten Datein handelt es sich nicht um eine PDF-Datei.", vbExclamation) Exit Sub End If If dm.Check_PDF(Me.Label2.Text) = False Then MyMsg.show_standardmessage(50203, MsgBoxStyle.Exclamation) Exit Sub End If Me.DialogResult = Windows.Forms.DialogResult.OK Me.Close() Exit Sub End If If Me.Label2.Text <> "" Then Me.DialogResult = Windows.Forms.DialogResult.OK Me.Close() Exit Sub End If Dim v As Long Try v = Val(LTrim(RTrim(Me.TextBox1.Text))) Catch MyMsg.show_standardmessage(36, MsgBoxStyle.Critical) Me.TextBox1.Select() Me.TextBox1.Focus() Exit Sub End Try Dim bc As New edokaDB.clsBarcodeetikette() bc.cpMainConnectionProvider = conn Try bc.iBarcodenr = New SqlInt32(CType(Me.TextBox1.Text, String)) bc.SelectOne() If bc.iBarcodenr.Value = v Then If bc.sDokumentid.Value Is System.DBNull.Value Then bc.sDokumentid = New SqlString(CType("res", String)) Else If bc.sDokumentid.Value = "" Then bc.sDokumentid = New SqlString(CType("res", String)) Else MyMsg.show_standardmessage(37, MsgBoxStyle.Critical) Me.TextBox1.Select() Me.TextBox1.Focus() Exit Sub End If End If End If conn.OpenConnection() bc.daMutiert_am = New SqlDateTime(CType(Now, DateTime)) bc.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32)) bc.Update() Me.BarcodeID = LTrim(Str(v)) conn.CloseConnection(True) Me.DialogResult = DialogResult.OK Me.Close() Catch MyMsg.show_standardmessage(38, MsgBoxStyle.Critical) Me.TextBox1.SelectAll() Me.TextBox1.Focus() End Try End Sub Private Sub brnAbbruch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles brnAbbruch.Click Me.Close() End Sub Private Sub frmBarcodeKleber_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.TextBox1.Focus() Me.TextBox1.Select() If ElDokImport = True Then Me.Label1.Visible = False Me.TextBox1.Visible = False Me.Label2.Visible = True Me.Label3.Visible = True Me.Label4.Visible = True Me.Button1.Visible = True Me.Text = "Dokument-Import" Me.pnlimport.Visible = True Else Me.Label1.Visible = True Me.TextBox1.Visible = True Me.Label2.Visible = False Me.Label3.Visible = False Me.Label4.Visible = False Me.Button1.Visible = False Me.Text = "Barcode-Dokument erstellen" Me.pnlimport.Visible = False End If End Sub Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown If e.KeyCode = Keys.Enter Then btnOK_Click(sender, e) End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.OpenFileDialog1.Filter = "PDF-Dateien|*.pdf" Me.OpenFileDialog1.FileName = "" Me.OpenFileDialog1.ShowDialog() If Me.OpenFileDialog1.FileName <> "" Then If LCase(System.IO.Path.GetExtension(OpenFileDialog1.FileName)) <> ".pdf" Then MsgBox("Bei der ausgewählten Datein handelt es sich nicht um eine PDF-Datei.", vbExclamation) End If Globals.Dokument_Importfilename = Me.OpenFileDialog1.FileName Me.Label2.Text = Globals.Dokument_Importfilename End If End Sub Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click brnAbbruch_Click(sender, e) End Sub End Class