This commit is contained in:
2023-01-11 21:03:39 +01:00
3 changed files with 18 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
Imports System.Data.SqlClient
Imports System.Reflection
Public Class cKundenVollmachten 'in Arbeit!
Public Class cKundenVollmachten
Property kdvm_Id As Integer
Property kdvm_KundenNr As Object = Nothing

View File

@@ -3,7 +3,7 @@ Imports System.Reflection
Public Class cWarenorte
'Property _BASE_id As Integer
Property wo_id As Integer
Property wo_warenort As Object = Nothing
Property wo_bezeichnung As Object = Nothing
Property wo_firma As Object = Nothing
@@ -13,13 +13,14 @@ Public Class cWarenorte
Property wo_cluster As Object = Nothing
Property wo_grenzstelle As Object = Nothing
Property wo_knnr As Object = Nothing
Property wo_strasse As Object = Nothing
Public hasEntry = False
Dim SQL As New SQL
Sub New(wo_warenort)
Me.wo_warenort = wo_warenort
Sub New(wo_id)
Me.wo_id = wo_id
LOAD()
End Sub
@@ -38,7 +39,7 @@ Public Class cWarenorte
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("_BASE_id", _BASE_id,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_id", wo_id,, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_warenort", wo_warenort))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_bezeichnung", wo_bezeichnung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_firma", wo_firma))
@@ -48,6 +49,7 @@ Public Class cWarenorte
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_cluster", wo_cluster))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_grenzstelle", wo_grenzstelle))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_knnr", wo_knnr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("wo_strasse", wo_strasse))
Return list
End Function
@@ -57,7 +59,7 @@ Public Class cWarenorte
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList()
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblWarenorte] WHERE wo_warenort=@wo_warenort AND wo_firma=@wo_firma) " &
Dim sqlstr = " BEGIN TRAN IF EXISTS(SELECT * FROM [tblWarenorte] WHERE wo_id=@wo_id) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
@@ -67,12 +69,12 @@ Public Class cWarenorte
End Function
Public Sub LOAD()
Try
hasEntry = False
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
Using cmd As New SqlCommand("SELECT * FROM [tblWarenorte] WHERE wo_warenort=@wo_warenort AND wo_firma=@wo_firma ", conn)
cmd.Parameters.AddWithValue("@wo_warenort", wo_warenort)
cmd.Parameters.AddWithValue("@wo_firma", wo_firma)
Using cmd As New SqlCommand("Select * From [tblWarenorte] Where wo_id =@wo_id", conn)
cmd.Parameters.AddWithValue("@wo_id", wo_id)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each li In getParameterList()
@@ -135,7 +137,7 @@ Public Class cWarenorte
End If
Next
str = str.Substring(0, str.Length - 1) 'wg. ','
Return (" UPDATE [tblWarenorte] SET " & str & " WHERE wo_warenort=@wo_warenort ")
Return (" UPDATE [tblWarenorte] SET " & str & " WHERE wo_id=@wo_id ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
@@ -164,14 +166,14 @@ Public Class cWarenorte
Return ""
End Function
Public Function deleteWarenort(ByVal warenort As String, ByVal firma As String) As Boolean
Public Function deleteWarenort(ByVal id As Integer) As Boolean
Try
SQL.doSQL("DELETE FROM [tblWarenorte] WHERE wo_warenort = '" & warenort & "' AND wo_firma='" & firma & "'", "AVISO")
SQL.doSQL("DELETE FROM [tblWarenorte] WHERE wo_id = '" & id & "'", "AVISO")
Return True
Catch ex As SqlException
MsgBox(System.Reflection.MethodInfo.GetCurrentMethod.Name & ": Datensatz kann nicht gelöscht werden!" & vbCrLf & vbCrLf & ex.Message, vbExclamation, "Fehler beim Löschen")
End Try
Catch ex As SqlException
MsgBox(System.Reflection.MethodInfo.GetCurrentMethod.Name & ": Datensatz kann nicht gelöscht werden!" & vbCrLf & vbCrLf & ex.Message, vbExclamation, "Fehler beim Löschen")
End Try
Return False