|
|
Imports UtilityLibrary
|
|
|
Imports System.IO
|
|
|
Imports C1.Win.C1TrueDBGrid
|
|
|
Imports System.Data
|
|
|
Imports System.Data.SqlTypes
|
|
|
Imports System.Data.SqlClient
|
|
|
Imports System.ComponentModel
|
|
|
Imports UtilityLibrary.Win32
|
|
|
|
|
|
|
|
|
Namespace EDOKA
|
|
|
|
|
|
Public Class clsarchivfnkt
|
|
|
#Region "Deklarationen"
|
|
|
Dim DokumentArchiviert As Integer
|
|
|
Dim BDRDokumentArchiviert As Integer
|
|
|
'EDEX Banklagernd
|
|
|
Dim BLArchiviert As Integer
|
|
|
|
|
|
Dim m_bck As Boolean = False
|
|
|
Property bck() As Boolean
|
|
|
Get
|
|
|
Return m_bck
|
|
|
End Get
|
|
|
Set(ByVal Value As Boolean)
|
|
|
m_bck = Value
|
|
|
End Set
|
|
|
End Property
|
|
|
|
|
|
Dim m_inkl_bedingter_retournierung As Boolean = False
|
|
|
Property Inkl_Bedingter_Retournierung() As Boolean
|
|
|
Get
|
|
|
Return m_inkl_bedingter_retournierung
|
|
|
End Get
|
|
|
Set(ByVal Value As Boolean)
|
|
|
m_inkl_bedingter_retournierung = Value
|
|
|
End Set
|
|
|
End Property
|
|
|
|
|
|
Dim m_dokumentidbr As String = ""
|
|
|
Property Dokument_Bedingte_Retournierung() As String
|
|
|
Get
|
|
|
Return m_dokumentidbr
|
|
|
End Get
|
|
|
Set(ByVal Value As String)
|
|
|
m_dokumentidbr = Value
|
|
|
End Set
|
|
|
End Property
|
|
|
#End Region
|
|
|
Dim DeleteDok As Integer = 0
|
|
|
Public Function check_bereits_archiviert(ByVal dokumentid As String, ByVal fordelete As Boolean, Optional ByVal dokstatusnr As Integer = 0) As Boolean
|
|
|
Dim res As Integer
|
|
|
Dim f As New frmDieFrage()
|
|
|
|
|
|
Me.DokumentArchiviert = 0
|
|
|
Me.BDRDokumentArchiviert = 0
|
|
|
DeleteDok = 0
|
|
|
If fordelete = True Then DeleteDok = 1
|
|
|
res = ist_archiviert(dokumentid)
|
|
|
|
|
|
'EDEX Banklagernd
|
|
|
If fordelete And Me.BLArchiviert > 0 Then
|
|
|
If MyMsg.Show_MessageYesNoBL(613) = MsgBoxResult.No Then
|
|
|
Return False
|
|
|
Else
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Return True
|
|
|
End If
|
|
|
End If
|
|
|
|
|
|
If Me.BLArchiviert > 0 Then
|
|
|
If MyMsg.Show_MessageYesNoBL(614) = MsgBoxResult.No Then
|
|
|
Return False
|
|
|
Exit Function
|
|
|
End If
|
|
|
|
|
|
If f.Deletefrage Then
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Else
|
|
|
Globals.DokumentID_New_Copy = DivFnkt.Generate_Key
|
|
|
change_dokumentid(dokumentid, Globals.DokumentID_New_Copy)
|
|
|
Globals.Dokumentidalt = dokumentid
|
|
|
dokumentid = Globals.DokumentID_New_Copy
|
|
|
copy_indexdata(dokumentid, "Alt")
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Globals.dokumentid_changed = True
|
|
|
|
|
|
If Me.Inkl_Bedingter_Retournierung = True Then
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.DokumentID_New_CopyBR = DivFnkt.Generate_Key
|
|
|
change_dokumentid(Me.Dokument_Bedingte_Retournierung, Globals.DokumentID_New_CopyBR)
|
|
|
Globals.Dokumentidaltbr = Me.Dokument_Bedingte_Retournierung
|
|
|
Me.Dokument_Bedingte_Retournierung = Globals.DokumentID_New_CopyBR
|
|
|
copy_indexdata_bedingte_retournierung(Me.Dokument_Bedingte_Retournierung, "Alt")
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.dokumentid_changedbr = True
|
|
|
Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & Me.Dokument_Bedingte_Retournierung & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
da.Fill(ds, "Ersetzen")
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = False
|
|
|
Try
|
|
|
If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = True
|
|
|
End If
|
|
|
Catch
|
|
|
End Try
|
|
|
da.Dispose()
|
|
|
ds.Dispose()
|
|
|
End If
|
|
|
End If
|
|
|
Return True
|
|
|
End If
|
|
|
|
|
|
|
|
|
If Me.bck = True Then
|
|
|
MyMsg.show_standardmessage(118, MsgBoxStyle.Information)
|
|
|
Return False
|
|
|
Exit Function
|
|
|
End If
|
|
|
|
|
|
|
|
|
'L<>schen des Dokumentes - Bedingt Retournierbares Dokument wird nicht ber<65>cksichtigt
|
|
|
' If fordelete And res <> 0 Then
|
|
|
Globals.DokAnKundeVersant = False
|
|
|
If fordelete Then
|
|
|
'Rel 3.6
|
|
|
If dokstatusnr < -1 Then
|
|
|
res = 0
|
|
|
End If
|
|
|
If Not ToDelete(res, dokumentid) Then
|
|
|
Return False
|
|
|
Globals.DokAnKundeVersant = False
|
|
|
Else
|
|
|
Return True
|
|
|
End If
|
|
|
Exit Function
|
|
|
End If
|
|
|
|
|
|
'Keine Archivierung - Bedingt Retournierbares Dokument archiviert
|
|
|
If res = 0 And Me.BDRDokumentArchiviert <> 0 Then
|
|
|
f.Deletefrage = False
|
|
|
f.DokumentStatus = res
|
|
|
f.Inkl_Bedingte_Retournierung = True
|
|
|
f.ShowDialog()
|
|
|
If f.DialogResult = DialogResult.Abort Then
|
|
|
Return False
|
|
|
Exit Function
|
|
|
End If
|
|
|
End If
|
|
|
|
|
|
'Archivierung wurde durchgef<65>hrt - inkl. Bedingt Retournierbares Dokumente
|
|
|
If res <> 0 Then
|
|
|
f.Deletefrage = False
|
|
|
f.DokumentStatus = res
|
|
|
f.Inkl_Bedingte_Retournierung = Me.BDRDokumentArchiviert <> 0
|
|
|
f.ShowDialog()
|
|
|
If f.DialogResult = DialogResult.Abort Then
|
|
|
Return False
|
|
|
Exit Function
|
|
|
End If
|
|
|
End If
|
|
|
|
|
|
If res <> 0 Then
|
|
|
Globals.dokumentcoldindex_status = ""
|
|
|
If f.Deletefrage = True Then
|
|
|
If f.NeueVersion Or f.Loeschung Then
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Else
|
|
|
Globals.dokumentcoldindex_status = "Ung<EFBFBD>ltig"
|
|
|
End If
|
|
|
Else
|
|
|
If f.NeueVersion Then
|
|
|
Globals.DokumentID_New_Copy = DivFnkt.Generate_Key
|
|
|
change_dokumentid(dokumentid, Globals.DokumentID_New_Copy)
|
|
|
Globals.Dokumentidalt = dokumentid
|
|
|
dokumentid = Globals.DokumentID_New_Copy
|
|
|
copy_indexdata(dokumentid, "Alt")
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Globals.dokumentid_changed = True
|
|
|
Else
|
|
|
copy_indexdata(dokumentid, "Ung<EFBFBD>ltig")
|
|
|
Globals.dokumentcoldindex_status = "Ung<EFBFBD>ltig"
|
|
|
End If
|
|
|
End If
|
|
|
|
|
|
Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
da.Fill(ds, "Ersetzen")
|
|
|
Globals.Ersetzte_Dokumente_Reaktivieren = False
|
|
|
Try
|
|
|
If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
Globals.Ersetzte_Dokumente_Reaktivieren = True
|
|
|
End If
|
|
|
Catch
|
|
|
End Try
|
|
|
da.Dispose()
|
|
|
ds.Dispose()
|
|
|
End If
|
|
|
|
|
|
If Me.Inkl_Bedingter_Retournierung = True And Me.BDRDokumentArchiviert <> 0 Then
|
|
|
Globals.Dokumentcoldindex_statusbr = ""
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.DokumentID_New_CopyBR = DivFnkt.Generate_Key
|
|
|
change_dokumentid(Me.Dokument_Bedingte_Retournierung, Globals.DokumentID_New_CopyBR)
|
|
|
Globals.Dokumentidaltbr = Me.Dokument_Bedingte_Retournierung
|
|
|
Me.Dokument_Bedingte_Retournierung = Globals.DokumentID_New_CopyBR
|
|
|
copy_indexdata_bedingte_retournierung(Me.Dokument_Bedingte_Retournierung, "Alt")
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.dokumentid_changedbr = True
|
|
|
Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & Me.Dokument_Bedingte_Retournierung & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
da.Fill(ds, "Ersetzen")
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = False
|
|
|
Try
|
|
|
If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = True
|
|
|
End If
|
|
|
Catch
|
|
|
End Try
|
|
|
da.Dispose()
|
|
|
ds.Dispose()
|
|
|
End If
|
|
|
Return True
|
|
|
End Function
|
|
|
|
|
|
'Public Function check_bereits_archiviert(ByVal dokumentid As String, ByVal fordelete As Boolean) As Boolean
|
|
|
' Dim res As Integer
|
|
|
' Dim f As New frmDieFrage()
|
|
|
|
|
|
' Me.DokumentArchiviert = 0
|
|
|
' Me.BDRDokumentArchiviert = 0
|
|
|
' res = ist_archiviert(dokumentid)
|
|
|
|
|
|
' 'EDEX Banklagernd
|
|
|
' If fordelete And Me.BLArchiviert > 0 Then
|
|
|
' Globals.dokumentcoldindex_status = "Alt"
|
|
|
' Return True
|
|
|
' End If
|
|
|
|
|
|
' If Me.BLArchiviert > 0 Then
|
|
|
' If f.Deletefrage Then
|
|
|
' Globals.dokumentcoldindex_status = "Alt"
|
|
|
' Else
|
|
|
' Globals.DokumentID_New_Copy = DivFnkt.Generate_Key
|
|
|
' change_dokumentid(dokumentid, Globals.DokumentID_New_Copy)
|
|
|
' Globals.Dokumentidalt = dokumentid
|
|
|
' dokumentid = Globals.DokumentID_New_Copy
|
|
|
' copy_indexdata(dokumentid, "Alt")
|
|
|
' Globals.dokumentcoldindex_status = "Alt"
|
|
|
' Globals.dokumentid_changed = True
|
|
|
|
|
|
' If Me.Inkl_Bedingter_Retournierung = True Then
|
|
|
' Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
' Globals.DokumentID_New_CopyBR = DivFnkt.Generate_Key
|
|
|
' change_dokumentid(Me.Dokument_Bedingte_Retournierung, Globals.DokumentID_New_CopyBR)
|
|
|
' Globals.Dokumentidaltbr = Me.Dokument_Bedingte_Retournierung
|
|
|
' Me.Dokument_Bedingte_Retournierung = Globals.DokumentID_New_CopyBR
|
|
|
' copy_indexdata_bedingte_retournierung(Me.Dokument_Bedingte_Retournierung, "Alt")
|
|
|
' Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
' Globals.dokumentid_changedbr = True
|
|
|
' Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & Me.Dokument_Bedingte_Retournierung & "'", Globals.sConnectionString)
|
|
|
' Dim ds As New DataSet()
|
|
|
' da.Fill(ds, "Ersetzen")
|
|
|
' Globals.ersetzte_dokumente_reaktivierenbr = False
|
|
|
' Try
|
|
|
' If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
' Globals.ersetzte_dokumente_reaktivierenbr = True
|
|
|
' End If
|
|
|
' Catch
|
|
|
' End Try
|
|
|
' da.Dispose()
|
|
|
' ds.Dispose()
|
|
|
' End If
|
|
|
' End If
|
|
|
|
|
|
' Return True
|
|
|
' End If
|
|
|
|
|
|
|
|
|
' If Me.bck = True Then
|
|
|
' MyMsg.show_standardmessage(118, MsgBoxStyle.Information)
|
|
|
' Return False
|
|
|
' Exit Function
|
|
|
' End If
|
|
|
|
|
|
|
|
|
' 'L<>schen des Dokumentes - Bedingt Retournierbares Dokument wird nicht ber<65>cksichtigt
|
|
|
' ' If fordelete And res <> 0 Then
|
|
|
' Globals.DokAnKundeVersant = False
|
|
|
' If fordelete Then
|
|
|
' If Not ToDelete(res, dokumentid) Then
|
|
|
' Return False
|
|
|
' Globals.DokAnKundeVersant = False
|
|
|
' Else
|
|
|
' Return True
|
|
|
' End If
|
|
|
' Exit Function
|
|
|
' End If
|
|
|
|
|
|
' 'Keine Archivierung - Bedingt Retournierbares Dokument archiviert
|
|
|
' If res = 0 And Me.BDRDokumentArchiviert <> 0 Then
|
|
|
' f.Deletefrage = False
|
|
|
' f.DokumentStatus = res
|
|
|
' f.Inkl_Bedingte_Retournierung = True
|
|
|
' f.ShowDialog()
|
|
|
' If f.DialogResult = DialogResult.Abort Then
|
|
|
' Return False
|
|
|
' Exit Function
|
|
|
' End If
|
|
|
' End If
|
|
|
|
|
|
' 'Archivierung wurde durchgef<65>hrt - inkl. Bedingt Retournierbares Dokumente
|
|
|
' If res <> 0 Then
|
|
|
' f.Deletefrage = False
|
|
|
' f.DokumentStatus = res
|
|
|
' f.Inkl_Bedingte_Retournierung = Me.BDRDokumentArchiviert <> 0
|
|
|
' f.ShowDialog()
|
|
|
' If f.DialogResult = DialogResult.Abort Then
|
|
|
' Return False
|
|
|
' Exit Function
|
|
|
' End If
|
|
|
' End If
|
|
|
|
|
|
' If res <> 0 Then
|
|
|
' Globals.dokumentcoldindex_status = ""
|
|
|
' If f.Deletefrage = True Then
|
|
|
' If f.NeueVersion Or f.Loeschung Then
|
|
|
' Globals.dokumentcoldindex_status = "Alt"
|
|
|
' Else
|
|
|
' Globals.dokumentcoldindex_status = "Ung<6E>ltig"
|
|
|
' End If
|
|
|
' Else
|
|
|
' If f.NeueVersion Then
|
|
|
' Globals.DokumentID_New_Copy = DivFnkt.Generate_Key
|
|
|
' change_dokumentid(dokumentid, Globals.DokumentID_New_Copy)
|
|
|
' Globals.Dokumentidalt = dokumentid
|
|
|
' dokumentid = Globals.DokumentID_New_Copy
|
|
|
' copy_indexdata(dokumentid, "Alt")
|
|
|
' Globals.dokumentcoldindex_status = "Alt"
|
|
|
' Globals.dokumentid_changed = True
|
|
|
' Else
|
|
|
' copy_indexdata(dokumentid, "Ung<6E>ltig")
|
|
|
' Globals.dokumentcoldindex_status = "Ung<6E>ltig"
|
|
|
' End If
|
|
|
' End If
|
|
|
|
|
|
' Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
' Dim ds As New DataSet()
|
|
|
' da.Fill(ds, "Ersetzen")
|
|
|
' Globals.Ersetzte_Dokumente_Reaktivieren = False
|
|
|
' Try
|
|
|
' If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
' Globals.Ersetzte_Dokumente_Reaktivieren = True
|
|
|
' End If
|
|
|
' Catch
|
|
|
' End Try
|
|
|
' da.Dispose()
|
|
|
' ds.Dispose()
|
|
|
' End If
|
|
|
|
|
|
' If Me.Inkl_Bedingter_Retournierung = True And Me.BDRDokumentArchiviert <> 0 Then
|
|
|
' Globals.Dokumentcoldindex_statusbr = ""
|
|
|
' Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
' Globals.DokumentID_New_CopyBR = DivFnkt.Generate_Key
|
|
|
' change_dokumentid(Me.Dokument_Bedingte_Retournierung, Globals.DokumentID_New_CopyBR)
|
|
|
' Globals.Dokumentidaltbr = Me.Dokument_Bedingte_Retournierung
|
|
|
' Me.Dokument_Bedingte_Retournierung = Globals.DokumentID_New_CopyBR
|
|
|
' copy_indexdata_bedingte_retournierung(Me.Dokument_Bedingte_Retournierung, "Alt")
|
|
|
' Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
' Globals.dokumentid_changedbr = True
|
|
|
' Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & Me.Dokument_Bedingte_Retournierung & "'", Globals.sConnectionString)
|
|
|
' Dim ds As New DataSet()
|
|
|
' da.Fill(ds, "Ersetzen")
|
|
|
' Globals.ersetzte_dokumente_reaktivierenbr = False
|
|
|
' Try
|
|
|
' If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
' Globals.ersetzte_dokumente_reaktivierenbr = True
|
|
|
' End If
|
|
|
' Catch
|
|
|
' End Try
|
|
|
' da.Dispose()
|
|
|
' ds.Dispose()
|
|
|
' End If
|
|
|
' Return True
|
|
|
'End Function
|
|
|
|
|
|
Public Function ToDelete(ByVal MessageType As Integer, ByVal dokumentid As String) As Boolean
|
|
|
If MessageType = 0 Then
|
|
|
Return True
|
|
|
Exit Function
|
|
|
End If
|
|
|
Dim f As New frmDieFrage()
|
|
|
f.Deletefrage = True
|
|
|
f.DokumentStatus = MessageType
|
|
|
f.ShowDialog()
|
|
|
If f.DialogResult = DialogResult.Abort Then
|
|
|
Return False
|
|
|
Exit Function
|
|
|
End If
|
|
|
|
|
|
If f.Deletefrage = True Then
|
|
|
If f.NeueVersion Or f.Loeschung Then
|
|
|
Globals.dokumentcoldindex_status = "Alt"
|
|
|
Else
|
|
|
Globals.dokumentcoldindex_status = "Ung<EFBFBD>ltig"
|
|
|
End If
|
|
|
End If
|
|
|
|
|
|
Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
da.Fill(ds, "Ersetzen")
|
|
|
Globals.Ersetzte_Dokumente_Reaktivieren = False
|
|
|
Try
|
|
|
If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
Globals.Ersetzte_Dokumente_Reaktivieren = True
|
|
|
End If
|
|
|
Catch
|
|
|
End Try
|
|
|
da.Dispose()
|
|
|
ds.Dispose()
|
|
|
Return True
|
|
|
End Function
|
|
|
|
|
|
Public Function Check_Bereits_Archiviert_Bedingte_Retournierung(ByVal dokumentid As String) As Boolean
|
|
|
Globals.dokumentid_changedbr = False
|
|
|
Dim res As Integer
|
|
|
res = ist_archiviert(dokumentid)
|
|
|
If res <> 0 Then
|
|
|
Check_Bereits_Archiviert_Bedingte_Retournierung = True
|
|
|
Globals.Dokumentcoldindex_statusbr = ""
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.DokumentID_New_CopyBR = DivFnkt.Generate_Key
|
|
|
change_dokumentid(dokumentid, Globals.DokumentID_New_CopyBR)
|
|
|
Globals.Dokumentidaltbr = dokumentid
|
|
|
dokumentid = Globals.DokumentID_New_CopyBR
|
|
|
copy_indexdata_bedingte_retournierung(dokumentid, "Alt")
|
|
|
Globals.Dokumentcoldindex_statusbr = "Alt"
|
|
|
Globals.dokumentid_changedbr = True
|
|
|
End If
|
|
|
Dim da As New SqlDataAdapter("Select count(*) from dokumentersetzen where hauptdokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
da.Fill(ds, "Ersetzen")
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = False
|
|
|
Try
|
|
|
If ds.Tables(0).Rows(0).Item(0) > 0 Then
|
|
|
Globals.ersetzte_dokumente_reaktivierenbr = True
|
|
|
End If
|
|
|
Catch
|
|
|
End Try
|
|
|
da.Dispose()
|
|
|
ds.Dispose()
|
|
|
End Function
|
|
|
|
|
|
Private Sub copy_indexdata(ByVal dokumentid As String, ByVal Status As String)
|
|
|
Dim sda As New SqlDataAdapter("select * from dokumentcoldindexwert where (indextyp=1 or indextyp=2) and dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim sda1 As New SqlDataAdapter("select * from dokumentcoldindexwert where dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim sda3 As New SqlDataAdapter("select max(indextyp) from dokumentcoldindexwert where dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
Globals.general_ds.Clear()
|
|
|
sda.Fill(ds, "Dokumentcoldindexwert")
|
|
|
sda1.Fill(Globals.general_ds, "Dokumentcoldindexwert")
|
|
|
Globals.Dokumentcoldindex_Changed = True
|
|
|
sda.Fill(ds, "DokumentcoldindexwertNeu")
|
|
|
sda3.Fill(ds, "Maxwert")
|
|
|
Dim i As Integer
|
|
|
Dim Maxwert As Integer
|
|
|
Maxwert = ds.Tables(2).Rows(0).Item(0)
|
|
|
If Maxwert < 2 Then Maxwert = 2
|
|
|
Dim i1 As Integer
|
|
|
Dim i2 As Integer
|
|
|
i1 = 0
|
|
|
i2 = 0
|
|
|
For i = 0 To ds.Tables(0).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If (ds.Tables(0).Rows(i).Item("BESTA00") = "Aktuell" Or ds.Tables(0).Rows(i).Item("BESTA00") = "Alt") Then
|
|
|
If ds.Tables(0).Rows(i).Item("indextyp") = 1 Then i1 = 1
|
|
|
If ds.Tables(0).Rows(i).Item("indextyp") = 2 Then i2 = 1
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
For i = 0 To ds.Tables(0).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(0).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(0).Rows(i).Item("indextyp") = Maxwert + 1
|
|
|
ds.Tables(0).Rows(i).Item("BESTA00") = Status
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(0).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(0).Rows(i).Item("indextyp") = Maxwert + 2
|
|
|
ds.Tables(0).Rows(i).Item("BESTA00") = Status
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
For i = 0 To ds.Tables(1).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("BESTA00") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("BESTA00") = ""
|
|
|
End If
|
|
|
End If
|
|
|
If Not ds.Tables(0).Rows(i).Item("DMSTA01") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("DMSTA01") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("DMSTA01") = ""
|
|
|
End If
|
|
|
End If
|
|
|
If Not ds.Tables(0).Rows(i).Item("NRDOC00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("NRDOC00") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("NRDOC00") = ""
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
Dim cd As New SqlCommandBuilder(sda)
|
|
|
sda.Update(ds, "Dokumentcoldindexwert")
|
|
|
|
|
|
DokumentColdIndexWert_Insert(ds.Tables(1), i1, i2)
|
|
|
|
|
|
sda.Dispose()
|
|
|
sda1.Dispose()
|
|
|
sda3.Dispose()
|
|
|
End Sub
|
|
|
|
|
|
Private Function DokumentColdIndexWert_Insert(ByVal dtOrg As DataTable, ByVal i1 As Integer, ByVal i2 As Integer)
|
|
|
'Coldindexwerte Inserten mit Daten aus neuer Tabellen Struktur
|
|
|
Dim i As Integer
|
|
|
Dim dw As New edokadb.clsDokumentcoldindexwert()
|
|
|
dw.cpMainConnectionProvider = conn
|
|
|
|
|
|
Dim lcnt As Integer
|
|
|
Dim sWert As String
|
|
|
Dim sFieldArray(12) As String
|
|
|
sFieldArray(0) = "NRPAR00"
|
|
|
sFieldArray(1) = "BKPAR00"
|
|
|
sFieldArray(2) = "NAVVG00"
|
|
|
sFieldArray(3) = "BEBEZ00"
|
|
|
sFieldArray(4) = "DMSTA01"
|
|
|
sFieldArray(5) = "BEDAT00"
|
|
|
sFieldArray(6) = "BESTA00"
|
|
|
sFieldArray(7) = "BEORT00"
|
|
|
sFieldArray(8) = "NRDOC00"
|
|
|
sFieldArray(9) = "NRSTA00"
|
|
|
sFieldArray(10) = "BEGSF00"
|
|
|
sFieldArray(11) = "BEUSR00"
|
|
|
sFieldArray(12) = "BERES03"
|
|
|
|
|
|
For i = 0 To dtOrg.Rows.Count - 1
|
|
|
If (i1 = 1 And dtOrg.Rows(i).Item("indextyp") = 1) Or _
|
|
|
(i2 = 1 And dtOrg.Rows(i).Item("indextyp") = 2) Then
|
|
|
dw.iIndextyp = New SqlInt32(CType(dtOrg.Rows(i).Item(1), Int32))
|
|
|
dw.iMandantnr = New SqlInt32(CType(dtOrg.Rows(i).Item("mandantnr"), Int32))
|
|
|
dw.bAktiv = New SqlBoolean(CType(dtOrg.Rows(i).Item("aktiv"), Boolean))
|
|
|
dw.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
dw.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
dw.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
|
dw.sDokumentid = New SqlString(CType(dtOrg.Rows(i).Item("dokumentid"), String))
|
|
|
|
|
|
For lcnt = 0 To 12
|
|
|
If Not dtOrg.Rows(i).Item(sFieldArray(lcnt)) Is System.DBNull.Value Then
|
|
|
sWert = CType(dtOrg.Rows(i).Item(sFieldArray(lcnt)), String)
|
|
|
Else
|
|
|
sWert = ""
|
|
|
End If
|
|
|
Select Case sFieldArray(lcnt)
|
|
|
Case sFieldArray(0)
|
|
|
dw.sNRPAR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(1)
|
|
|
dw.sBKPAR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(2)
|
|
|
dw.sNAVVG00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(3)
|
|
|
dw.sBEBEZ00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(4)
|
|
|
dw.sDMSTA01 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(5)
|
|
|
dw.sBEDAT00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(6)
|
|
|
dw.sBESTA00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(7)
|
|
|
dw.sBEORT00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(8)
|
|
|
dw.sNRDOC00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(9)
|
|
|
dw.sNRSTA00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(10)
|
|
|
dw.sBEGSF00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(11)
|
|
|
dw.sBEUSR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(12)
|
|
|
dw.sBERES03 = New SqlString(CType(sWert, String))
|
|
|
End Select
|
|
|
Next
|
|
|
conn.OpenConnection()
|
|
|
dw.Insert()
|
|
|
conn.CloseConnection(True)
|
|
|
End If
|
|
|
Next
|
|
|
dw.Dispose()
|
|
|
End Function
|
|
|
|
|
|
Private Function DokumentColdIndexWert_InsertWert(ByVal dtOrg As DataTable)
|
|
|
'Coldindexwerte Inserten mit Daten aus alter Tabellen Struktur
|
|
|
Dim i As Integer
|
|
|
Dim dw As New edokadb.clsDokumentcoldindexwert()
|
|
|
dw.cpMainConnectionProvider = conn
|
|
|
|
|
|
Dim lcnt As Integer
|
|
|
Dim sWert As String
|
|
|
Dim sFieldArray(12) As String
|
|
|
sFieldArray(0) = "NRPAR00"
|
|
|
sFieldArray(1) = "BKPAR00"
|
|
|
sFieldArray(2) = "NAVVG00"
|
|
|
sFieldArray(3) = "BEBEZ00"
|
|
|
sFieldArray(4) = "DMSTA01"
|
|
|
sFieldArray(5) = "BEDAT00"
|
|
|
sFieldArray(6) = "BESTA00"
|
|
|
sFieldArray(7) = "BEORT00"
|
|
|
sFieldArray(8) = "NRDOC00"
|
|
|
sFieldArray(9) = "NRSTA00"
|
|
|
sFieldArray(10) = "BEGSF00"
|
|
|
sFieldArray(11) = "BEUSR00"
|
|
|
sFieldArray(12) = "BERES03"
|
|
|
|
|
|
For i = 0 To dtOrg.Rows.Count - 1
|
|
|
dw.iIndextyp = New SqlInt32(CType(dtOrg.Rows(i).Item(1), Int32))
|
|
|
dw.iMandantnr = New SqlInt32(CType(dtOrg.Rows(i).Item("mandantnr"), Int32))
|
|
|
dw.bAktiv = New SqlBoolean(CType(dtOrg.Rows(i).Item("aktiv"), Boolean))
|
|
|
dw.daErstellt_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
dw.daMutiert_am = New SqlDateTime(CType(Now, DateTime))
|
|
|
dw.iMutierer = New SqlInt32(CType(Globals.MitarbeiterNr, Int32))
|
|
|
dw.sDokumentid = New SqlString(CType(dtOrg.Rows(i).Item("dokumentid"), String))
|
|
|
|
|
|
For lcnt = 0 To 12
|
|
|
If Not dtOrg.Rows(i).Item(sFieldArray(lcnt)) Is System.DBNull.Value Then
|
|
|
sWert = CType(dtOrg.Rows(i).Item(sFieldArray(lcnt)), String)
|
|
|
Else
|
|
|
sWert = ""
|
|
|
End If
|
|
|
Select Case sFieldArray(lcnt)
|
|
|
Case sFieldArray(0)
|
|
|
dw.sNRPAR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(1)
|
|
|
dw.sBKPAR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(2)
|
|
|
dw.sNAVVG00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(3)
|
|
|
dw.sBEBEZ00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(4)
|
|
|
dw.sDMSTA01 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(5)
|
|
|
dw.sBEDAT00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(6)
|
|
|
dw.sBESTA00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(7)
|
|
|
dw.sBEORT00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(8)
|
|
|
dw.sNRDOC00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(9)
|
|
|
dw.sNRSTA00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(10)
|
|
|
dw.sBEGSF00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(11)
|
|
|
dw.sBEUSR00 = New SqlString(CType(sWert, String))
|
|
|
Case sFieldArray(12)
|
|
|
dw.sBERES03 = New SqlString(CType(sWert, String))
|
|
|
End Select
|
|
|
Next
|
|
|
conn.OpenConnection()
|
|
|
dw.Insert()
|
|
|
conn.CloseConnection(True)
|
|
|
Next
|
|
|
dw.Dispose()
|
|
|
'Dim i As Integer
|
|
|
'Dim dw As New edokadb.clsDokumentcoldindexwert()
|
|
|
'dw.cpMainConnectionProvider = conn
|
|
|
|
|
|
'Dim lcnt As Integer
|
|
|
'Dim sWert As String
|
|
|
'Dim sFieldArray(12, 1) As String
|
|
|
'sFieldArray(0, 0) = "NRPAR00"
|
|
|
'sFieldArray(0, 1) = 1
|
|
|
'sFieldArray(1, 0) = "BKPAR00"
|
|
|
'sFieldArray(1, 1) = 2
|
|
|
'sFieldArray(2, 0) = "NAVVG00"
|
|
|
'sFieldArray(2, 1) = 3
|
|
|
'sFieldArray(3, 0) = "BEBEZ00"
|
|
|
'sFieldArray(3, 1) = 4
|
|
|
'sFieldArray(4, 0) = "DMSTA01"
|
|
|
'sFieldArray(4, 1) = 5
|
|
|
'sFieldArray(5, 0) = "BEDAT00"
|
|
|
'sFieldArray(5, 1) = 6
|
|
|
'sFieldArray(6, 0) = "BESTA00"
|
|
|
'sFieldArray(6, 1) = 7
|
|
|
'sFieldArray(7, 0) = "BEORT00"
|
|
|
'sFieldArray(7, 1) = 8
|
|
|
'sFieldArray(8, 0) = "NRDOC00"
|
|
|
'sFieldArray(8, 1) = 10
|
|
|
'sFieldArray(9, 0) = "NRSTA00"
|
|
|
'sFieldArray(9, 1) = 11
|
|
|
'sFieldArray(10, 0) = "BEGSF00"
|
|
|
'sFieldArray(10, 1) = 12
|
|
|
'sFieldArray(11, 0) = "BEUSR00"
|
|
|
'sFieldArray(11, 1) = 13
|
|
|
'sFieldArray(12, 0) = "BERES03"
|
|
|
'sFieldArray(12, 1) = 20
|
|
|
''***********************************************************333
|
|
|
'Dim dtNew As DataTable
|
|
|
'dtNew = New DataTable("DokumentColdIndexWerte")
|
|
|
'Dim Row1 As DataRow
|
|
|
'Try
|
|
|
' dtNew.Columns.Add("iIndextyp", System.Type.GetType("System.integer"))
|
|
|
' dtNew.Columns.Add("iMandantnr", System.Type.GetType("System.integer"))
|
|
|
' dtNew.Columns.Add("bAktiv", System.Type.GetType("System.Boolean"))
|
|
|
' dtNew.Columns.Add("daErstellt_am", System.Type.GetType("System.Datetime"))
|
|
|
' dtNew.Columns.Add("daMutiert_am", System.Type.GetType("System.Datetime"))
|
|
|
' dtNew.Columns.Add("iMutierer", System.Type.GetType("System.Integer"))
|
|
|
' dtNew.Columns.Add("sDokumentid", System.Type.GetType("System.String"))
|
|
|
' For lcnt = 0 To 12 Step 1
|
|
|
' dtNew.Columns.Add(sFieldArray(lcnt, 0), System.Type.GetType("System.String"))
|
|
|
' Next
|
|
|
|
|
|
' Dim bRowAdd As Boolean
|
|
|
' Dim row As DataRow
|
|
|
' For Each row In dtOrg.Rows
|
|
|
' Dim dview As New DataView(dtOrg, "iIndextyp" + "=" + Trim(dtOrg.Rows(i).Item("indextyp")), "iIndextyp", DataViewRowState.CurrentRows)
|
|
|
' If dview.Count = 0 Then
|
|
|
' Row1 = dtNew.NewRow()
|
|
|
' Row1.Item("iIndextyp") = dtOrg.Rows(i).Item("indextyp")
|
|
|
' Row1.Item("iMandantnr") = dtOrg.Rows(i).Item("mandantnr")
|
|
|
' Row1.Item("bAktiv") = dtOrg.Rows(i).Item("aktiv")
|
|
|
' Row1.Item("daErstellt_am") = dtOrg.Rows(i).Item("Erstellt_am")
|
|
|
' Row1.Item("daMutiert_am") = dtOrg.Rows(i).Item("Mutiert_am")
|
|
|
' Row1.Item("iMutierer") = dtOrg.Rows(i).Item("Mutierer")
|
|
|
' Row1.Item("sDokumentid") = dtOrg.Rows(i).Item("dokumentid")
|
|
|
' dtOrg.Rows.Add(Row1)
|
|
|
' bRowAdd = True
|
|
|
' Else
|
|
|
' bRowAdd = False
|
|
|
' End If
|
|
|
|
|
|
|
|
|
|
|
|
' Select Case dtOrg.Rows(i).Item("Cold_indexfeldnr")
|
|
|
' Case sFieldArray(0, 1)
|
|
|
' Row1.Item("iIndextyp") = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(1, 1)
|
|
|
' dw.sBKPAR00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(2, 1)
|
|
|
' dw.sNAVVG00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(3, 1)
|
|
|
' dw.sBEBEZ00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(4, 1)
|
|
|
' dw.sDMSTA01 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(5, 1)
|
|
|
' dw.sBEDAT00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(6, 1)
|
|
|
' dw.sBESTA00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(7, 1)
|
|
|
' dw.sBEORT00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(8, 1)
|
|
|
' dw.sNRDOC00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(9, 1)
|
|
|
' dw.sNRSTA00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(10, 1)
|
|
|
' dw.sBEGSF00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(11, 1)
|
|
|
' dw.sBEUSR00 = New SqlString(CType(sWert, String))
|
|
|
' Case sFieldArray(12, 1)
|
|
|
' dw.sBERES03 = New SqlString(CType(sWert, String))
|
|
|
' End Select
|
|
|
|
|
|
' 'If Not dtOrg.Rows(i).Item(sFieldArray(lcnt)) Is System.DBNull.Value Then
|
|
|
' ' sWert = CType(dtOrg.Rows(i).Item(sFieldArray(lcnt)), String)
|
|
|
' 'Else
|
|
|
' ' sWert = ""
|
|
|
' 'End If
|
|
|
|
|
|
|
|
|
' Next
|
|
|
'Catch
|
|
|
' MsgBox(Err.Description)
|
|
|
'End Try
|
|
|
' dw.Dispose()
|
|
|
|
|
|
|
|
|
End Function
|
|
|
|
|
|
Private Sub copy_indexdata_bedingte_retournierung(ByVal dokumentid As String, ByVal Status As String)
|
|
|
Dim sda As New SqlDataAdapter("select * from dokumentcoldindexwert where (indextyp=1 or indextyp=2) and dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim sda1 As New SqlDataAdapter("select * from dokumentcoldindexwert where dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim sda3 As New SqlDataAdapter("select max(indextyp) from dokumentcoldindexwert where dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim ds As New DataSet()
|
|
|
Globals.general_dsbr.Clear()
|
|
|
sda.Fill(ds, "Dokumentcoldindexwert")
|
|
|
sda1.Fill(Globals.general_dsbr, "Dokumentcoldindexwert")
|
|
|
Globals.DokumentColdIndex_ChangedBR = True
|
|
|
sda.Fill(ds, "DokumentcoldindexwertNeu")
|
|
|
sda3.Fill(ds, "Maxwert")
|
|
|
Dim i As Integer
|
|
|
Dim Maxwert As Integer
|
|
|
Maxwert = ds.Tables(2).Rows(0).Item(0)
|
|
|
If Maxwert < 2 Then Maxwert = 2
|
|
|
Dim i1 As Integer
|
|
|
Dim i2 As Integer
|
|
|
i1 = 0
|
|
|
i2 = 0
|
|
|
For i = 0 To ds.Tables(0).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If (ds.Tables(0).Rows(i).Item("BESTA00") = "Aktuell" Or ds.Tables(0).Rows(i).Item("BESTA00") = "Alt") Then
|
|
|
If ds.Tables(0).Rows(i).Item("indextyp") = 1 Then i1 = 1
|
|
|
If ds.Tables(0).Rows(i).Item("indextyp") = 2 Then i2 = 1
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
For i = 0 To ds.Tables(0).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(0).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(0).Rows(i).Item("indextyp") = Maxwert + 1
|
|
|
ds.Tables(0).Rows(i).Item("BESTA00") = Status
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(0).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(0).Rows(i).Item("indextyp") = Maxwert + 2
|
|
|
ds.Tables(0).Rows(i).Item("BESTA00") = Status
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
For i = 0 To ds.Tables(1).Rows.Count - 1
|
|
|
If Not ds.Tables(0).Rows(i).Item("BESTA00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("BESTA00") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("BESTA00") = ""
|
|
|
End If
|
|
|
End If
|
|
|
If Not ds.Tables(0).Rows(i).Item("DMSTA01") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("DMSTA01") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("DMSTA01") = ""
|
|
|
End If
|
|
|
End If
|
|
|
If Not ds.Tables(0).Rows(i).Item("NRDOC00") Is System.DBNull.Value Then
|
|
|
If i1 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 1 Then
|
|
|
ds.Tables(1).Rows(i).Item("NRDOC00") = ""
|
|
|
End If
|
|
|
If i2 = 1 And ds.Tables(1).Rows(i).Item("indextyp") = 2 Then
|
|
|
ds.Tables(1).Rows(i).Item("NRDOC00") = ""
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
Dim cd As New SqlCommandBuilder(sda)
|
|
|
sda.Update(ds, "Dokumentcoldindexwert")
|
|
|
|
|
|
DokumentColdIndexWert_Insert(ds.Tables(1), i1, i2)
|
|
|
|
|
|
sda.Dispose()
|
|
|
sda3.Dispose()
|
|
|
sda1.Dispose()
|
|
|
ds.Dispose()
|
|
|
End Sub
|
|
|
|
|
|
Private Sub xxcopy_table(ByVal tablename As String, ByVal dokumentid As String)
|
|
|
Dim sda1 As New SqlDataAdapter("Select * from dokumentcoldindexwert dokumentid='" & dokumentid & "'", Globals.sConnectionString)
|
|
|
Dim sda2 As New SqlDataAdapter("Select * from dokumentcoldindexwert where dokumentid='-1'", Globals.sConnectionString)
|
|
|
Dim sdt1 As New DataSet()
|
|
|
Dim sdt2 As New DataSet()
|
|
|
Dim i As Integer
|
|
|
Dim i1 As Integer
|
|
|
sda1.Fill(sdt1, "Dokument")
|
|
|
sda2.Fill(sdt2, "Dokument")
|
|
|
|
|
|
For i1 = 0 To sdt1.Tables(0).Rows.Count - 1
|
|
|
Dim sdt As DataTable = sdt2.Tables(0)
|
|
|
Dim dbrow As DataRow = sdt.NewRow
|
|
|
For i = 1 To sdt1.Tables(0).Columns.Count - 1
|
|
|
dbrow(i) = sdt1.Tables(0).Rows(i1).Item(i)
|
|
|
If sdt1.Tables(0).Columns(i).ColumnName = "dokumentid" Then dbrow(i) = Globals.DokumentID_New_Copy
|
|
|
If sdt1.Tables(0).Columns(i).ColumnName = "dokumenitid" Then dbrow(i) = Globals.DokumentID_New_Copy
|
|
|
If sdt1.Tables(0).Columns(i).ColumnName = "dokumentid1" Then dbrow(i) = Globals.DokumentID_New_Copy
|
|
|
Next
|
|
|
sdt.Rows.Add(dbrow)
|
|
|
Dim cb As New SqlCommandBuilder(sda2)
|
|
|
sda2.Update(sdt2, "Dokument")
|
|
|
cb.Dispose()
|
|
|
sdt.Dispose()
|
|
|
dbrow = Nothing
|
|
|
sdt2.Tables(0).Rows.Clear()
|
|
|
Next
|
|
|
sdt2.Dispose()
|
|
|
sda2.Dispose()
|
|
|
sda1.Dispose()
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
Public Function Restore_Coldindex(ByVal dt As DataTable, ByVal dokumentid As String)
|
|
|
delete_dokumentcoldindexwert(dokumentid)
|
|
|
DokumentColdIndexWert_InsertWert(dt)
|
|
|
End Function
|
|
|
|
|
|
Private Function delete_dokumentcoldindexwert(ByVal dokumentid As String) As Boolean
|
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
|
Dim i As Integer
|
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
|
scmCmdToExecute.CommandText = "dbo.sp_delete_dokumentcoldindexwert"
|
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
|
Try
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
|
|
sdaAdapter.Fill(dtToReturn)
|
|
|
Catch ex As Exception
|
|
|
MsgBox(ex.Message)
|
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
|
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
|
Finally
|
|
|
scmCmdToExecute.Dispose()
|
|
|
sdaAdapter.Dispose()
|
|
|
End Try
|
|
|
End Function
|
|
|
|
|
|
Public Function insert_coldupdate_status(ByVal dt As DataTable, ByVal dokumentid As String, ByVal neuerstatus As String)
|
|
|
Dim i As Integer
|
|
|
Dim colddokumentid As String
|
|
|
Dim neuerwert As String
|
|
|
Dim indextyp As Integer
|
|
|
indextyp = 1
|
|
|
colddokumentid = ""
|
|
|
For i = 0 To dt.Rows.Count - 1
|
|
|
If dt.Columns.Count < 20 Then
|
|
|
If dt.Rows(i).Item("cold_indexfeldnr") = 10 Then colddokumentid = dt.Rows(i).Item("WERT")
|
|
|
If dt.Rows(i).Item("indextyp") <> indextyp Then
|
|
|
insert_coldupdate("BESTA00", colddokumentid, dokumentid, "Aktuell", neuerstatus)
|
|
|
indextyp = dt.Rows(i).Item("indextyp")
|
|
|
End If
|
|
|
Else
|
|
|
colddokumentid = dt.Rows(i).Item("NRDOC00")
|
|
|
If dt.Rows(i).Item("indextyp") <> indextyp Then
|
|
|
insert_coldupdate("BESTA00", colddokumentid, dokumentid, "Aktuell", neuerstatus)
|
|
|
indextyp = dt.Rows(i).Item("indextyp")
|
|
|
End If
|
|
|
End If
|
|
|
Next
|
|
|
insert_coldupdate("BESTA00", colddokumentid, dokumentid, "Aktuell", neuerstatus)
|
|
|
End Function
|
|
|
|
|
|
Public Function insert_coldupdate_reaktivieren(ByVal dt As DataTable, ByVal dokumentid As String, ByVal neuerstatus As String)
|
|
|
Dim i As Integer
|
|
|
Dim colddokumentid As String
|
|
|
Dim neuerwert As String
|
|
|
Dim indextyp1 As Integer
|
|
|
Dim indextyp As Integer
|
|
|
indextyp = 1
|
|
|
indextyp1 = 1
|
|
|
colddokumentid = ""
|
|
|
For i = 0 To dt.Rows.Count - 1
|
|
|
If dt.Rows(i).Item("indextyp") = 2 Then indextyp1 = 2
|
|
|
Next
|
|
|
For i = 0 To dt.Rows.Count - 1
|
|
|
If dt.Rows(i).Item("indextyp") = indextyp1 Then
|
|
|
If dt.Rows(i).Item("cold_indexfeldnr") = 10 Then colddokumentid = dt.Rows(i).Item("WERT")
|
|
|
End If
|
|
|
Next
|
|
|
insert_coldupdate("BESTA00", colddokumentid, dokumentid, "Aktuell", neuerstatus)
|
|
|
End Function
|
|
|
|
|
|
Public Function insert_coldupdate(ByVal feldname As String, ByVal colddokumentid As String, ByVal dokumentid As String, ByVal alterwert As String, ByVal neuerwert As String)
|
|
|
If colddokumentid = "" Then Exit Function
|
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
|
scmCmdToExecute.CommandText = "dbo.sp_insert_coldupdate"
|
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
|
Try
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@feldname", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, feldname))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@colddokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, colddokumentid))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@alterwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, alterwert))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@neuerwert", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, neuerwert))
|
|
|
sdaAdapter.Fill(dtToReturn)
|
|
|
Catch ex As Exception
|
|
|
MsgBox(ex.Message)
|
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
|
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
|
Finally
|
|
|
scmCmdToExecute.Dispose()
|
|
|
sdaAdapter.Dispose()
|
|
|
End Try
|
|
|
|
|
|
End Function
|
|
|
|
|
|
|
|
|
Public Function ist_archiviert(ByVal dokumentid As String) As Integer
|
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
|
Dim i As Integer
|
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
|
scmCmdToExecute.CommandText = "dbo.sp_dokument_bereits_archiviert"
|
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
|
Try
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentid", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentid))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@istarchiviert", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@bdrarchiviert", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
|
|
' EDEX Banklagernd
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@blarchiviert", SqlDbType.Int, 4, ParameterDirection.Output, True, 10, 0, "", DataRowVersion.Proposed, 0))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@bldelete", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.DeleteDok))
|
|
|
sdaAdapter.Fill(dtToReturn)
|
|
|
i = scmCmdToExecute.Parameters.Item("@istarchiviert").Value
|
|
|
ist_archiviert = i
|
|
|
Me.DokumentArchiviert = scmCmdToExecute.Parameters.Item("@istarchiviert").Value
|
|
|
Me.BDRDokumentArchiviert = scmCmdToExecute.Parameters.Item("@bdrarchiviert").Value
|
|
|
Me.BLArchiviert = scmCmdToExecute.Parameters.Item("@blarchiviert").Value
|
|
|
Catch ex As Exception
|
|
|
'MsgBox(ex.Message)
|
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
|
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
|
Finally
|
|
|
scmCmdToExecute.Dispose()
|
|
|
sdaAdapter.Dispose()
|
|
|
End Try
|
|
|
End Function
|
|
|
|
|
|
Public Function change_dokumentid(ByVal dokumentidalt As String, ByVal dokumentidneu As String) As String
|
|
|
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
|
|
|
Dim i As Integer
|
|
|
Dim dtToReturn As DataTable = New DataTable()
|
|
|
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
|
|
|
scmCmdToExecute.CommandText = "dbo.sp_change_dokumentid"
|
|
|
scmCmdToExecute.CommandType = CommandType.StoredProcedure
|
|
|
scmCmdToExecute.Connection = conn.scoDBConnection
|
|
|
Try
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentidalt", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentidalt))
|
|
|
scmCmdToExecute.Parameters.Add(New SqlParameter("@dokumentidneu", SqlDbType.VarChar, 22, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, dokumentidneu))
|
|
|
sdaAdapter.Fill(dtToReturn)
|
|
|
Catch ex As Exception
|
|
|
MsgBox(ex.Message)
|
|
|
' // some error occured. Bubble it to caller and encapsulate Exception object
|
|
|
Throw New Exception("Dokument_Information_Wert::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
|
|
|
Finally
|
|
|
scmCmdToExecute.Dispose()
|
|
|
sdaAdapter.Dispose()
|
|
|
End Try
|
|
|
End Function
|
|
|
|
|
|
|
|
|
End Class
|
|
|
End Namespace
|
|
|
|