55 lines
1.9 KiB
VB.net
55 lines
1.9 KiB
VB.net
Imports System
|
|
Imports System.Data
|
|
Imports System.Data.SqlClient
|
|
Imports System.IO
|
|
|
|
Public Class fifoverify
|
|
'Private cnstr As String
|
|
|
|
Private Sub btn_ok_Click(sender As System.Object, e As System.EventArgs) Handles btn_ok.Click
|
|
Dim cnstr = mainForm.cnstr
|
|
Dim conn As New SqlConnection(cnstr)
|
|
|
|
Dim myQuery As String
|
|
myQuery = "SELECT * FROM users WHERE username = '" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "'"
|
|
|
|
Dim mycommand As SqlCommand
|
|
mycommand = New SqlCommand(myQuery, conn)
|
|
|
|
Try
|
|
conn.Open()
|
|
Dim reader As SqlDataReader = mycommand.ExecuteReader()
|
|
reader.Read()
|
|
auth.Text = reader("authentication")
|
|
conn.Close()
|
|
|
|
|
|
If auth.Text = "Administrator" Or auth.Text = "Super Administrator" Then
|
|
|
|
Dim parts = New PartsRecords(issuanceForm.txtSerial.Text)
|
|
parts.issue2(issuanceForm.txtSerial.Text, issuanceForm.txtPN.Text, DateTime.Parse(issuanceForm.lblPDate.Text), loginForm.username, issuanceForm.cmbLine.SelectedItem.ToString, issuanceForm.cmbRev.Text.ToString, issuanceForm.cbopetname.Text.ToString, issuanceForm.txtOperator.Text)
|
|
MessageBox.Show("Parts Successfully Issued.", "Success")
|
|
issuanceForm.reset()
|
|
issuanceForm.txtSerial.Focus()
|
|
Me.Close()
|
|
|
|
Else
|
|
MessageBox.Show("You are not an authorized admin!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
End If
|
|
|
|
|
|
Catch ex As Exception
|
|
MessageBox.Show("Either username/password is incorrect!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
|
|
Finally
|
|
conn.Close()
|
|
conn.Dispose()
|
|
End Try
|
|
|
|
mountingForm.Enabled = True
|
|
End Sub
|
|
|
|
|
|
Private Sub fifoverify_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
|
|
|
End Sub
|
|
End Class |