Creditsave-Rountine, Mailsender, etc.

This commit is contained in:
2025-09-03 10:04:56 +02:00
parent 01a8f1f7ad
commit 18f433f345
6 changed files with 830 additions and 277 deletions

View File

@@ -3459,7 +3459,7 @@ Public Class usrctlProcedures
Dim kdnr_tmp = ""
Try
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
Dim fd As New OpenFileDialog
If fd.ShowDialog = DialogResult.OK Then
@@ -4016,6 +4016,218 @@ Public Class usrctlProcedures
End Sub
Private Sub Button49_Click_1(sender As Object, e As EventArgs) Handles Button49.Click
Dim cnt = 0
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Try
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = cbxMDM_Testsystem.Checked
Dim fd As New OpenFileDialog
If fd.ShowDialog = DialogResult.OK Then
If fd.FileName.ToLower.EndsWith(".csv") Then
' fd.FileName.EndsWith(".csv")
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(fd.FileName, Encoding.Default)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
If currentRow.Length > 2 Then
If (isleernothing(currentRow(0)) IsNot Nothing AndAlso isleernothing(currentRow(0)) <> "NULL") AndAlso (isleernothing(currentRow(1)) IsNot Nothing AndAlso isleernothing(currentRow(1)) <> "NULL") AndAlso (isleernothing(currentRow(2)) IsNot Nothing AndAlso isleernothing(currentRow(2)) <> "NULL") AndAlso (isleernothing(currentRow(3)) IsNot Nothing AndAlso isleernothing(currentRow(3)) <> "NULL") Then
'OffertenNr, Währung, LeistungsNr, LeistungsBez
Dim STDOF As New cStandardofferten(currentRow(0), currentRow(1), currentRow(2), currentRow(3))
If STDOF.hasEntry Then
Dim save As Boolean = False
If isleernothing(currentRow(12)) IsNot Nothing AndAlso isleernothing(currentRow(12)) <> "NULL" Then
save = True
STDOF.LeistungsBez_EN = isleernothing(currentRow(12))
End If
If isleernothing(currentRow(13)) IsNot Nothing AndAlso isleernothing(currentRow(13)) <> "NULL" Then
save = True
STDOF.LeistungsBez_RO = isleernothing(currentRow(13))
End If
If isleernothing(currentRow(14)) IsNot Nothing AndAlso isleernothing(currentRow(14)) <> "NULL" Then
save = True
STDOF.LeistungsBez_TR = isleernothing(currentRow(14))
End If
If save Then STDOF.SAVE()
ElseIf currentRow(2) = 117 Or currentRow(2) = 118 Or currentRow(2) = 119 Then
STDOF.SAVE()
End If
End If
End If
cnt += 1
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
End While
End Using
End If
End If
Catch ex As Exception
MessageBox.Show("Datei nicht vorhanden.")
Finally
End Try
End Sub
Private Sub Button50_Click(sender As Object, e As EventArgs) Handles Button50.Click
Dim cnt = 0
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Dim kdnr_tmp = ""
Try
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = False
Dim fd As New OpenFileDialog
If fd.ShowDialog = DialogResult.OK Then
If fd.FileName.ToLower.EndsWith(".csv") Then
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(fd.FileName, Encoding.Default)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
If currentRow.Length > 2 Then
If isleernothing(currentRow(0)) IsNot Nothing AndAlso IsNumeric(currentRow(0)) Then
Dim KUNDE_ERW As New cKundenErweitert(currentRow(0))
If KUNDE_ERW IsNot Nothing Then
KUNDE_ERW.kde_BezFIBU = currentRow(4)
KUNDE_ERW.SAVE()
End If
End If
End If
cnt += 1
Catch ex As Exception
MsgBox(kdnr_tmp & " " & ex.Message & ex.StackTrace)
End Try
End While
End Using
End If
End If
Catch ex As Exception
MessageBox.Show("Datei nicht vorhanden.")
Finally
End Try
End Sub
Private Sub Button51_Click(sender As Object, e As EventArgs) Handles Button51.Click
Dim cnt = 0
Dim sql As New VERAG_PROG_ALLGEMEIN.SQL
Try
VERAG_PROG_ALLGEMEIN.cAllgemein.TESTSYSTEM = True
Dim fd As New OpenFileDialog
If fd.ShowDialog = DialogResult.OK Then
If fd.FileName.ToLower.EndsWith(".csv") Then
' fd.FileName.EndsWith(".csv")
Using MyReader As New Microsoft.VisualBasic.FileIO.TextFieldParser(fd.FileName, Encoding.Default)
MyReader.TextFieldType = FileIO.FieldType.Delimited
MyReader.SetDelimiters(";")
Dim currentRow As String()
While Not MyReader.EndOfData
Try
currentRow = MyReader.ReadFields()
If currentRow.Length > 2 AndAlso isleernothing(currentRow(0)) IsNot Nothing AndAlso IsNumeric(currentRow(0)) Then
Dim OFPOS As New cOffertPosition(currentRow(0), currentRow(1), currentRow(2), currentRow(4))
Dim andereLeistungsNr As Boolean = False
If isleernothing(currentRow(2)) IsNot Nothing AndAlso isleernothing(currentRow(3)) AndAlso IsNumeric(currentRow(2)) AndAlso IsNumeric(currentRow(3)) Then
If CInt(currentRow(2)) <> CInt(currentRow(3)) Then
andereLeistungsNr = True
Else
andereLeistungsNr = False
End If
End If
If OFPOS IsNot Nothing Then
If Not andereLeistungsNr Then
OFPOS.LeistungsBez = currentRow(5)
OFPOS.UPDATE(currentRow(4).ToString)
Else
OFPOS.LeistungsBez = currentRow(5)
OFPOS.UPDATE(currentRow(4).ToString)
OFPOS.LeistungsNr = currentRow(3)
OFPOS.UPDATE(CInt(currentRow(2)))
End If
End If
End If
cnt += 1
Catch ex As Exception
MsgBox(ex.Message & ex.StackTrace)
End Try
End While
End Using
End If
End If
Catch ex As Exception
MessageBox.Show("Datei nicht vorhanden.")
Finally
End Try
End Sub
'Private Sub Button26_Click(sender As Object, e As EventArgs)
' For Each d In System.IO.Directory.GetDirectories("\\192.168.0.91\Datenarchiv\DAKOSY\ECHTSYSTEM\Nachrichtendaten_Ablage\2019")