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.

289 lines
11 KiB

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 TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> 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.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:"
'
'frmBarcodeKleber
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(328, 144)
Me.ControlBox = False
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.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"
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"
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
End Class