created new structure
This commit is contained in:
96
VS code/Form8.vb
Normal file
96
VS code/Form8.vb
Normal file
@@ -0,0 +1,96 @@
|
||||
Imports DocumentFormat.OpenXml.InkML
|
||||
Imports Microsoft.Data.SqlClient
|
||||
Imports System.Reflection.Emit
|
||||
Imports System.Threading
|
||||
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
|
||||
|
||||
|
||||
|
||||
Public Class Form8
|
||||
'setari pentru server
|
||||
Dim DataString As String = My.Settings.subnet
|
||||
Dim surce As String = My.Settings.serverName
|
||||
Dim catalog As String = My.Settings.serverdatabase
|
||||
Dim user As String = My.Settings.serverUser
|
||||
Dim pass As String = My.Settings.serverUserpass
|
||||
Dim timeout As String = My.Settings.timeout
|
||||
Dim encrypt As String = My.Settings.encrypt
|
||||
Dim trust As String = My.Settings.cert
|
||||
Dim reason As String = My.Settings.reason
|
||||
Dim subnet As String = My.Settings.subnet
|
||||
Dim rowIdval As String ' gasirea randului din datagrid
|
||||
Private Sub updateTable()
|
||||
' updateul tabelului din datagrid care se face dupa fiecare conexiune la server
|
||||
Dim con As New SqlConnection("Data Source=" & surce & "; Initial Catalog=" & catalog & "; User ID=" & user & "; Password=" & pass & "; Connect Timeout=" & timeout & "; Encrypt=" & encrypt &
|
||||
"; TrustServerCertificate=" & trust & "; ApplicationIntent=" & reason & "; MultiSubnetFailover=" & subnet & "")
|
||||
con.Open()
|
||||
Dim command As New SqlCommand("select top 14 * from dbo.mentenanta where (status = 'Deschis' )order by id desc", con)
|
||||
Dim sda As New SqlDataAdapter(command)
|
||||
Dim dt As New DataTable
|
||||
sda.Fill(dt)
|
||||
DataGridView1.DataSource = dt
|
||||
con.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub Form8_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
||||
Dim items As String() = New String() {"", "Cusut", "Pregatit", "Matlasat"}
|
||||
ComboBox1.DataSource = items
|
||||
updateTable()
|
||||
End Sub
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
|
||||
Form1.Show()
|
||||
Me.Close()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub TextMasina_TextChangeed(sender As Object, e As EventArgs) Handles TextMasina.TextChanged
|
||||
' validare text box 1 cu OQ
|
||||
If TextMasina.Text.Length < 4 Then
|
||||
|
||||
ElseIf TextMasina.Text.Length = 4 Then
|
||||
TextDefect.Focus()
|
||||
Else
|
||||
MsgBox("Introdu cod Operator")
|
||||
TextMasina.Focus()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub TextDefect_TextChangeed(sender As Object, e As EventArgs) Handles TextDefect.TextChanged
|
||||
' validare text box 1 cu OQ
|
||||
If TextDefect.Text.Length < 4 Then
|
||||
|
||||
ElseIf TextDefect.Text.Length = 4 Then
|
||||
Dim val As String
|
||||
val = TextDefect.Text
|
||||
If InStr(1, val, "D") > 0 Then
|
||||
Dim dta As String 'string pentru SQL data
|
||||
dta = Date.Now.ToString("yyyy.MM.dd") ' format string
|
||||
Label4.Text = dta 'Update in Label
|
||||
Dim dTime As String 'string pentru SQL time
|
||||
dTime = Date.Now.ToString("hh:mm") 'Format time
|
||||
Dim nu As String = "NULL"
|
||||
Label5.Text = dTime ' update in label
|
||||
Dim cant As Integer 'cantitate 1 intodeauna
|
||||
cant = 1
|
||||
Dim status As String = "Deschis"
|
||||
Dim con As New SqlConnection("Data Source=" & surce & "; Initial Catalog=" & catalog & "; User ID=" & user &
|
||||
"; Password=" & pass & "; Connect Timeout=" & timeout & "; Encrypt=" & encrypt &
|
||||
"; TrustServerCertificate=" & trust & "; ApplicationIntent=" & reason & "; MultiSubnetFailover=" & subnet & "")
|
||||
con.Open()
|
||||
Dim command As New SqlCommand("Insert into calitate.dbo.mentenanta (Data, Ora, zona, masina, defect, status) values('" & dta & "','" & dTime & "','" & ComboBox1.Text & "','" & TextMasina.Text & "','" & TextDefect.Text & "','" & status & "')", con)
|
||||
command.ExecuteNonQuery()
|
||||
con.Close()
|
||||
updateTable()
|
||||
TextMasina.Clear()
|
||||
TextDefect.Clear()
|
||||
End If
|
||||
Else
|
||||
MsgBox("Introdu cod Operator")
|
||||
TextDefect.Focus()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user