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.

168 lines
6.0 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 TextBox1 As System.Windows.Forms.TextBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(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.SuspendLayout()
'
'btnOK
'
Me.btnOK.Location = New System.Drawing.Point(240, 112)
Me.btnOK.Name = "btnOK"
Me.btnOK.TabIndex = 0
Me.btnOK.Text = "&OK"
'
'brnAbbruch
'
Me.brnAbbruch.DialogResult = System.Windows.Forms.DialogResult.Abort
Me.brnAbbruch.Location = New System.Drawing.Point(8, 112)
Me.brnAbbruch.Name = "brnAbbruch"
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(104, 56)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(120, 20)
Me.TextBox1.TabIndex = 3
Me.TextBox1.Text = ""
'
'frmBarcodeKleber
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(328, 141)
Me.ControlBox = False
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.TextBox1, Me.Label1, Me.brnAbbruch, 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)
End Sub
#End Region
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
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()
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
End Class