UIDPrf, MDM-Einarbeitung
This commit is contained in:
156
VERAG_PROG_ALLGEMEIN/Classes/cMDMEInarbeitung.vb
Normal file
156
VERAG_PROG_ALLGEMEIN/Classes/cMDMEInarbeitung.vb
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
|
||||||
|
Imports System.Data.SqlClient
|
||||||
|
Imports System.Reflection
|
||||||
|
|
||||||
|
Public Class cMDMEInarbeitung
|
||||||
|
Property id As Integer
|
||||||
|
Property supplier As Object = Nothing
|
||||||
|
Property invoicedate As Object = Nothing
|
||||||
|
Property ds_count As Object = Nothing
|
||||||
|
Property ds_total As Object = Nothing
|
||||||
|
Property completed As Object = Nothing
|
||||||
|
Property completed_date As Object = Nothing
|
||||||
|
|
||||||
|
Public hasEntry = False
|
||||||
|
|
||||||
|
Dim SQL As New SQL
|
||||||
|
|
||||||
|
Sub New(id)
|
||||||
|
Me.id = id
|
||||||
|
LOAD()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Sub New(supplier, invoicedate)
|
||||||
|
Me.supplier = supplier
|
||||||
|
Me.invoicedate = invoicedate
|
||||||
|
LOAD(supplier, invoicedate)
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Function getParameterList() As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
|
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("id", id,, True))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("supplier", supplier))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("invoicedate", invoicedate))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ds_count", ds_count))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("ds_total", ds_total))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed", completed))
|
||||||
|
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("completed_date", completed_date))
|
||||||
|
|
||||||
|
Return list
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Function SAVE() As Boolean
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
|
||||||
|
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM tblMDMEinarbeitung WHERE id=@id) " &
|
||||||
|
" BEGIN " & getUpdateCmd() & " END " &
|
||||||
|
" Else " &
|
||||||
|
" BEGIN " & getInsertCmd() & " END " &
|
||||||
|
" commit tran "
|
||||||
|
|
||||||
|
Return SQL.doSQLVarList(sqlstr, "FMZOLL", , list)
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Public Sub LOAD()
|
||||||
|
Try
|
||||||
|
hasEntry = False
|
||||||
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||||
|
Using cmd As New SqlCommand("SELECT * FROM tblMDMEinarbeitung WHERE id=@id ", conn)
|
||||||
|
cmd.Parameters.AddWithValue("@id", id)
|
||||||
|
Dim dr = cmd.ExecuteReader()
|
||||||
|
If dr.Read Then
|
||||||
|
For Each li In getParameterList()
|
||||||
|
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||||
|
|
||||||
|
If dr.Item(li.Text) Is DBNull.Value Then
|
||||||
|
propInfo.SetValue(Me, Nothing)
|
||||||
|
Else
|
||||||
|
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
hasEntry = True
|
||||||
|
End If
|
||||||
|
dr.Close()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub LOAD(supplier, invoicedate)
|
||||||
|
Try
|
||||||
|
hasEntry = False
|
||||||
|
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
|
||||||
|
Using cmd As New SqlCommand("SELECT * FROM tblMDMEinarbeitung WHERE supplier=@supplier and invoicedate=@invoicedate ", conn)
|
||||||
|
cmd.Parameters.AddWithValue("@supplier", supplier)
|
||||||
|
cmd.Parameters.AddWithValue("@invoicedate", invoicedate)
|
||||||
|
Dim dr = cmd.ExecuteReader()
|
||||||
|
If dr.Read Then
|
||||||
|
For Each li In getParameterList()
|
||||||
|
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(li.Scalarvariable)
|
||||||
|
|
||||||
|
If dr.Item(li.Text) Is DBNull.Value Then
|
||||||
|
propInfo.SetValue(Me, Nothing)
|
||||||
|
Else
|
||||||
|
propInfo.SetValue(Me, dr.Item(li.Text))
|
||||||
|
End If
|
||||||
|
|
||||||
|
Next
|
||||||
|
hasEntry = True
|
||||||
|
End If
|
||||||
|
dr.Close()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Public Function getUpdateCmd() As String
|
||||||
|
Try
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
|
||||||
|
Dim str As String = ""
|
||||||
|
For Each i In list
|
||||||
|
If Not i.isPrimaryParam Then
|
||||||
|
str &= "[" & i.Text & "] = @" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||||
|
Return (" UPDATE [tblMDMEinarbeitung] SET " & str & " WHERE id=@id ")
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Public Function getInsertCmd() As String
|
||||||
|
Try
|
||||||
|
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
|
||||||
|
Dim str As String = ""
|
||||||
|
Dim values As String = ""
|
||||||
|
For Each i In list
|
||||||
|
If Not i.isPrimaryParam Then
|
||||||
|
str &= "[" & i.Text & "],"
|
||||||
|
values &= "@" & i.Scalarvariable & "," '.Replace("-", "").Replace(" ", "") & ","
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
str = str.Substring(0, str.Length - 1) 'wg. ','
|
||||||
|
values = values.Substring(0, values.Length - 1) 'wg. ','
|
||||||
|
Return (" INSERT INTO tblMDMEinarbeitung (" & str & ") VALUES(" & values & ") ")
|
||||||
|
Catch ex As Exception
|
||||||
|
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||||
|
End Try
|
||||||
|
Return ""
|
||||||
|
End Function
|
||||||
|
|
||||||
|
End Class
|
||||||
@@ -214,6 +214,11 @@ Public Class cUIDPruefung
|
|||||||
r("Ergebnis") = "ERROR"
|
r("Ergebnis") = "ERROR"
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If veroegerungMs > 0 Then
|
||||||
|
Thread.Sleep(veroegerungMs) 'Bei Verögeung soll zwischen jeder Abfrage eine Pause gemacht werden! (Wegen Sperre bei zu vielen Abfragen)
|
||||||
|
End If
|
||||||
|
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -386,6 +386,7 @@
|
|||||||
<Compile Include="AuditFlow\Classes\cAuditFlow.vb" />
|
<Compile Include="AuditFlow\Classes\cAuditFlow.vb" />
|
||||||
<Compile Include="AuditFlow\Classes\cAuditFlow_Pruefobjekte.vb" />
|
<Compile Include="AuditFlow\Classes\cAuditFlow_Pruefobjekte.vb" />
|
||||||
<Compile Include="AuditFlow\Classes\cAuditFlow_Pruefungen.vb" />
|
<Compile Include="AuditFlow\Classes\cAuditFlow_Pruefungen.vb" />
|
||||||
|
<Compile Include="Classes\cMDMEInarbeitung.vb" />
|
||||||
<Compile Include="frmTimasabfrage.Designer.vb">
|
<Compile Include="frmTimasabfrage.Designer.vb">
|
||||||
<DependentUpon>frmTimasabfrage.vb</DependentUpon>
|
<DependentUpon>frmTimasabfrage.vb</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user