This commit is contained in:
2019-10-31 09:23:20 +01:00
parent 021cce6f04
commit c5595a729a
169 changed files with 16226 additions and 3376 deletions

View File

@@ -251,6 +251,15 @@ Public Class SQL
End Function
Function IsNull(o) As Boolean
Try
If o Is Nothing Then Return True
If o Is DBNull.Value Then Return True
If o.ToString.Trim = "" Then Return True
Catch : End Try
Return False
End Function
Function isleernothingDateFormatstring(o) As Object
If o Is Nothing Then Return o
If o.ToString = "" Then Return Nothing
@@ -788,6 +797,30 @@ Public Class SQL
Return ""
End Function
Public Shared Function isDbnullEmpty(o As Object, return_value As Object) As String
If IsDBNull(o) Then : isDbnullEmpty = return_value
ElseIf IsNothing(o) Then : isDbnullEmpty = return_value
Else : isDbnullEmpty = o.ToString
End If
End Function
Public Shared Function isDbnullEmptyCurr(o As Object, return_value As Object) As String
If IsDBNull(o) Then : isDbnullEmptyCurr = return_value
ElseIf IsNothing(o) Then : isDbnullEmptyCurr = return_value
Else : isDbnullEmptyCurr = CDbl(o).ToString("C")
End If
End Function
Public Shared Function isDbnullEmptyDbl(o As Object, kommastellen As Integer, return_value As Object) As String
If IsDBNull(o) Then : isDbnullEmptyDbl = return_value
ElseIf IsNothing(o) Then : isDbnullEmptyDbl = return_value
Else : isDbnullEmptyDbl = CDbl(o).ToString("N" & If(kommastellen > 0, kommastellen, ""))
End If
End Function
Public Shared Function VarToBool(ByVal wert As Object) As Boolean
Try
If wert Is Nothing OrElse wert Is DBNull.Value Then

View File

@@ -43,7 +43,9 @@ Public Class cAdressen
Property UTAExportCSV As Object = Nothing
'Property SSMA_TimeStamp As Object = Nothing
Property MWSTVorauszahlung As Object = Nothing
Property PLOSEKundenNr As Object = Nothing
Public hasEntry = False
Shared SQL As New SQL
@@ -124,6 +126,7 @@ Public Class cAdressen
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("UTAExportCSV", UTAExportCSV))
' list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("SSMA_TimeStamp", SSMA_TimeStamp))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("MWSTVorauszahlung", MWSTVorauszahlung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("PLOSEKundenNr", PLOSEKundenNr))
Return list
End Function

View File

@@ -18,10 +18,10 @@ Public Class cAvisoAnhaenge
End Sub
Sub New(anh_id)
If anh_id IsNot Nothing Then
Me.anh_id = anh_id
' If anh_id IsNot Nothing Then
Me.anh_id = anh_id
LOAD()
End If
' End If
End Sub
Sub New(anh_AvisoId, anh_Name, anh_docId, anh_Art, anh_Typ, Optional anh_SendungsId = Nothing, Optional anh_Reihenfolge = 99)
@@ -32,6 +32,7 @@ Public Class cAvisoAnhaenge
Me.anh_Art = anh_Art
Me.anh_Typ = anh_Typ
Me.anh_Reihenfolge = anh_Reihenfolge
End Sub

View File

@@ -0,0 +1,175 @@
Imports System.Data.SqlClient
Imports System.Reflection
Public Class cDEBundeslaenderPLZ
Property PLZ As Integer
Property Bundesland As String = ""
Property Kreis As String = ""
Property Typ As String = ""
Property Code As String = ""
Dim SQL As New SQL
Sub New()
End Sub
Sub New(PLZ)
Me.PLZ = PLZ
LOADByPLZ(PLZ)
End Sub
Public 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("PLZ", PLZ)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Bundesland", Bundesland)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Kreis", Kreis)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Typ", Typ)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Code", Code)) ' VARCHAR(200) Not NULL,
Return list
End Function
Public Shared Function LOADByPLZ(PLZ As Integer) As cDEBundeslaenderPLZ
Try
Dim VK As New cDEBundeslaenderPLZ
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblDEBundeslaenderPLZ WHERE PLZ=@PLZ ", conn)
cmd.Parameters.AddWithValue("@PLZ", PLZ)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each l In VK.getParameterList()
Dim propInfo As PropertyInfo = VK.GetType.GetProperty(l.Scalarvariable)
If dr.Item(l.Text) Is DBNull.Value Then
propInfo.SetValue(VK, Nothing)
Else
propInfo.SetValue(VK, dr.Item(l.Text))
End If
Next
dr.Close()
Return VK
End If
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return Nothing
End Function
Public Shared Function LOADBundeslandCode_ByPLZ(PLZ As Integer) As String
Try
Dim VK As New cDEBundeslaenderPLZ
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT Code FROM tblDEBundeslaenderPLZ WHERE PLZ=@PLZ ", conn)
cmd.Parameters.AddWithValue("@PLZ", PLZ)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
Return dr.Item("Code")
End If
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return ""
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 tblDEBundeslaenderPLZ WITH(updlock,serializable) WHERE post_id=@post_id) " &
' " BEGIN " & getUpdateCmd() & " END " &
' " Else " &
' " BEGIN " & getInsertCmd() & " END " &
' " commit tran "
' post_id = SQL.doSQLVarListID(post_id, sqlstr, "FMZOLL", , list)
' Return post_id > 0
'End Function
'Public Sub LOAD()
' Try
' Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
' Using cmd As New SqlCommand("SELECT * FROM tblDEBundeslaenderPLZ WHERE post_id=@post_id ", conn)
' cmd.Parameters.AddWithValue("@post_id", post_id)
' Dim dr = cmd.ExecuteReader()
' If dr.Read Then
' For Each l In getParameterList()
' Dim propInfo As PropertyInfo = Me.GetType.GetProperty(l.Scalarvariable)
' If dr.Item(l.Text) Is DBNull.Value Then
' propInfo.SetValue(Me, Nothing)
' Else
' propInfo.SetValue(Me, dr.Item(l.Text))
' End If
' Next
' End If
' dr.Close()
' End Using
' End Using
' Catch ex As Exception
' MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
' 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 [tblDEBundeslaenderPLZ] SET " & str & " WHERE post_id=@post_id ")
' Catch ex As Exception
' MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
' 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 tblDEBundeslaenderPLZ (" & str & ") VALUES(" & values & ") ")
' Catch ex As Exception
' MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
' End Try
' Return ""
'End Function
'Public Function DELETE() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
' Dim sqlstr = " DELETE FROM [tblDEBundeslaenderPLZ] WITH(updlock,serializable) WHERE post_id=" & Me.post_id
' Return SQL.doSQL(sqlstr, "FMZOLL")
'End Function
End Class

View File

@@ -44,7 +44,11 @@ Public Class cKundenErweitert
Property EmailFreigabe_Export As Boolean = False
Property kde_BonitaetsStufe As Object = Nothing
Property kde_Inkasso_Uebergeben As Boolean = False
Property kde_Inkasso_UebergebenAm As Object = Nothing
Property kde_Inkasso_GemeldeterBetrag As Object = Nothing
Property AutoFakturierung As Boolean = False
Property Anmerkungen_Warnhinweis As Object = Nothing
Dim SQL As New SQL
@@ -90,6 +94,11 @@ Public Class cKundenErweitert
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailAnkunft_Export", EmailAnkunft_Export))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("EmailFreigabe_Export", EmailFreigabe_Export))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("kde_BonitaetsStufe", kde_BonitaetsStufe))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("kde_Inkasso_Uebergeben", kde_Inkasso_Uebergeben))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("kde_Inkasso_UebergebenAm", kde_Inkasso_UebergebenAm))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("kde_Inkasso_GemeldeterBetrag", kde_Inkasso_GemeldeterBetrag))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("AutoFakturierung", AutoFakturierung))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("Anmerkungen_Warnhinweis", Anmerkungen_Warnhinweis))
Return list
End Function

View File

@@ -205,6 +205,11 @@ Public Class cKundenKontakte
Return SQL.doSQL(sqlstr, "FMZOLL")
End Function
Public Shared Function DELETE_ALL_KONTAKTE(kkd_KundenNr, Optional kkd_kkaId = -1) As Boolean 'obj As Object, tablename As String, where As String) As Boolean
Dim SQL As New VERAG_PROG_ALLGEMEIN.SQL
Dim sqlstr = " DELETE FROM [tblKundenKontakt] WITH(updlock,serializable) WHERE kkd_KundenNr=" & kkd_KundenNr & If(kkd_kkaId > 0, " AND kkd_kkaId='" & kkd_kkaId & "'", "")
Return SQL.doSQL(sqlstr, "FMZOLL")
End Function
Public Function getInsertCmd() As String
Try

View File

@@ -36,7 +36,7 @@ Public Class cParameterList
Try
LIST.Clear()
Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN
Using cmd As New SqlCommand("SELECT * FROM [tblParameter] WHERE progId=@ProgId " & If(firma IsNot Nothing, " AND firma=@firma", ""), conn)
Using cmd As New SqlCommand("SELECT * FROM [tblParameter] WHERE progId IN (0,@ProgId) " & If(firma IsNot Nothing, " AND firma=@firma", ""), conn)
cmd.Parameters.AddWithValue("@ProgId", ProgId)
cmd.Parameters.AddWithValue("@firma", firma)
' cmd.Parameters.AddWithValue("@OffertenNr", OffertenNr)

View File

@@ -0,0 +1,203 @@
Imports System.Data.SqlClient
Imports System.Reflection
Public Class cPostversand
Property post_id As Integer = -1
Property post_AvisoId As Object = Nothing ' INT NULL,
Property post_SendungsId As Object = Nothing ' INT NULL,
Property post_FilialenNr As Object = Nothing ' INT NULL,
Property post_AbfertigungsNr As Object = Nothing ' INT NULL,
Property post_art As Object = Nothing ' VARCHAR(200) Not NULL,
Property post_Empfaenger_Name1 As Object = Nothing ' VARCHAR(40) Not NULL,
Property post_Empfaenger_Name2 As Object = Nothing ' VARCHAR(40) NULL,
Property post_Empfaenger_Adresse1 As Object = Nothing ' VARCHAR(40) Not NULL,
Property post_Empfaenger_Adresse2 As Object = Nothing ' VARCHAR(60) Not NULL,
Property post_Empfaenger_Adresse3 As Object = Nothing ' VARCHAR(40) NULL,
Property post_ReferenzPaketdienst As Object = Nothing ' VARCHAR(200) NULL,
Property post_ContainerLKWNr As Object = Nothing ' VARCHAR(200) Not NULL,
Property post_Datum As Object = Nothing ' DATETIME Default (getdate()) Not NULL,
Property post_Sachbearbeiter As Object = Nothing ' VARCHAR(200) Not NULL,
Property post_SachbearbeiterId As Object = Nothing ' INT Not NULL,
Property post_FirmaInAuftragKdnr As Object = Nothing ' INT NULL,
Property post_FirmaInAuftrag As Object = Nothing ' VARCHAR(200) NULL,
Property post_Rolle As Object = Nothing ' VARCHAR(200) NULL,
'Property post_LKW As Object = Nothing ' VARCHAR(200) NULL,
Property post_Empfaenger_KdNr As Object = Nothing ' VARCHAR(200) NULL,
' Property post_Rolle As Object = Nothing ' VARCHAR(200) NULL,
Property post_KdAuftrNrAvisierer As Object = Nothing
Property post_RgEmpfaenger_KdNr As Object = Nothing
Property post_RgEmpfaenger_Name As Object = Nothing
Dim SQL As New SQL
Sub New()
End Sub
Sub New(post_id)
Me.post_id = post_id
LOAD()
End Sub
Public 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("post_id", post_id, , True, True))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_AvisoId", post_AvisoId)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_SendungsId", post_SendungsId)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_FilialenNr", post_FilialenNr)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_AbfertigungsNr", post_AbfertigungsNr)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_art", post_art)) ' VARCHAR(200) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_Name1", post_Empfaenger_Name1)) ' VARCHAR(40) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_Name2", post_Empfaenger_Name2)) ' VARCHAR(40) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_Adresse1", post_Empfaenger_Adresse1)) 'VARCHAR(40) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_Adresse2", post_Empfaenger_Adresse2)) 'VARCHAR(60) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_Adresse3", post_Empfaenger_Adresse3)) ' VARCHAR(40) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_ReferenzPaketdienst", post_ReferenzPaketdienst)) ' VARCHAR(200) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_ContainerLKWNr", post_ContainerLKWNr)) '# VARCHAR(200) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Datum", post_Datum)) ' DATETIME Default (getdate()) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Sachbearbeiter", post_Sachbearbeiter)) ' VARCHAR(200) Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_SachbearbeiterId", post_SachbearbeiterId)) ' INT Not NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_FirmaInAuftragKdnr", post_FirmaInAuftragKdnr)) ' INT NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_FirmaInAuftrag", post_FirmaInAuftrag)) ' VARCHAR(200) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Rolle", post_Rolle)) ' VARCHAR(200) NULL,
' list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_LKW", post_LKW)) ' VARCHAR(200) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_Empfaenger_KdNr", post_Empfaenger_KdNr)) ' VARCHAR(200) NULL,
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_KdAuftrNrAvisierer", post_KdAuftrNrAvisierer))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_RgEmpfaenger_KdNr", post_RgEmpfaenger_KdNr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("post_RgEmpfaenger_Name", post_RgEmpfaenger_Name))
Return list
End Function
Public Shared Function LOADByFilialeAbfNr(FilialeNr As Integer, AbfertigungsNr As Integer, Optional post_Rolle As String = "") As cPostversand
Try
Dim VK As New cPostversand
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblPostversand WHERE post_AbfertigungsNr=@post_AbfertigungsNr AND post_FilialenNr=@post_FilialenNr " & If(If(post_Rolle, "") <> "", "AND post_Rolle=@post_Rolle ", ""), conn)
cmd.Parameters.AddWithValue("@post_FilialenNr", FilialeNr)
cmd.Parameters.AddWithValue("@post_AbfertigungsNr", AbfertigungsNr)
cmd.Parameters.AddWithValue("@post_Rolle", post_Rolle)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each l In VK.getParameterList()
Dim propInfo As PropertyInfo = VK.GetType.GetProperty(l.Scalarvariable)
If dr.Item(l.Text) Is DBNull.Value Then
propInfo.SetValue(VK, Nothing)
Else
propInfo.SetValue(VK, dr.Item(l.Text))
End If
Next
dr.Close()
Return VK
End If
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return Nothing
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 tblPostversand WITH(updlock,serializable) WHERE post_id=@post_id) " &
" BEGIN " & getUpdateCmd() & " END " &
" Else " &
" BEGIN " & getInsertCmd() & " END " &
" commit tran "
post_id = SQL.doSQLVarListID(post_id, sqlstr, "FMZOLL", , list)
Return post_id > 0
End Function
Public Sub LOAD()
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionFMZOLL()
Using cmd As New SqlCommand("SELECT * FROM tblPostversand WHERE post_id=@post_id ", conn)
cmd.Parameters.AddWithValue("@post_id", post_id)
Dim dr = cmd.ExecuteReader()
If dr.Read Then
For Each l In getParameterList()
Dim propInfo As PropertyInfo = Me.GetType.GetProperty(l.Scalarvariable)
If dr.Item(l.Text) Is DBNull.Value Then
propInfo.SetValue(Me, Nothing)
Else
propInfo.SetValue(Me, dr.Item(l.Text))
End If
Next
End If
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
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 [tblPostversand] SET " & str & " WHERE post_id=@post_id ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
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 tblPostversand (" & str & ") VALUES(" & values & ") ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return ""
End Function
Public Function DELETE() As Boolean 'obj As Object, tablename As String, where As String) As Boolean
Dim sqlstr = " DELETE FROM [tblPostversand] WITH(updlock,serializable) WHERE post_id=" & Me.post_id
Return SQL.doSQL(sqlstr, "FMZOLL")
End Function
End Class

View File

@@ -0,0 +1,251 @@

Imports System.Data.SqlClient
Imports System.Reflection
Public Class cProgrammeUpdate
Property pud_progId As Object = Nothing
Property pud_codename As String
Property pud_version As String
Property pud_fileName As String
Property pud_filePathFolder As Object = Nothing
Property pud_datum As Date = Now
Property pud_file_Verion As String
Property pud_file_Date As Date
Property pud_file_Size As Integer
Dim SQL As New SQL
Shared Function getParameterList(UD As cProgrammeUpdate) As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
Dim list As New List(Of VERAG_PROG_ALLGEMEIN.SQLVariable)
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_progId", UD.pud_progId))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_codename", UD.pud_codename))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_version", UD.pud_version))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_fileName", UD.pud_fileName))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_filePathFolder", UD.pud_filePathFolder))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_datum", UD.pud_datum))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_file_Verion", UD.pud_file_Verion))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_file_Date", UD.pud_file_Date))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("pud_file_Size", UD.pud_file_Size))
Return list
End Function
Public Function SAVE() As Boolean
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList(Me)
Return SQL.doSQLVarList(getInsertCmd, "ADMIN", , list)
End Function
Public Shared Function LOAD_AKT_LIST(pud_progId) As List(Of cProgrammeUpdate)
Dim LIST As New List(Of cProgrammeUpdate)
Try
Using conn As SqlConnection = SQL.GetNewOpenConnectionADMIN()
Using cmd As New SqlCommand("SELECT * FROM tblProgrammeUpdate WHERE pud_progId=@pud_progId AND pud_version=(SELECT TOP (1) pud_version FROM tblProgrammeUpdate WHERE pud_progId=@pud_progId order by pud_version DESC) ", conn)
cmd.Parameters.AddWithValue("@pud_progId", pud_progId)
Dim dr = cmd.ExecuteReader()
While dr.Read
Dim UD As New cProgrammeUpdate
For Each l In cProgrammeUpdate.getParameterList(UD)
Dim propInfo As PropertyInfo = UD.GetType.GetProperty(l.Scalarvariable)
If dr.Item(l.Text) Is DBNull.Value Then
propInfo.SetValue(UD, Nothing)
Else
propInfo.SetValue(UD, dr.Item(l.Text))
End If
Next
LIST.Add(UD)
End While
dr.Close()
End Using
End Using
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return LIST
End Function
Public Shared Function SAVE_LIST(pud_progId As Integer, pud_version As String, pud_codename As String, LIST As List(Of cProgrammeUpdate)) As Boolean
Dim SQL As New SQL
SQL.doSQL("DELETE FROM tblProgrammeUpdate WHERE pud_version='" & pud_version & "'", "ADMIN")
SAVE_LIST = True
For Each UD In LIST
UD.pud_progId = pud_progId
UD.pud_version = pud_version
UD.pud_codename = pud_codename
If Not UD.SAVE() Then SAVE_LIST = False
Next
End Function
Public Function getUpdateCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList(Me)
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 [tblProgrammeUpdate] SET " & str & " WHERE gb_nr=@gb_nr ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return ""
End Function
Public Function getInsertCmd() As String
Try
Dim list As List(Of VERAG_PROG_ALLGEMEIN.SQLVariable) = getParameterList(Me)
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 tblProgrammeUpdate (" & str & ") VALUES(" & values & ") ")
Catch ex As Exception
MsgBox("Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace)
End Try
Return ""
End Function
Public Shared Function isNewFile(ByRef file As VERAG_PROG_ALLGEMEIN.cProgrammeUpdate, LIST_DEST As List(Of VERAG_PROG_ALLGEMEIN.cProgrammeUpdate)) As Boolean
For Each l In LIST_DEST
If l.pud_filePathFolder = file.pud_filePathFolder And l.pud_fileName = file.pud_fileName And l.pud_file_Size = file.pud_file_Size And l.pud_file_Date = file.pud_file_Date Then
Return False
End If
Next
Return True
End Function
Public Shared Function isOldFile(ByRef file As VERAG_PROG_ALLGEMEIN.cProgrammeUpdate, LIST_SOURCE As List(Of VERAG_PROG_ALLGEMEIN.cProgrammeUpdate)) As Boolean
For Each l In LIST_SOURCE
If l.pud_filePathFolder = file.pud_filePathFolder And l.pud_fileName = file.pud_fileName And l.pud_file_Size = file.pud_file_Size And l.pud_file_Date = file.pud_file_Date Then
Return False
End If
Next
Return True
End Function
Public Shared Function copyProgramLIST(ByRef sourcePfad As String, ByVal destPfad As String, ignoreFilesBeginWith As String()) As Boolean
Try
If destPfad.Trim = "" Then Return False
If sourcePfad.Trim = "" Then Return False
If Not My.Computer.FileSystem.DirectoryExists(sourcePfad) Then
MsgBox("ERROR_COPY_01: Quell-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
If Not My.Computer.FileSystem.DirectoryExists(destPfad) Then
MsgBox("ERROR_COPY_02: Ziel-Ordner existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
Dim LIST_SOURCE As New List(Of VERAG_PROG_ALLGEMEIN.cProgrammeUpdate)
Dim dirNameReplace_SOURCE = ""
Dim DI_SOURCE As New IO.DirectoryInfo(sourcePfad)
RekursivGetFiles(DI_SOURCE, dirNameReplace_SOURCE, LIST_SOURCE, {})
Dim LIST_DEST As New List(Of VERAG_PROG_ALLGEMEIN.cProgrammeUpdate)
Dim dirNameReplace_DEST = ""
Dim DI_DEST As New IO.DirectoryInfo(destPfad)
RekursivGetFiles(DI_DEST, dirNameReplace_DEST, LIST_DEST, ignoreFilesBeginWith)
If LIST_SOURCE.Count = 0 Then
MsgBox("ERROR_COPY_01: Quell-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
If LIST_DEST.Count = 0 Then
MsgBox("ERROR_COPY_02: Ziel-Daten existiert nicht.", MsgBoxStyle.Critical, "ERROR") : Return False
End If
'ORDNER erstellen:
For Each f In LIST_SOURCE
If If(f.pud_filePathFolder, "") <> "" Then
If Not IO.Directory.Exists(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\")) Then
IO.Directory.CreateDirectory(dirNameReplace_DEST & "\" & f.pud_filePathFolder.Replace("\\", "\"))
End If
End If
Next
'Löschen der unbenötigten Files:
For Each f In LIST_DEST
If isOldFile(f, LIST_SOURCE) Then
IO.File.Delete(dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\"))
End If
Next
'Kopieren/Überschreiben der neuen Files:
For Each f In LIST_SOURCE
If isNewFile(f, LIST_DEST) Then
Dim s_path = dirNameReplace_SOURCE & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
Dim d_path = dirNameReplace_DEST & "\" & If(f.pud_filePathFolder, "") & "\" & f.pud_fileName.Replace("\\", "\")
IO.File.Copy(s_path, d_path)
End If
Next
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
Return False
End Try
' If isNewFile(destPfad) Then Return FileCopier(sourcePfad, destPfad)
Return True
End Function
Public Shared Function fileStartsWith(fileName As String, ignoreFilesBeginWith As String())
For Each s In ignoreFilesBeginWith
If fileName.StartsWith(s) Then Return True
Next
Return False
End Function
Public Shared Sub RekursivGetFiles(ByVal oDir As IO.DirectoryInfo, ByRef dirNameReplace As String, ByRef LIST As List(Of VERAG_PROG_ALLGEMEIN.cProgrammeUpdate), ignoreFilesBeginWith As String())
Dim oSubDir As IO.DirectoryInfo
Dim FI As IO.FileInfo
' zunächst alle Dateien des Ordners aufspüren
For Each FI In oDir.GetFiles()
If Not fileStartsWith(FI.Name, ignoreFilesBeginWith) Then 'DATEIEN beginnen mit betimmten Namen, z.B. UPDATER
' Dim FI As New IO.FileInfo(oFile)
If dirNameReplace = "" Then
dirNameReplace = FI.DirectoryName
End If
Dim UD As New VERAG_PROG_ALLGEMEIN.cProgrammeUpdate
UD.pud_fileName = FI.Name
UD.pud_filePathFolder = FI.DirectoryName.Replace(dirNameReplace, "")
If UD.pud_filePathFolder = "" Then UD.pud_filePathFolder = Nothing
UD.pud_file_Size = FI.Length
UD.pud_file_Date = FI.LastWriteTime
UD.pud_file_Verion = "" 'FI.
LIST.Add(UD)
End If
'With oFile
' ListBox1.Items.Add(.DirectoryName & "\" & .Name & vbTab &
' .Length & vbTab & .LastWriteTime)
'End With
Next
' Jetzt alle Unterverzeichnis durchlaufen
' und die Prozedur rekursiv selbst aufrufen
For Each oSubDir In oDir.GetDirectories()
RekursivGetFiles(oSubDir, dirNameReplace, LIST, {})
Next
End Sub
End Class

View File

@@ -37,6 +37,10 @@ Public Class cRechnungsnummern
Case 20
VonRechnungsNr = Now.ToString("yy") & "400001"
BisRechnungsNr = Now.ToString("yy") & "499999"
Case 23 'FrontOffice
VonRechnungsNr = Now.ToString("yy") & "500001"
BisRechnungsNr = Now.ToString("yy") & "599999"
End Select
LfdRechnungsNr = VonRechnungsNr
'-------------------------------------

View File

@@ -62,7 +62,8 @@ Public Class cSendungen
Property tblSnd_AnmerkungDispoliste As Object = Nothing
Property tblSnd_ATANr As Object = ""
Property tblSnd_ATCMRN_Fremd As Object = ""
Property tblSnd_Warenwert As Object = Nothing
Property tblSnd_WarenwertWaehrung As Object = Nothing
Property ABRECHNUNG As New List(Of cSendungAbrechnung)
@@ -221,6 +222,8 @@ Public Class cSendungen
Me.tblSnd_AnmerkungDispoliste = SQL.checkNullReturnValue(dr.Item("tblSnd_AnmerkungDispoliste"), Nothing)
Me.tblSnd_ATANr = SQL.checkNullReturnValue(dr.Item("tblSnd_ATANr"), Nothing)
Me.tblSnd_ATCMRN_Fremd = SQL.checkNullReturnValue(dr.Item("tblSnd_ATCMRN_Fremd"), Nothing)
Me.tblSnd_Warenwert = SQL.checkNullReturnValue(dr.Item("tblSnd_Warenwert"), Nothing)
Me.tblSnd_WarenwertWaehrung = SQL.checkNullReturnValue(dr.Item("tblSnd_WarenwertWaehrung"), Nothing)
End If
@@ -332,6 +335,8 @@ Public Class cSendungen
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_AnmerkungDispoliste", tblSnd_AnmerkungDispoliste))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_ATANr", tblSnd_ATANr))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_ATCMRN_Fremd", tblSnd_ATCMRN_Fremd))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_Warenwert", tblSnd_Warenwert))
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_WarenwertWaehrung", tblSnd_WarenwertWaehrung))
Return list

View File

@@ -555,7 +555,7 @@ Class TrdInvoice_FUNCTIONS
Catch ex As Exception
End Try
getSachkonto = CInt(getSachkonto)
End Function
Shared Function getSQLString_SELECTForTrdInvoice(Optional Firma As Integer = -1)