Merge branch 'newMaster2024' of https://git.it.verag.ag/edv/SDL into newMaster2024
This commit is contained in:
101
VERAG_PROG_ALLGEMEIN/Classes/cSendungCustomsCases.vb
Normal file
101
VERAG_PROG_ALLGEMEIN/Classes/cSendungCustomsCases.vb
Normal file
@@ -0,0 +1,101 @@
|
||||
Imports System.Data.SqlClient
|
||||
Imports System.Reflection
|
||||
Imports System.Linq
|
||||
|
||||
'Fachdaten zu einem bereits gespeicherten tblSendungen-Datensatz.
|
||||
'Zuerst cSendungen.SAVE(), anschließend cSendungCustomsCases.SAVE() aufrufen.
|
||||
Public Class cSendungCustomsCases
|
||||
Public hasEntry As Boolean = False
|
||||
Private ReadOnly SQL As New VERAG_PROG_ALLGEMEIN.SQL
|
||||
|
||||
Public Property scc_SendungID As Integer = 0
|
||||
Public Property scc_Type As Short = 0
|
||||
Public Property scc_Subject As String = Nothing
|
||||
Public Property scc_CustomsOffice As String = Nothing
|
||||
Public Property scc_CustomsReference As String = Nothing
|
||||
Public Property scc_DocumentDate As Date? = Nothing
|
||||
Public Property scc_ReceivedDate As Date? = Nothing
|
||||
Public Property scc_Deadline As Date? = Nothing
|
||||
Public Property scc_ReminderDate As Date? = Nothing
|
||||
Public Property scc_ReferenceMRN As String = Nothing
|
||||
Public Property scc_Amount As Decimal? = Nothing
|
||||
Public Property scc_Currency As String = Nothing
|
||||
Public Property scc_Status As Short = 0
|
||||
Public Property scc_Result As Short? = Nothing
|
||||
Public Property scc_ClosedDate As Date? = Nothing
|
||||
|
||||
Public Sub New(sendungId As Integer, Optional autoLoad As Boolean = True)
|
||||
scc_SendungID = sendungId
|
||||
If autoLoad AndAlso sendungId > 0 Then 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("scc_SendungID", scc_SendungID,, True))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Type", scc_Type))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Subject", scc_Subject))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_CustomsOffice", scc_CustomsOffice))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_CustomsReference", scc_CustomsReference))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_DocumentDate", scc_DocumentDate))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_ReceivedDate", scc_ReceivedDate))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Deadline", scc_Deadline))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_ReminderDate", scc_ReminderDate))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_ReferenceMRN", scc_ReferenceMRN))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Amount", scc_Amount))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Currency", scc_Currency))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Status", scc_Status))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_Result", scc_Result))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("scc_ClosedDate", scc_ClosedDate))
|
||||
Return list
|
||||
End Function
|
||||
|
||||
Public Sub LOAD()
|
||||
Try
|
||||
hasEntry = False
|
||||
If scc_SendungID <= 0 Then Exit Sub
|
||||
Using conn As SqlConnection = SQL.GetNewOpenConnectionAVISO()
|
||||
Using cmd As New SqlCommand("SELECT * FROM dbo.tblSendungCustomsCases WHERE scc_SendungID=@scc_SendungID", conn)
|
||||
cmd.Parameters.Add("@scc_SendungID", SqlDbType.Int).Value = scc_SendungID
|
||||
Using dr As SqlDataReader = cmd.ExecuteReader()
|
||||
If dr.Read() Then
|
||||
For Each li In getParameterList()
|
||||
Dim propInfo As PropertyInfo = Me.GetType().GetProperty(li.Scalarvariable)
|
||||
If propInfo Is Nothing Then Continue For
|
||||
Dim value As Object = dr(li.Text)
|
||||
If value Is DBNull.Value Then
|
||||
propInfo.SetValue(Me, Nothing)
|
||||
Else
|
||||
Dim targetType As Type = Nullable.GetUnderlyingType(propInfo.PropertyType)
|
||||
If targetType Is Nothing Then targetType = propInfo.PropertyType
|
||||
propInfo.SetValue(Me, Convert.ChangeType(value, targetType))
|
||||
End If
|
||||
Next
|
||||
hasEntry = True
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
Throw
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Public Function SAVE() As Boolean
|
||||
If scc_SendungID <= 0 Then Throw New InvalidOperationException("Zuerst die Sendung speichern; SendungID fehlt.")
|
||||
Dim sqlstr As String = "SET XACT_ABORT ON; BEGIN TRAN; " &
|
||||
"IF EXISTS(SELECT 1 FROM dbo.tblSendungCustomsCases WITH (UPDLOCK,HOLDLOCK) WHERE scc_SendungID=@scc_SendungID) " &
|
||||
"BEGIN " & getUpdateCmd() & " END ELSE BEGIN " & getInsertCmd() & " END; COMMIT TRAN;"
|
||||
Return SQL.doSQLVarList(sqlstr, "AVISO", , getParameterList())
|
||||
End Function
|
||||
|
||||
Public Function getUpdateCmd() As String
|
||||
Dim cols = getParameterList().Where(Function(x) Not x.isPrimaryParam).Select(Function(x) "[" & x.Text & "]=@" & x.Scalarvariable)
|
||||
Return "UPDATE dbo.tblSendungCustomsCases SET " & String.Join(",", cols) & " WHERE scc_SendungID=@scc_SendungID;"
|
||||
End Function
|
||||
|
||||
Public Function getInsertCmd() As String
|
||||
Dim list = getParameterList()
|
||||
Return "INSERT INTO dbo.tblSendungCustomsCases (" & String.Join(",", list.Select(Function(x) "[" & x.Text & "]")) & ") VALUES (" & String.Join(",", list.Select(Function(x) "@" & x.Scalarvariable)) & ");"
|
||||
End Function
|
||||
End Class
|
||||
@@ -5,6 +5,7 @@ Public Class cSendungen
|
||||
Property tblSnd_SendungID As Integer = Nothing
|
||||
Property tblSnd_PosUnterNr As Integer = Nothing
|
||||
Property tblSnd_AvisoID As Integer = Nothing
|
||||
Public Property tblSnd_AktTyp As String = "CLEARANCE"
|
||||
Property tblSnd_Zollsystem_Land As Object = Nothing
|
||||
Property tblSnd_Abfertigungsart_ID As Integer = Nothing
|
||||
Property tblSnd_EmpfaengerKdNr As Integer = Nothing
|
||||
@@ -386,6 +387,7 @@ Public Class cSendungen
|
||||
Me.tblSnd_SendungID = SQL.checkNullReturnValue(dr.Item("tblSnd_SendungID"), Nothing)
|
||||
Me.tblSnd_PosUnterNr = SQL.checkNullReturnValue(dr.Item("tblSnd_PosUnterNr"), Nothing)
|
||||
Me.tblSnd_AvisoID = SQL.checkNullReturnValue(dr.Item("tblSnd_AvisoID"), Nothing)
|
||||
Me.tblSnd_AktTyp = If(dr.Item("tblSnd_AktTyp") Is DBNull.Value, "CLEARANCE", Convert.ToString(dr.Item("tblSnd_AktTyp")))
|
||||
Me.tblSnd_Zollsystem_Land = SQL.checkNullReturnValue(dr.Item("tblSnd_Zollsystem_Land"), Nothing)
|
||||
Me.tblSnd_Abfertigungsart_ID = SQL.checkNullReturnValue(dr.Item("tblSnd_Abfertigungsart_ID"), Nothing)
|
||||
Me.tblSnd_EmpfaengerKdNr = SQL.checkNullReturnValue(dr.Item("tblSnd_EmpfaengerKdNr"), Nothing)
|
||||
@@ -614,6 +616,7 @@ Public Class cSendungen
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_SendungID", tblSnd_SendungID, , True)) 'UPDATE INSERT ISPRIMARY!
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_PosUnterNr", tblSnd_PosUnterNr))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_AvisoID", tblSnd_AvisoID))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_AktTyp", If(String.IsNullOrWhiteSpace(tblSnd_AktTyp), "CLEARANCE", tblSnd_AktTyp)))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_Zollsystem_Land", tblSnd_Zollsystem_Land))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_Abfertigungsart_ID", tblSnd_Abfertigungsart_ID))
|
||||
list.Add(New VERAG_PROG_ALLGEMEIN.SQLVariable("tblSnd_EmpfaengerKdNr", tblSnd_EmpfaengerKdNr))
|
||||
|
||||
@@ -192,51 +192,108 @@ Public Class cDATENSERVER
|
||||
Return False
|
||||
End Function
|
||||
|
||||
Function moveTo_ARCHIVARCHIV()
|
||||
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
|
||||
Dim newDIR = DATENVERVER_OPTIONS.getDescPath(rootDirARCHIVARCHIV, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
|
||||
|
||||
|
||||
Function moveTo_ARCHIVARCHIV(Optional fehlerListe As List(Of String) = Nothing, Optional logPfad As String = Nothing) As Boolean
|
||||
Dim hasErrors As Boolean = False
|
||||
|
||||
Try
|
||||
' My.Computer.FileSystem.RenameDirectory(oldDIR, newname)
|
||||
Dim oldDIR = DATENVERVER_OPTIONS.getDescPath(rootDir, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
Dim newDIR = DATENVERVER_OPTIONS.getDescPath(rootDirARCHIVARCHIV, da_kategorie, da_ordner, da_uOrdner1, da_uOrdner2, da_uOrdner3, da_KundenNr, "", "", True)
|
||||
|
||||
Dim oldBase = System.IO.Path.GetFullPath(oldDIR).TrimEnd("\"c) & "\"
|
||||
Dim newBase = System.IO.Path.GetFullPath(newDIR).TrimEnd("\"c) & "\"
|
||||
Dim createdDirectories As New HashSet(Of String)(StringComparer.OrdinalIgnoreCase)
|
||||
|
||||
For Each li In DATA_LIST.LIST
|
||||
Dim alterPfad As String = li.coll_pfad
|
||||
|
||||
|
||||
Dim newPfad = li.coll_pfad.Replace(oldDIR, newDIR)
|
||||
'MsgBox(li.coll_pfad)
|
||||
' MsgBox(newPfad)
|
||||
If Not System.IO.Directory.Exists(newDIR) Then System.IO.Directory.CreateDirectory(newDIR)
|
||||
Try
|
||||
If Not li.coll_pfad.ToLower.StartsWith("\\stor01.verag.ost.dmn\datenarchivarchiv") Then
|
||||
If Not li.coll_pfad.Contains("?") Then
|
||||
If System.IO.File.Exists(li.coll_pfad) Then
|
||||
My.Computer.FileSystem.CopyFile(li.coll_pfad, newPfad, True)
|
||||
My.Computer.FileSystem.DeleteFile(li.coll_pfad)
|
||||
li.coll_pfad = newPfad
|
||||
If Not li.UPDATE() Then
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
'Datei Existiert nicht!
|
||||
li.coll_pfad = li.coll_pfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
|
||||
If Not li.UPDATE() Then
|
||||
Return False
|
||||
End If
|
||||
If String.IsNullOrWhiteSpace(alterPfad) Then Continue For
|
||||
If alterPfad.StartsWith("\\stor01.verag.ost.dmn\datenarchivarchiv\", StringComparison.OrdinalIgnoreCase) Then Continue For
|
||||
If alterPfad.StartsWith("\\DELETED\", StringComparison.OrdinalIgnoreCase) Then Continue For
|
||||
If alterPfad.Contains("?") Then Continue For
|
||||
|
||||
If System.IO.File.Exists(alterPfad) Then
|
||||
Dim fullPath = System.IO.Path.GetFullPath(alterPfad)
|
||||
|
||||
If Not fullPath.StartsWith(oldBase, StringComparison.OrdinalIgnoreCase) Then
|
||||
Throw New Exception("Datei liegt nicht im Quellverzeichnis: " & alterPfad)
|
||||
End If
|
||||
|
||||
Dim newPfad = newBase & fullPath.Substring(oldBase.Length)
|
||||
Dim zielOrdner = System.IO.Path.GetDirectoryName(newPfad)
|
||||
|
||||
If createdDirectories.Add(zielOrdner) Then
|
||||
System.IO.Directory.CreateDirectory(zielOrdner)
|
||||
End If
|
||||
|
||||
System.IO.File.Copy(alterPfad, newPfad, True)
|
||||
|
||||
li.coll_pfad = newPfad
|
||||
|
||||
If Not li.UPDATE() Then
|
||||
li.coll_pfad = alterPfad
|
||||
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
|
||||
End If
|
||||
|
||||
Try
|
||||
System.IO.File.Delete(alterPfad)
|
||||
Catch exDelete As Exception
|
||||
hasErrors = True
|
||||
LogArchivFehler("LÖSCHEN FEHLGESCHLAGEN | da_id=" & da_id & " | " & alterPfad & " | " & exDelete.Message, fehlerListe, logPfad)
|
||||
End Try
|
||||
|
||||
Else
|
||||
Dim deletedPfad = alterPfad.Replace("\\datenarchiv.verag.ost.dmn\", "\\DELETED\")
|
||||
|
||||
If deletedPfad <> alterPfad Then
|
||||
li.coll_pfad = deletedPfad
|
||||
|
||||
If Not li.UPDATE() Then
|
||||
li.coll_pfad = alterPfad
|
||||
Throw New Exception("Datenbankupdate fehlgeschlagen: " & alterPfad)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex2 As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex2.Message, li.coll_pfad & vbNewLine & newPfad & vbNewLine & vbNewLine & ex2.Message & vbNewLine & ex2.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
hasErrors = True
|
||||
li.coll_pfad = alterPfad
|
||||
LogArchivFehler("FEHLER | da_id=" & da_id & " | " & alterPfad & " | " & ex2.Message, fehlerListe, logPfad)
|
||||
End Try
|
||||
Next
|
||||
Return UPDATE()
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, "Fehler in der Funktion '" & System.Reflection.MethodInfo.GetCurrentMethod.Name & "'" & vbNewLine & vbNewLine & ex.Message & vbNewLine & vbNewLine & ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
|
||||
If Not UPDATE() Then
|
||||
hasErrors = True
|
||||
LogArchivFehler("UPDATE FEHLGESCHLAGEN | da_id=" & da_id, fehlerListe, logPfad)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
hasErrors = True
|
||||
LogArchivFehler("ALLGEMEINER FEHLER | da_id=" & da_id & " | " & ex.Message, fehlerListe, logPfad)
|
||||
End Try
|
||||
Return False
|
||||
|
||||
Return Not hasErrors
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub LogArchivFehler(fehlerText As String, fehlerListe As List(Of String), logPfad As String)
|
||||
Dim eintrag As String = Date.Now.ToString("dd.MM.yyyy HH:mm:ss") & " | " & fehlerText
|
||||
|
||||
If fehlerListe IsNot Nothing Then fehlerListe.Add(eintrag)
|
||||
|
||||
If Not String.IsNullOrWhiteSpace(logPfad) Then
|
||||
Try
|
||||
System.IO.File.AppendAllText(logPfad, eintrag & Environment.NewLine, System.Text.Encoding.UTF8)
|
||||
Catch ex As Exception
|
||||
Debug.WriteLine("Archiv-Log konnte nicht geschrieben werden: " & ex.Message)
|
||||
End Try
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Function UPDATE() As Boolean
|
||||
Try
|
||||
'If coll_id < 0 Then 'Wenn noch keine ID vergeben
|
||||
|
||||
@@ -24,7 +24,6 @@ Partial Class frmMessenger
|
||||
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
|
||||
<System.Diagnostics.DebuggerStepThrough()>
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
|
||||
@@ -39,12 +38,12 @@ Partial Class frmMessenger
|
||||
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMessenger))
|
||||
Me.SplitContainer = New System.Windows.Forms.SplitContainer()
|
||||
Me.SplitContainer2 = New System.Windows.Forms.SplitContainer()
|
||||
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.dgvChats = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
|
||||
Me.Panel6 = New System.Windows.Forms.Panel()
|
||||
Me.Label3 = New System.Windows.Forms.Label()
|
||||
Me.lblLKWChat_MsgCntInaktiv = New System.Windows.Forms.Label()
|
||||
Me.cbxInaktiveChats = New System.Windows.Forms.CheckBox()
|
||||
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
|
||||
Me.DGVSonstige = New VERAG_PROG_ALLGEMEIN.MyDatagridview()
|
||||
Me.Panel5 = New System.Windows.Forms.Panel()
|
||||
Me.MyTextBox2 = New VERAG_PROG_ALLGEMEIN.MyTextBox()
|
||||
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
|
||||
@@ -65,7 +64,7 @@ Partial Class frmMessenger
|
||||
Me.btnNeu = New System.Windows.Forms.Button()
|
||||
Me.Button1 = New System.Windows.Forms.Button()
|
||||
Me.SplitContainer1 = New System.Windows.Forms.SplitContainer()
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel(Me.components)
|
||||
Me.MyFlowLayoutPanel1 = New VERAG_PROG_ALLGEMEIN.MyFlowLayoutPanel()
|
||||
Me.UsrCntlMessenger_ChatElement1 = New VERAG_PROG_ALLGEMEIN.usrCntlMessenger_ChatElement()
|
||||
Me.Panel3 = New System.Windows.Forms.Panel()
|
||||
Me.btnTeilnehmer = New System.Windows.Forms.Button()
|
||||
@@ -93,9 +92,9 @@ Partial Class frmMessenger
|
||||
Me.btnSendAtt = New System.Windows.Forms.Button()
|
||||
Me.btnSenden = New System.Windows.Forms.Button()
|
||||
Me.rtbChatMessage = New System.Windows.Forms.RichTextBox()
|
||||
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer(Me.components)
|
||||
Me.Timer_REFRESH = New System.Windows.Forms.Timer(Me.components)
|
||||
Me.cntxt = New System.Windows.Forms.ContextMenuStrip(Me.components)
|
||||
Me.TimerNEW_MESSAGE = New System.Windows.Forms.Timer()
|
||||
Me.Timer_REFRESH = New System.Windows.Forms.Timer()
|
||||
Me.cntxt = New System.Windows.Forms.ContextMenuStrip()
|
||||
Me.ChatDeaktivierenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.toolChatReminder = New System.Windows.Forms.ToolStripMenuItem()
|
||||
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
|
||||
|
||||
@@ -423,6 +423,7 @@
|
||||
<Compile Include="Classes\cMDMZinsberechnung.vb" />
|
||||
<Compile Include="Classes\cKundenportal.vb" />
|
||||
<Compile Include="Classes\cKundenSicherheiten.vb" />
|
||||
<Compile Include="Classes\cSendungCustomsCases.vb" />
|
||||
<Compile Include="frmTimasabfrage.Designer.vb">
|
||||
<DependentUpon>frmTimasabfrage.vb</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user