'Imports System.IO.File Imports System.Data.SqlClient Imports System.Data.SqlTypes ''' '''Version 1.6 / 23.10.2008 Module DBHandling Dim _rs As Stammdaten Dim _old As Stammdaten Function Init(ByRef rs As Stammdaten) As Boolean Dim result As Boolean = True '----Alten Recordset zwischenspeichern (für Handling Versandadresse) Try _old = _rs Catch ex As Exception End Try '----Daten übergeben---- _rs = rs '----DB Verbindung herstellen---- Dim db_conn As New DB_Connection Return result End Function Function partnerNat() As Boolean Dim result As Boolean = True 'Prüfung Betreuer If _rs._ResultContent._partnerNat._betreuerId = "" Then _rs._ResultContent._partnerNat._betreuerId = hlp_GetBetreuerID_Substitute(_rs._ResultContent._partnerNat._partnerNummer) Dim dbRow As DataRow Dim sAction As String = "" '---- Tabelle PARTNER --- Dim dsPartner As New DataSet Dim daPartner As New SqlDataAdapter("select * from partner where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daPartner.SelectCommand.CommandTimeout = Params.SqlTimeout If hlp_Check_Saldierung(_rs._ResultContent._partnerNat._ablaufDatum, _rs._ResultContent._partnerNat.__SAREC00) = True Then 'Version 1.6 23.10.2008 - Ursprüngliche Prüfung mit hlp_check_saldierung abgelöst 'If hlp_Ablaufdatum_beruecksichtigen(_rs._ResultContent._partnerNat._ablaufDatum) Or _rs._ResultContent._partnerNat.__SAREC00 = "7" Then Try 'SALDIERUNG Dim scpartsald As New SqlCommand Dim copartsald As New SqlConnection scpartsald.CommandText = "dbo.sp_saldierter_partner" scpartsald.CommandTimeout = Params.SqlTimeout scpartsald.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 36, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, CInt(_rs._ResultContent._partnerNat._partnerNummer))) scpartsald.CommandType = CommandType.StoredProcedure copartsald.ConnectionString = Globals.sConnectionString_edoka copartsald.Open() scpartsald.Connection = copartsald scpartsald.ExecuteNonQuery() copartsald.Close() scpartsald.Dispose() copartsald.Dispose() sAction = " saldierung" m_log.Log("EDKB04: PartnerNat : " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: PartnerNat saldierung error (sp_saldierter_partner): PNR=" & _rs._ResultContent._partnerNat._partnerNummer & ", Msg:" & Err.Description, Common.Common.JournalEntryType.Error) result = False End Try Else Try daPartner.Fill(dsPartner, "partner") If dsPartner.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtPartner As DataTable = dsPartner.Tables(0) dbRow = dtPartner.NewRow() 'MNK20100916 If _rs._ResultContent._partnerNat._kundenSegment = "WEBP" Then dbRow("IDMSG00") = _rs._ResultContent._partnerNat._kundenSegment dbRow("BKPAR00") = _rs._ResultContent._partnerNat._vorname & " " & _rs._ResultContent._partnerNat._name dbRow("TXADZ011") = _rs._ResultContent._partnerNat._vorname & " " & _rs._ResultContent._partnerNat._name End If dbRow("nrpar00") = _rs._ResultContent._partnerNat._partnerNummer If _rs._ResultContent._partnerNat._ablaufDatum <> "" Then dbRow("validto") = _rs._ResultContent._partnerNat._ablaufDatum End If dbRow("CDVIG00") = _rs._ResultContent._partnerNat.__CDVIG00 dbRow("saldiert") = CType(_rs._ResultContent._partnerNat.__saldiert, Boolean) '--NOT NULL dbRow("cdvsa00") = 0 'RGL20080625 dbRow("azepl00") = 1 'RGL20080625 dbRow("nrparad") = "00" & _rs._ResultContent._partnerNat._partnerNummer 'Neuerfassung, es kann eigene Nummer genommen werden 'Ist nötig sonst stürzt FrmInteressent ab dbRow("TXADZ012") = "" dbRow("TXADZ022") = "" dbRow("TXADZ032") = "" dbRow("TXADZ042") = "" dbRow("TXADZ052") = "" dbRow("TXADZ062") = "" dbRow("TXADZ072") = "" dbRow("TXADZ011") = "" dbRow("TXADZ021") = "" dbRow("TXADZ031") = "" dbRow("TXADZ041") = "" dbRow("TXADZ051") = "" dbRow("TXADZ061") = "" dbRow("TXADZ071") = "" '--TIMESTAMP dbRow("TSMUT00") = hlp_MutDatum("1") dbRow("VDMUTER") = Params.CDMuter dtPartner.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerNat._kundenSegment = "WEBP" Then dsPartner.Tables(0).Rows(0).Item("IDMSG00") = _rs._ResultContent._partnerNat._kundenSegment dsPartner.Tables(0).Rows(0).Item("BKPAR00") = _rs._ResultContent._partnerNat._vorname & " " & _rs._ResultContent._partnerNat._name dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._partnerNat._vorname & " " & _rs._ResultContent._partnerNat._name End If If _rs._ResultContent._partnerNat._ablaufDatum <> "" Then dsPartner.Tables(0).Rows(0).Item("validto") = _rs._ResultContent._partnerNat._ablaufDatum End If If _rs._ResultContent._partnerNat._versandInstruktion <> "" Then dsPartner.Tables(0).Rows(0).Item("CDVIG00") = _rs._ResultContent._partnerNat.__CDVIG00 End If 'Version 1.6 23.10.2008 - Saldierungsstatus nicht ändern If hlp_Check_Saldierung(_rs._ResultContent._partnerNat._ablaufDatum, _rs._ResultContent._partnerNat.__SAREC00) = False Then If dsPartner.Tables(0).Rows(0).Item("saldiert") = True And CType(_rs._ResultContent._partnerNat.__saldiert, Boolean) = False Then dsPartner.Tables(0).Rows(0).Item("saldiert") = False End If End If 'If _rs._ResultContent._partnerNat.__saldiert <> "" Then 'dsPartner.Tables(0).Rows(0).Item("saldiert") = CType(_rs._ResultContent._partnerNat.__saldiert, Boolean) 'End If '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daPartner) daPartner.Update(dsPartner, "partner") daPartner.Dispose() dsPartner.Clear() m_log.Log("EDKB04: PartnerNat partner: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle partner: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle Partner ---- '---- Tabelle etparn --- Dim dsEtParN As New DataSet Dim daetparn As New SqlDataAdapter("select * from etparn where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daetparn.SelectCommand.CommandTimeout = Params.SqlTimeout Try daetparn.Fill(dsEtParN, "etparn") If dsEtParN.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtetparn As DataTable = dsEtParN.Tables(0) dbRow = dtetparn.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("BEBERAL") = _rs._ResultContent._partnerNat._beruf If _rs._ResultContent._partnerNat.__DMGEB00 <> "" And _rs._ResultContent._partnerNat.__DMGEB00 <> "00.00.0000" Then dbRow("DMGEB00") = _rs._ResultContent._partnerNat.__DMGEB00 End If dbRow("NRSEX00") = _rs._ResultContent._partnerNat._sex dbRow("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 '--NOT NULL dbRow("NRABE00") = 0 dbRow("NRVRN00") = 9999 dbRow("DMGEBJJ") = _rs._ResultContent._partnerNat.__DMGEBJJ dbRow("DMTODJJ") = 0 dbRow("BEGEB00") = "" dbRow("BEBGO00") = "" dbRow("NRZVS00") = 0 dbRow("NRGST00") = 0 dbRow("NRABD00") = 0 dbRow("NRBER01") = 0 dbRow("NRBER02") = 0 dbRow("NRERW00") = 99 dbRow("CDAHV00") = "" dbRow("NRBVG00") = 0 dbRow("CDIPA00") = "" 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") '-- dtetparn.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerNat._beruf <> "" Then dsEtParN.Tables(0).Rows(0).Item("BEBERAL") = _rs._ResultContent._partnerNat._beruf End If If _rs._ResultContent._partnerNat.__DMGEB00 <> "" And _rs._ResultContent._partnerNat.__DMGEB00 <> "00.00.0000" Then dsEtParN.Tables(0).Rows(0).Item("DMGEB00") = _rs._ResultContent._partnerNat.__DMGEB00 End If If _rs._ResultContent._partnerNat._sex <> "" Then dsEtParN.Tables(0).Rows(0).Item("NRSEX00") = _rs._ResultContent._partnerNat._sex End If If _rs._ResultContent._partnerNat.__SAREC00 <> "" Then dsEtParN.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 End If 'Timestamp dsEtParN.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter dsEtParN.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") sAction = " update" End If Dim cb As New SqlCommandBuilder(daetparn) daetparn.Update(dsEtParN, "etparn") daetparn.Dispose() dsEtParN.Clear() m_log.Log("EDKB04: PartnerNat etparn: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle etparn: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle etparn ---- '---- Tabelle etpar0 --- Dim dsEtPar0 As New DataSet Dim daEtPar0 As New SqlDataAdapter("select * from edoka_EtPar0 where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daEtPar0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daEtPar0.Fill(dsEtPar0, "edoka_EtPar0") If dsEtPar0.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtEtPar0 As DataTable = dsEtPar0.Tables(0) dbRow = dtEtPar0.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("NRBEU01") = _rs._ResultContent._partnerNat._betreuerId dbRow("NRDOM00") = _rs._ResultContent._partnerNat._domizilCode dbRow("NRNAT01") = _rs._ResultContent._partnerNat.__NRNAT01 dbRow("CDPAW00") = _rs._ResultContent._partnerNat._partnerAbwicklungsformCode dbRow("NRSPA00") = _rs._ResultContent._partnerNat._sprache dbRow("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 '--NOT NULL dbRow("BKPAR00") = "" dbRow("NRVRN00") = 9999 dbRow("DMPAREO") = CStr(Now()) dbRow("NRERF00") = 1 dbRow("NRAFG00") = 0 dbRow("NRRST00") = 1 dbRow("NRGSR00") = 1 dbRow("NRBON00") = 0 dbRow("NRBBG00") = 0 dbRow("CDDOMKT") = "" dbRow("NRDOMRI") = 0 dbRow("NRDOMGE") = 0 dbRow("NRNAT02") = 0 dbRow("SAWBG00") = "" 'ACHTUNG dbRow("NRBEE00") = 0 'ACHTUNG dbRow("SAINT00") = "" 'Rel. 4.1 - Verlängerung auf 255 dbRow("BKPARSQ") = "" & Microsoft.VisualBasic.Left(_rs._ResultContent._partnerNat._kurzname, 255) dbRow("CDPARSQ") = "" & Microsoft.VisualBasic.Left(UCase(_rs._ResultContent._partnerNat._kurzname), 255) 'dbRow("BKPARSQ") = "" & Microsoft.VisualBasic.Left(_rs._ResultContent._partnerNat._kurzname, 35) 'dbRow("CDPARSQ") = "" & Microsoft.VisualBasic.Left(UCase(_rs._ResultContent._partnerNat._kurzname), 35) dbRow("SAKTRNA") = 5 'ACHTUNG 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtEtPar0.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerNat._betreuerId <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRBEU01") = _rs._ResultContent._partnerNat._betreuerId End If If _rs._ResultContent._partnerNat._domizilCode <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRDOM00") = _rs._ResultContent._partnerNat._domizilCode End If If _rs._ResultContent._partnerNat._nationalitaet <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRNAT01") = _rs._ResultContent._partnerNat.__NRNAT01 End If If _rs._ResultContent._partnerNat._partnerAbwicklungsformCode <> "" Then dsEtPar0.Tables(0).Rows(0).Item("CDPAW00") = _rs._ResultContent._partnerNat._partnerAbwicklungsformCode End If If _rs._ResultContent._partnerNat._sprache <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRSPA00") = _rs._ResultContent._partnerNat._sprache End If If _rs._ResultContent._partnerNat.__SAREC00 <> "" Then dsEtPar0.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 End If 'Timestamp dsEtPar0.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsEtPar0.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daEtPar0) daEtPar0.Update(dsEtPar0, "edoka_EtPar0") daEtPar0.Dispose() dsEtPar0.Clear() m_log.Log("EDKB04: PartnerNat EtPar0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle EtPar0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle etpar0 ---- '---- Tabelle partner_Hauptadresse --- Dim dsPartner_Hauptadresse As New DataSet Dim dapartner_Hauptadresse As New SqlDataAdapter("select * from partner_Hauptadresse where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) dapartner_Hauptadresse.SelectCommand.CommandTimeout = Params.SqlTimeout Try dapartner_Hauptadresse.Fill(dsPartner_Hauptadresse, "partner_Hauptadresse") If dsPartner_Hauptadresse.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtpartner_Hauptadresse As DataTable = dsPartner_Hauptadresse.Tables(0) dbRow = dtpartner_Hauptadresse.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("BENNMZ1") = _rs._ResultContent._partnerNat._name dbRow("BEVNM01") = _rs._ResultContent._partnerNat._vorname dbRow("CDPAW00") = _rs._ResultContent._partnerNat._partnerAbwicklungsformCode '--NOT NULL 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtpartner_Hauptadresse.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerNat._name <> "" Then dsPartner_Hauptadresse.Tables(0).Rows(0).Item("BENNMZ1") = _rs._ResultContent._partnerNat._name End If If _rs._ResultContent._partnerNat._vorname <> "" Then dsPartner_Hauptadresse.Tables(0).Rows(0).Item("BEVNM01") = _rs._ResultContent._partnerNat._vorname End If If _rs._ResultContent._partnerNat._partnerAbwicklungsformCode <> "" Then dsPartner_Hauptadresse.Tables(0).Rows(0).Item("CDPAW00") = _rs._ResultContent._partnerNat._partnerAbwicklungsformCode End If 'Timestamp dsPartner_Hauptadresse.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsPartner_Hauptadresse.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(dapartner_Hauptadresse) dapartner_Hauptadresse.Update(dsPartner_Hauptadresse, "partner_Hauptadresse") dapartner_Hauptadresse.Dispose() dsPartner_Hauptadresse.Clear() m_log.Log("EDKB04: PartnerNat partner_Hauptadresse: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle partner_Hauptadresse: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle partner_Hauptadresse ---- '---- Tabelle edoka_etbez0 --- Dim dsedoka_etbez0 As New DataSet Dim daedoka_etbez0 As New SqlDataAdapter("select * from edoka_etbez0 where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daedoka_etbez0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daedoka_etbez0.Fill(dsedoka_etbez0, "edoka_etbez0") If dsedoka_etbez0.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtedoka_etbez0 As DataTable = dsedoka_etbez0.Tables(0) dbRow = dtedoka_etbez0.NewRow() dbRow("NRBEZ00") = hlp_GetNewKey_etbez0() dbRow("NRBEU01") = _rs._ResultContent._partnerNat._betreuerId '--NOT NULL dbRow("NRVRN00") = 9999 dbRow("NRBEO00") = 200 'CHECK dbRow("NRPAR00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtedoka_etbez0.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerNat._betreuerId <> "" Then dsedoka_etbez0.Tables(0).Rows(0).Item("NRBEU01") = _rs._ResultContent._partnerNat._betreuerId End If 'Timestamp dsedoka_etbez0.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsedoka_etbez0.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daedoka_etbez0) daedoka_etbez0.Update(dsedoka_etbez0, "edoka_etbez0") daedoka_etbez0.Dispose() dsedoka_etbez0.Clear() m_log.Log("EDKB04: PartnerNat edoka_etbez0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle edoka_etbez0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle edoka_etbez0 ---- '---- Tabelle etmia0_data --- Dim dsetmia0_data As New DataSet Dim daetmia0_data As SqlDataAdapter If _rs._ResultContent._partnerNat._AngestelltenArt <> "" Then daetmia0_data = New SqlDataAdapter("select * from edoka_etmia0_data where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daetmia0_data.SelectCommand.CommandTimeout = Params.SqlTimeout Try daetmia0_data.Fill(dsetmia0_data, "edoka_etmia0_data") If dsetmia0_data.Tables(0).Rows.Count < 1 Then 'Eintrag machen Dim dtetmia0_data As DataTable = dsetmia0_data.Tables(0) dbRow = dtetmia0_data.NewRow() dbRow("NRPAR00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("NRVRN00") = 9999 dbRow("CDIDF00") = "EDKB04" dbRow("NRSPA00") = 1 dbRow("BKMIA00") = "EDKB04" dbRow("NRBTI00") = 0 dbRow("NRTEL00") = "" dbRow("NRTFX00") = "" dbRow("SABEU00") = "N" dbRow("BEEML00") = "" dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dbRow("SAREC00") = "2" 'KEIN TIMESTAMP VORHANDEN dtetmia0_data.Rows.Add(dbRow) Dim cb As New SqlCommandBuilder(daetmia0_data) daetmia0_data.Update(dsetmia0_data, "edoka_etmia0_data") daetmia0_data.Dispose() dsetmia0_data.Clear() sAction = " insert" Else 'Eintragung aktivieren Dim scetmia0_data_2 As New SqlCommand Dim coetmia0_data_2 As New SqlConnection scetmia0_data_2.CommandText = "UPDATE edoka_etmia0_data SET sarec00 = 2 WHERE nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer scetmia0_data_2.CommandTimeout = Params.SqlTimeout coetmia0_data_2.ConnectionString = Globals.sConnectionString_edoka coetmia0_data_2.Open() scetmia0_data_2.Connection = coetmia0_data_2 scetmia0_data_2.ExecuteNonQuery() coetmia0_data_2.Close() scetmia0_data_2.Dispose() coetmia0_data_2.Dispose() sAction = " update" End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle edoka_etmia0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try m_log.Log("EDKB04: PartnerNat edoka_etmia0_data: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) '---- Tabelle etmia0_data --- '---- Tabelle etmia0 --- Dim dsetmia0 As New DataSet Dim daetmia0 As SqlDataAdapter daetmia0 = New SqlDataAdapter("select * from etmia0 where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daetmia0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daetmia0.Fill(dsetmia0, "etmia0") If dsetmia0.Tables(0).Rows.Count < 1 Then 'Eintrag machen Dim dtetmia0 As DataTable = dsetmia0.Tables(0) dbRow = dtetmia0.NewRow() dbRow("NRPAR00") = _rs._ResultContent._partnerNat._partnerNummer 'KEIN TIMESTAMP VORHANDEN dtetmia0.Rows.Add(dbRow) Dim cb As New SqlCommandBuilder(daetmia0) daetmia0.Update(dsetmia0, "etmia0") daetmia0.Dispose() dsetmia0.Clear() sAction = " insert" Else 'Alles OK Eintrag besteht sAction = " Überprüfung" End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle etmia0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try m_log.Log("EDKB04: PartnerNat etmia0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Else Try 'Eintragung löschen Dim scetmia0 As New SqlCommand Dim coetmia0 As New SqlConnection scetmia0.CommandText = "DELETE FROM etmia0 WHERE nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer scetmia0.CommandTimeout = Params.SqlTimeout coetmia0.ConnectionString = Globals.sConnectionString_edoka coetmia0.Open() scetmia0.Connection = coetmia0 scetmia0.ExecuteNonQuery() coetmia0.Close() scetmia0.Dispose() coetmia0.Dispose() sAction = " delete" Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle etmia0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try m_log.Log("EDKB04: PartnerNat etmia0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Try 'Eintragung Inaktivieren Dim scetmia0_data As New SqlCommand Dim coetmia0_data As New SqlConnection scetmia0_data.CommandText = "UPDATE edoka_etmia0_data SET sarec00 = 7 WHERE nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer scetmia0_data.CommandTimeout = Params.SqlTimeout coetmia0_data.ConnectionString = Globals.sConnectionString_edoka coetmia0_data.Open() scetmia0_data.Connection = coetmia0_data scetmia0_data.ExecuteNonQuery() coetmia0_data.Close() scetmia0_data.Dispose() coetmia0_data.Dispose() sAction = " update" Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle edoka_etmia0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try m_log.Log("EDKB04: PartnerNat edoka_etmia0_data: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) End If '---- Tabelle etmia0 ---- '---- Tabelle edoka_etvip0 --- Dim dsedoka_etvip0 As New DataSet Dim daedoka_etvip0 As SqlDataAdapter If _rs._ResultContent._partnerNat._vipCode <> "" And UCase(_rs._ResultContent._partnerNat._vipCode) <> "N" Then daedoka_etvip0 = New SqlDataAdapter("select * from edoka_etvip0_data where nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer, Globals.sConnectionString_edoka) daedoka_etvip0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daedoka_etvip0.Fill(dsedoka_etvip0, "edoka_etvip0_data") If dsedoka_etvip0.Tables(0).Rows.Count < 1 Then 'Eintrag machen sAction = " insert" Dim dtedoka_etvip0 As DataTable = dsedoka_etvip0.Tables(0) dbRow = dtedoka_etvip0.NewRow() dbRow("NRPAR00") = _rs._ResultContent._partnerNat._partnerNummer dbRow("NRVRN00") = 9999 dbRow("NRVIP00") = 1 dbRow("SAREC00") = 2 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DSMUT00") = hlp_MutDatum("2") dtedoka_etvip0.Rows.Add(dbRow) Dim cb As New SqlCommandBuilder(daedoka_etvip0) daedoka_etvip0.Update(dsedoka_etvip0, "edoka_etvip0_data") daedoka_etvip0.Dispose() dsedoka_etvip0.Clear() Else 'Alles OK Eintrag besteht sAction = " Überprüfung" End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle edoka_etvip0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try Else Try 'Eintragung Inaktiv Dim scedoka_etvip0 As New SqlCommand Dim coedoka_etvip0 As New SqlConnection scedoka_etvip0.CommandText = "UPDATE edoka_etvip0_data SET SAREC00 = 7 WHERE nrpar00 = " & _rs._ResultContent._partnerNat._partnerNummer scedoka_etvip0.CommandTimeout = Params.SqlTimeout coedoka_etvip0.ConnectionString = Globals.sConnectionString_edoka coedoka_etvip0.Open() scedoka_etvip0.Connection = coedoka_etvip0 scedoka_etvip0.ExecuteNonQuery() coedoka_etvip0.Close() scedoka_etvip0.Dispose() coedoka_etvip0.Dispose() sAction = " inaktiv oder nicht vorhanden" Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerNat, Tabelle edoka_etvip0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try End If m_log.Log("EDKB04: PartnerNat edoka_etvip0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) '---- Tabelle edoka_etvip0 ---- End If Return result End Function Function partnerJur() As Boolean Dim result As Boolean = True Dim dbRow As DataRow Dim sAction As String = "" 'Prüfung Betreuer If _rs._ResultContent._partnerJur._betreuerId = "" Then _rs._ResultContent._partnerJur._betreuerId = hlp_GetBetreuerID_Substitute(_rs._ResultContent._partnerJur._partnerNummer) '---- Tabelle PARTNER --- Dim dsPartner As New DataSet Dim daPartner As New SqlDataAdapter("select * from partner where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) daPartner.SelectCommand.CommandTimeout = Params.SqlTimeout If hlp_Check_Saldierung(_rs._ResultContent._partnerJur._ablaufDatum, _rs._ResultContent._partnerJur.__SAREC00) = True Then 'Version 1.6 23.10.2008 - Ursprüngliche Prüfung mit hlp_check_saldierung abgelösut 'If hlp_Ablaufdatum_beruecksichtigen(_rs._ResultContent._partnerJur._ablaufDatum) Or _rs._ResultContent._partnerJur.__SAREC00 = "7" Then Try 'SALDIERUNG Dim scpartsald As New SqlCommand Dim copartsald As New SqlConnection scpartsald.CommandText = "dbo.sp_saldierter_partner" scpartsald.CommandTimeout = Params.SqlTimeout scpartsald.Parameters.Add(New SqlParameter("@nrpar00", SqlDbType.Int, 36, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, CInt(_rs._ResultContent._partnerJur._partnerNummer))) scpartsald.CommandType = CommandType.StoredProcedure copartsald.ConnectionString = Globals.sConnectionString_edoka copartsald.Open() scpartsald.Connection = copartsald scpartsald.ExecuteNonQuery() copartsald.Close() scpartsald.Dispose() copartsald.Dispose() sAction = " saldierung" m_log.Log("EDKB04: PartnerJur : " & _rs._ResultContent._partnerJur._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: PartnerJur saldierung error (sp_saldierter_partner): PNR=" & _rs._ResultContent._partnerJur._partnerNummer & ", Msg:" & Err.Description, Common.Common.JournalEntryType.Error) result = False End Try Else Try daPartner.Fill(dsPartner, "partner") If dsPartner.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtPartner As DataTable = dsPartner.Tables(0) dbRow = dtPartner.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerJur._partnerNummer If _rs._ResultContent._partnerJur._ablaufDatum <> "" Then dbRow("validto") = _rs._ResultContent._partnerJur._ablaufDatum End If dbRow("saldiert") = CType(_rs._ResultContent._partnerJur.__saldiert, Boolean) dbRow("CDVIG00") = _rs._ResultContent._partnerJur.__CDVIG00 '--NOT NULL dbRow("cdvsa00") = 0 'RGL20080708 dbRow("azepl00") = 1 'RGL20080708 dbRow("nrparad") = "00" & _rs._ResultContent._partnerJur._partnerNummer 'Neuerfassung, es kann eigene Nummer genommen werden 'Ist nötig sonst stürzt FrmInteressent ab dbRow("TXADZ012") = "" dbRow("TXADZ022") = "" dbRow("TXADZ032") = "" dbRow("TXADZ042") = "" dbRow("TXADZ052") = "" dbRow("TXADZ062") = "" dbRow("TXADZ072") = "" dbRow("TXADZ011") = "" dbRow("TXADZ021") = "" dbRow("TXADZ031") = "" dbRow("TXADZ041") = "" dbRow("TXADZ051") = "" dbRow("TXADZ061") = "" dbRow("TXADZ071") = "" '--TIMESTAMP dbRow("TSMUT00") = hlp_MutDatum("1") dbRow("VDMUTER") = Params.CDMuter dtPartner.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerJur._ablaufDatum <> "" Then dsPartner.Tables(0).Rows(0).Item("validto") = _rs._ResultContent._partnerJur._ablaufDatum End If If _rs._ResultContent._partnerJur._versandInstruktion <> "" Then dsPartner.Tables(0).Rows(0).Item("CDVIG00") = _rs._ResultContent._partnerJur.__CDVIG00 End If 'Version 1.6 23.10.2008 - Saldiert-Status nicht ändern If hlp_Check_Saldierung(_rs._ResultContent._partnerJur._ablaufDatum, _rs._ResultContent._partnerJur.__SAREC00) = False Then If dsPartner.Tables(0).Rows(0).Item("saldiert") = True And CType(_rs._ResultContent._partnerJur.__saldiert, Boolean) = False Then dsPartner.Tables(0).Rows(0).Item("saldiert") = False End If End If 'If _rs._ResultContent._partnerJur.__saldiert <> "" Then ' dsPartner.Tables(0).Rows(0).Item("saldiert") = CType(_rs._ResultContent._partnerJur.__saldiert, Boolean) 'End If '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daPartner) daPartner.Update(dsPartner, "partner") daPartner.Dispose() dsPartner.Clear() m_log.Log("EDKB04: PartnerJur partner: " & _rs._ResultContent._partnerJur._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle partner: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle Partner ---- '---- Tabelle etparu --- Dim dsEtparu As New DataSet Dim daEtparu As New SqlDataAdapter("select * from Etparu where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) daEtparu.SelectCommand.CommandTimeout = Params.SqlTimeout Try daEtparu.Fill(dsEtparu, "Etparu") If dsEtparu.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtEtparu As DataTable = dsEtparu.Tables(0) dbRow = dtEtparu.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerJur._partnerNummer If _rs._ResultContent._partnerJur.__DMGRD00 <> "" Then dbRow("DMGRD00") = _rs._ResultContent._partnerJur.__DMGRD00 End If If _rs._ResultContent._partnerJur.__DMGRDJJ <> "" Then dbRow("DMGRDJJ") = _rs._ResultContent._partnerJur.__DMGRDJJ End If If _rs._ResultContent._partnerJur._branche <> "" Then dbRow("CDNOG01") = _rs._ResultContent._partnerJur._branche End If dbRow("SAREC00") = _rs._ResultContent._partnerJur.__SAREC00 '--NOT NULL dbRow("NRVRN00") = "9999" dbRow("DMAFLJJ") = "0" 'Firmenlöschung Jahr dbRow("CDIPA00") = " " dbRow("CDSWI00") = " " dbRow("NRSIC00") = "0" 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtEtparu.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerJur.__DMGRD00 <> "" Then dsEtparu.Tables(0).Rows(0).Item("DMGRD00") = _rs._ResultContent._partnerJur.__DMGRD00 End If If _rs._ResultContent._partnerJur.__DMGRDJJ <> "" Then dsEtparu.Tables(0).Rows(0).Item("DMGRDJJ") = _rs._ResultContent._partnerJur.__DMGRDJJ End If If _rs._ResultContent._partnerJur.__SAREC00 <> "" Then dsEtparu.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._partnerJur.__SAREC00 End If If _rs._ResultContent._partnerJur._branche <> "" Then dsEtparu.Tables(0).Rows(0).Item("CDNOG01") = _rs._ResultContent._partnerJur._branche End If 'Timestamp dsEtparu.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsEtparu.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daEtparu) daEtparu.Update(dsEtparu, "Etparu") daEtparu.Dispose() dsEtparu.Clear() m_log.Log("EDKB04: PartnerJur Etparu: " & _rs._ResultContent._partnerJur._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle Etparu: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle etparu ---- '---- Tabelle etpar0 --- Dim dsEtPar0 As New DataSet Dim daEtPar0 As New SqlDataAdapter("select * from edoka_EtPar0 where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) daEtPar0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daEtPar0.Fill(dsEtPar0, "edoka_EtPar0") If dsEtPar0.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtEtPar0 As DataTable = dsEtPar0.Tables(0) dbRow = dtEtPar0.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerJur._partnerNummer dbRow("NRBEU01") = _rs._ResultContent._partnerJur._betreuerId dbRow("NRDOM00") = _rs._ResultContent._partnerJur._domizilCode dbRow("NRNAT01") = _rs._ResultContent._partnerJur.__NRNAT01 dbRow("CDPAW00") = _rs._ResultContent._partnerJur._partnerAbwicklungsformCode dbRow("NRSPA00") = _rs._ResultContent._partnerJur._sprache dbRow("SAREC00") = _rs._ResultContent._partnerJur.__SAREC00 '--NOT NULL dbRow("BKPAR00") = "" dbRow("NRVRN00") = 9999 dbRow("DMPAREO") = CStr(Now()) dbRow("NRERF00") = 1 dbRow("NRAFG00") = 0 dbRow("NRRST00") = 1 dbRow("NRGSR00") = 1 dbRow("NRBON00") = 0 dbRow("NRBBG00") = 0 dbRow("CDDOMKT") = "" dbRow("NRDOMRI") = 0 dbRow("NRDOMGE") = 0 dbRow("NRNAT02") = 0 dbRow("SAWBG00") = "" 'ACHTUNG dbRow("NRBEE00") = 0 'ACHTUNG dbRow("SAINT00") = "" 'Rel. 4.1 Verlängerung auf 255 dbRow("BKPARSQ") = "" & Microsoft.VisualBasic.Left(_rs._ResultContent._partnerNat._kurzname, 255) dbRow("CDPARSQ") = "" & Microsoft.VisualBasic.Left(UCase(_rs._ResultContent._partnerNat._kurzname), 255) 'dbRow("BKPARSQ") = "" & Microsoft.VisualBasic.Left(_rs._ResultContent._partnerNat._kurzname, 35) 'dbRow("CDPARSQ") = "" & Microsoft.VisualBasic.Left(UCase(_rs._ResultContent._partnerNat._kurzname), 35) dbRow("SAKTRNA") = 5 'ACHTUNG 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtEtPar0.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerJur._betreuerId <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRBEU01") = _rs._ResultContent._partnerJur._betreuerId End If If _rs._ResultContent._partnerJur._domizilCode <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRDOM00") = _rs._ResultContent._partnerJur._domizilCode End If If _rs._ResultContent._partnerJur.__NRNAT01 <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRNAT01") = _rs._ResultContent._partnerJur.__NRNAT01 End If If _rs._ResultContent._partnerJur._partnerAbwicklungsformCode <> "" Then dsEtPar0.Tables(0).Rows(0).Item("CDPAW00") = _rs._ResultContent._partnerJur._partnerAbwicklungsformCode End If If _rs._ResultContent._partnerJur._sprache <> "" Then dsEtPar0.Tables(0).Rows(0).Item("NRSPA00") = _rs._ResultContent._partnerJur._sprache End If If _rs._ResultContent._partnerJur.__SAREC00 <> "" Then dsEtPar0.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._partnerNat.__SAREC00 End If 'Timestamp dsEtPar0.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsEtPar0.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daEtPar0) daEtPar0.Update(dsEtPar0, "edoka_EtPar0") daEtPar0.Dispose() dsEtPar0.Clear() m_log.Log("EDKB04: PartnerJur EtPar0: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle EtPar0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle etpar0 ---- '---- Tabelle partner_Hauptadresse --- Dim dsPartner_Hauptadresse As New DataSet Dim dapartner_Hauptadresse As New SqlDataAdapter("select * from partner_Hauptadresse where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) dapartner_Hauptadresse.SelectCommand.CommandTimeout = Params.SqlTimeout Try dapartner_Hauptadresse.Fill(dsPartner_Hauptadresse, "partner_Hauptadresse") If dsPartner_Hauptadresse.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtpartner_Hauptadresse As DataTable = dsPartner_Hauptadresse.Tables(0) dbRow = dtpartner_Hauptadresse.NewRow() dbRow("nrpar00") = _rs._ResultContent._partnerJur._partnerNummer dbRow("BENNMZ1") = _rs._ResultContent._partnerJur._name dbRow("CDPAW00") = _rs._ResultContent._partnerJur._partnerAbwicklungsformCode '--NOT NULL 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtpartner_Hauptadresse.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerJur._name <> "" Then dsPartner_Hauptadresse.Tables(0).Rows(0).Item("BENNMZ1") = _rs._ResultContent._partnerJur._name End If If _rs._ResultContent._partnerJur._partnerAbwicklungsformCode <> "" Then dsPartner_Hauptadresse.Tables(0).Rows(0).Item("CDPAW00") = _rs._ResultContent._partnerJur._partnerAbwicklungsformCode End If 'Timestamp dsPartner_Hauptadresse.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsPartner_Hauptadresse.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(dapartner_Hauptadresse) dapartner_Hauptadresse.Update(dsPartner_Hauptadresse, "partner_Hauptadresse") dapartner_Hauptadresse.Dispose() dsPartner_Hauptadresse.Clear() m_log.Log("EDKB04: PartnerJur partner_Hauptadresse: " & _rs._ResultContent._partnerNat._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle partner_Hauptadresse: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle partner_Hauptadresse ---- '---- Tabelle edoka_etbez0 --- Dim dsedoka_etbez0 As New DataSet Dim daedoka_etbez0 As New SqlDataAdapter("select * from edoka_etbez0 where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) daedoka_etbez0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daedoka_etbez0.Fill(dsedoka_etbez0, "edoka_etbez0") If dsedoka_etbez0.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtedoka_etbez0 As DataTable = dsedoka_etbez0.Tables(0) dbRow = dtedoka_etbez0.NewRow() dbRow("NRBEZ00") = hlp_GetNewKey_etbez0() dbRow("NRBEU01") = _rs._ResultContent._partnerJur._betreuerId '--NOT NULL dbRow("NRVRN00") = 9999 dbRow("NRBEO00") = 200 'CHECK dbRow("NRPAR00") = _rs._ResultContent._partnerJur._partnerNummer dbRow("SAREC00") = _rs._ResultContent._partnerJur.__SAREC00 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DMERF00") = hlp_MutDatum("3") dtedoka_etbez0.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._partnerJur._betreuerId <> "" Then dsedoka_etbez0.Tables(0).Rows(0).Item("NRBEU01") = _rs._ResultContent._partnerJur._betreuerId End If 'Timestamp dsedoka_etbez0.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsedoka_etbez0.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daedoka_etbez0) daedoka_etbez0.Update(dsedoka_etbez0, "edoka_etbez0") daedoka_etbez0.Dispose() dsedoka_etbez0.Clear() m_log.Log("EDKB04: PartnerJUR edoka_etbez0: " & _rs._ResultContent._partnerJur._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJUR, Tabelle edoka_etbez0: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle edoka_etbez0 ---- '---- Tabelle edoka_etvip0 --- Dim dsedoka_etvip0 As New DataSet Dim daedoka_etvip0 As SqlDataAdapter If _rs._ResultContent._partnerJur._vipCode <> "" And UCase(_rs._ResultContent._partnerJur._vipCode) <> "N" Then daedoka_etvip0 = New SqlDataAdapter("select * from edoka_etvip0_data where nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer, Globals.sConnectionString_edoka) daedoka_etvip0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daedoka_etvip0.Fill(dsedoka_etvip0, "edoka_etvip0_data") If dsedoka_etvip0.Tables(0).Rows.Count < 1 Then 'Eintrag machen sAction = " insert" Dim dtedoka_etvip0 As DataTable = dsedoka_etvip0.Tables(0) dbRow = dtedoka_etvip0.NewRow() dbRow("NRPAR00") = _rs._ResultContent._partnerJur._partnerNummer dbRow("NRVRN00") = 9999 dbRow("NRVIP00") = 1 dbRow("SAREC00") = 2 'Timestamp dbRow("CDMUTER") = Params.CDMuter dbRow("TSMUT00") = hlp_MutDatum("2") dbRow("DSMUT00") = hlp_MutDatum("2") dtedoka_etvip0.Rows.Add(dbRow) Dim cb As New SqlCommandBuilder(daedoka_etvip0) daedoka_etvip0.Update(dsedoka_etvip0, "edoka_etvip0_data") daedoka_etvip0.Dispose() dsedoka_etvip0.Clear() Else 'Alles OK Eintrag besteht sAction = " Überprüfung" End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle edoka_etvip0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try Else Try 'Eintragung Inaktiv Dim scedoka_etvip0 As New SqlCommand Dim coedoka_etvip0 As New SqlConnection scedoka_etvip0.CommandText = "UPDATE edoka_etvip0_data SET SAREC00 = 7 WHERE nrpar00 = " & _rs._ResultContent._partnerJur._partnerNummer scedoka_etvip0.CommandTimeout = Params.SqlTimeout coedoka_etvip0.ConnectionString = Globals.sConnectionString_edoka coedoka_etvip0.Open() scedoka_etvip0.Connection = coedoka_etvip0 scedoka_etvip0.ExecuteNonQuery() coedoka_etvip0.Close() scedoka_etvip0.Dispose() coedoka_etvip0.Dispose() sAction = " inaktiv oder nicht vorhanden" Catch ex As Exception m_log.Log("EDKB04: DBHandling.partnerJur, Tabelle edoka_etvip0_data: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try End If m_log.Log("EDKB04: PartnerJur edoka_etvip0: " & _rs._ResultContent._partnerJur._partnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) '---- Tabelle edoka_etvip0 ---- End If Return result End Function Function partnerHauptadresse() As Boolean Dim result As Boolean = True Dim dsHauptadresse As New DataSet Dim dsPartner As New DataSet Dim dsedoka_etpar0 As New DataSet Dim dbRow As DataRow Dim sAction As String = "" '---- Tabelle HAUPTADRESSE --- Dim daHauptadresse As New SqlDataAdapter("select * from partner_Hauptadresse where nrpar00 = " & _rs._ResultContent._hauptAdresse.__nrpar00, Globals.sConnectionString_edoka) daHauptadresse.SelectCommand.CommandTimeout = Params.SqlTimeout Try daHauptadresse.Fill(dsHauptadresse, "partner_Hauptadresse") If dsHauptadresse.Tables(0).Rows.Count < 1 Then '------------INSERT m_log.Log("EDKB04: DBHandling.Hauptadresse , Partner " & _rs._ResultContent._hauptAdresse.__nrpar00 & " wurde noch nicht eröffnet", Common.Common.JournalEntryType.Error) Return True Exit Function Else '------------UPDATE 'CDPAW01 prüfen für Name / Firma Dim CDPAW00 As String = "" CDPAW00 = dsHauptadresse.Tables(0).Rows(0).Item("CDPAW00") Select Case CDPAW00 Case "U" 'Name zuschneiden und Abfüllen in BENAM If _rs._ResultContent._hauptAdresse._firma <> "" Then 'Firma -> BENAM 'Rel. 4.1 Verlängerung auf 255 Cutter(_rs._ResultContent._hauptAdresse._firma, 255, 255, 255, _rs._ResultContent._hauptAdresse._BENAM01, _rs._ResultContent._hauptAdresse._BENAM02, _rs._ResultContent._hauptAdresse._BENAM03) 'Cutter(_rs._ResultContent._hauptAdresse._firma, 35, 35, 35, _rs._ResultContent._hauptAdresse._BENAM01, _rs._ResultContent._hauptAdresse._BENAM02, _rs._ResultContent._hauptAdresse._BENAM03) dsHauptadresse.Tables(0).Rows(0).Item("BENAM01") = _rs._ResultContent._hauptAdresse._BENAM01 dsHauptadresse.Tables(0).Rows(0).Item("BENAM02") = _rs._ResultContent._hauptAdresse._BENAM02 dsHauptadresse.Tables(0).Rows(0).Item("BENAM03") = _rs._ResultContent._hauptAdresse._BENAM03 'Nachname -> BENNM Dim trash As String = "" 'Rel. 4.1 Verlängerung auf 255 Cutter(_rs._ResultContent._hauptAdresse._nachname, 255, 255, 0, _rs._ResultContent._hauptAdresse._BENNM01, _rs._ResultContent._hauptAdresse._BENNM02, trash) 'Cutter(_rs._ResultContent._hauptAdresse._nachname, 35, 35, 0, _rs._ResultContent._hauptAdresse._BENNM01, _rs._ResultContent._hauptAdresse._BENNM02, trash) dsHauptadresse.Tables(0).Rows(0).Item("BENNM01") = _rs._ResultContent._hauptAdresse._BENNM01 dsHauptadresse.Tables(0).Rows(0).Item("BENNM02") = _rs._ResultContent._hauptAdresse._BENNM02 '20080909 - C 'Anpassungen SHU ' Bei Mutationen werden allfällige - im Attribut BETRZNN entfernt dsHauptadresse.Tables(0).Rows(0).Item("BETRZNN") = "" Else 'Nachname -> BENAM 'Rel. 4.1 Verlängerung auf 255 Cutter(_rs._ResultContent._hauptAdresse._nachname, 255, 255, 255, _rs._ResultContent._hauptAdresse._BENAM01, _rs._ResultContent._hauptAdresse._BENAM02, _rs._ResultContent._hauptAdresse._BENAM03) 'Cutter(_rs._ResultContent._hauptAdresse._nachname, 35, 35, 35, _rs._ResultContent._hauptAdresse._BENAM01, _rs._ResultContent._hauptAdresse._BENAM02, _rs._ResultContent._hauptAdresse._BENAM03) dsHauptadresse.Tables(0).Rows(0).Item("BENAM01") = _rs._ResultContent._hauptAdresse._BENAM01 dsHauptadresse.Tables(0).Rows(0).Item("BENAM02") = _rs._ResultContent._hauptAdresse._BENAM02 dsHauptadresse.Tables(0).Rows(0).Item("BENAM03") = _rs._ResultContent._hauptAdresse._BENAM03 End If 'Länge nötig weil vorher nicht abgeschnitten werden konnte (falls noch weiter gebraucht) 'Rel. 4.1 Verlängerung auf 255 _rs._ResultContent._hauptAdresse._nachname = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._nachname, 255) _rs._ResultContent._hauptAdresse._firma = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._firma, 255) '_rs._ResultContent._hauptAdresse._nachname = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._nachname, 35) '_rs._ResultContent._hauptAdresse._firma = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._firma, 35) Case "N" 'Name abfüllen in BENNM01 dsHauptadresse.Tables(0).Rows(0).Item("BENAM01") = "" dsHauptadresse.Tables(0).Rows(0).Item("BENAM02") = "" dsHauptadresse.Tables(0).Rows(0).Item("BENAM03") = "" Dim trash As String = "" 'Rel. 4.1 Verlängerung auf 255 Cutter(_rs._ResultContent._hauptAdresse._nachname, 255, 255, 0, _rs._ResultContent._hauptAdresse._BENNM01, _rs._ResultContent._hauptAdresse._BENNM02, trash) 'Cutter(_rs._ResultContent._hauptAdresse._nachname, 35, 35, 0, _rs._ResultContent._hauptAdresse._BENNM01, _rs._ResultContent._hauptAdresse._BENNM02, trash) dsHauptadresse.Tables(0).Rows(0).Item("BENNM01") = _rs._ResultContent._hauptAdresse._BENNM01 dsHauptadresse.Tables(0).Rows(0).Item("BENNM02") = _rs._ResultContent._hauptAdresse._BENNM02 '20080909 - D 'Anpassungen SHU ' Bei Mutationen werden allfällige - im Attribut BETRZNN entfernt dsHauptadresse.Tables(0).Rows(0).Item("BETRZNN") = "" Case Else '"K" 'Rel. 4.1 Verlängerung auf 255 _rs._ResultContent._hauptAdresse._nachname = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._nachname, 255) '_rs._ResultContent._hauptAdresse._nachname = Microsoft.VisualBasic.Left(_rs._ResultContent._hauptAdresse._nachname, 35) dsHauptadresse.Tables(0).Rows(0).Item("BENAM01") = _rs._ResultContent._hauptAdresse._nachname End Select If _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 <> "" Then dsHauptadresse.Tables(0).Rows(0).Item("BEBAN01") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 Else 'Hilfsfunktion gem. SHU dsHauptadresse.Tables(0).Rows(0).Item("BEBAN01") = hlp_GetDefaultAnrede(_rs._ResultContent._hauptAdresse.__nrpar00) End If '----- Auch leere updaten dsHauptadresse.Tables(0).Rows(0).Item("BENNMZ1") = _rs._ResultContent._hauptAdresse._namenZusatz 'Version 1.6 / 23.10.2008 - Briefanrede Zeile1 auf Zeile2 wechseln dsHauptadresse.Tables(0).Rows(0).Item("BEBAN02") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile2 ' dsHauptadresse.Tables(0).Rows(0).Item("BEBAN02") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 dsHauptadresse.Tables(0).Rows(0).Item("NRHAU00") = _rs._ResultContent._hauptAdresse._hausNr dsHauptadresse.Tables(0).Rows(0).Item("BEORTPT") = _rs._ResultContent._hauptAdresse._ort dsHauptadresse.Tables(0).Rows(0).Item("BEORTZS") = _rs._ResultContent._hauptAdresse._ortZusatz dsHauptadresse.Tables(0).Rows(0).Item("CDPLZ00") = _rs._ResultContent._hauptAdresse._plz dsHauptadresse.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._hauptAdresse.__SAREC00 dsHauptadresse.Tables(0).Rows(0).Item("BESTR00") = _rs._ResultContent._hauptAdresse._strasse dsHauptadresse.Tables(0).Rows(0).Item("BEVNM01") = _rs._ResultContent._hauptAdresse._vorname1 dsHauptadresse.Tables(0).Rows(0).Item("BEVNM02") = _rs._ResultContent._hauptAdresse._vorname2 dsHauptadresse.Tables(0).Rows(0).Item("BEVNM03") = _rs._ResultContent._hauptAdresse._vorname3 dsHauptadresse.Tables(0).Rows(0).Item("BEVNM04") = _rs._ResultContent._hauptAdresse._vorname4 dsHauptadresse.Tables(0).Rows(0).Item("BEWEI00") = _rs._ResultContent._hauptAdresse._weiler '---- integer If _rs._ResultContent._hauptAdresse._briefanrede1Code <> "" Then dsHauptadresse.Tables(0).Rows(0).Item("NRFOG01") = _rs._ResultContent._hauptAdresse._briefanrede1Code Else dsHauptadresse.Tables(0).Rows(0).Item("NRFOG01") = System.DBNull.Value End If If _rs._ResultContent._hauptAdresse._titelVorgestellt <> "" Then dsHauptadresse.Tables(0).Rows(0).Item("NRTTV00") = _rs._ResultContent._hauptAdresse._titelVorgestellt Else dsHauptadresse.Tables(0).Rows(0).Item("NRTTV00") = System.DBNull.Value End If If _rs._ResultContent._hauptAdresse._titelVorgestellt <> "" Then dsHauptadresse.Tables(0).Rows(0).Item("NRTTZ00") = _rs._ResultContent._hauptAdresse._titelZwischengestellt Else dsHauptadresse.Tables(0).Rows(0).Item("NRTTZ00") = System.DBNull.Value End If dsHauptadresse.Tables(0).Rows(0).Item("NRLND00") = _rs._ResultContent._hauptAdresse._laenderCode 'Timestamp dsHauptadresse.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsHauptadresse.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" Dim cb As New SqlCommandBuilder(daHauptadresse) daHauptadresse.Update(dsHauptadresse, "partner_HAUPTADRESSE") daHauptadresse.Dispose() dsHauptadresse.Clear() m_log.Log("EDKB04: Hauptadresse Hauptadresse : " & _rs._ResultContent._hauptAdresse.__nrpar00 & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.Hauptadresse , Tabelle Hauptadresse : " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle HAUPTADRESSE ---- '---- Tabelle Partner --- Dim daPartner As New SqlDataAdapter("select * from partner where nrpar00 = " & _rs._ResultContent._hauptAdresse.__nrpar00, Globals.sConnectionString_edoka) daPartner.SelectCommand.CommandTimeout = Params.SqlTimeout Try daPartner.Fill(dsPartner, "partner") If dsPartner.Tables(0).Rows.Count = 1 Then 'Fallunterscheidung gem. Logik TKB 07.07.2008 Dim Fall As String = "" Dim done As Boolean = False Dim links As String = "" Dim rechts As String = "" Try links = dsPartner.Tables(0).Rows(0).Item("TXADZ012") Catch ex As Exception End Try Try rechts = dsPartner.Tables(0).Rows(0).Item("TXADZ011") Catch ex As Exception End Try If links = "" And rechts = "" Then Fall = "1" done = True End If Dim isVorherig As Boolean = isVorherigVI(_rs._ResultContent._hauptAdresse.__nrpar00) If Not (done) And links = "" And rechts <> "" And isVorherig Then Fall = "2" done = True End If If Not (done) And links <> "" And rechts <> "" And Not (isVorherig) Then Fall = "3" done = True End If If Not (done) And links <> "" And rechts <> "" And isVorherig Then Fall = "4" done = True End If If Not (done) And links = "" And rechts <> "" And Not (isVorherig) Then Fall = "5" done = True End If done = False 'wird nochmals verwendet If Not (done) And (Fall = "1" Or Fall = "5") Then 'Rechts abfüllen done = True dsPartner.Tables(0).Rows(0).Item("BKPAR00") = Left(hlp_GetKurzname(), 255) If _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 <> "" Then dsPartner.Tables(0).Rows(0).Item("BEBAN011") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 Else 'Hilfsfunktion gem. SHU dsPartner.Tables(0).Rows(0).Item("BEBAN011") = hlp_GetDefaultAnrede(_rs._ResultContent._hauptAdresse.__nrpar00) End If dsPartner.Tables(0).Rows(0).Item("BEBAN21") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._hauptAdresse._zeile_1 dsPartner.Tables(0).Rows(0).Item("TXADZ021") = _rs._ResultContent._hauptAdresse._zeile_2 dsPartner.Tables(0).Rows(0).Item("TXADZ031") = _rs._ResultContent._hauptAdresse._zeile_3 dsPartner.Tables(0).Rows(0).Item("TXADZ041") = _rs._ResultContent._hauptAdresse._zeile_4 dsPartner.Tables(0).Rows(0).Item("TXADZ051") = _rs._ResultContent._hauptAdresse._zeile_5 dsPartner.Tables(0).Rows(0).Item("TXADZ061") = _rs._ResultContent._hauptAdresse._zeile_6 dsPartner.Tables(0).Rows(0).Item("TXADZ071") = _rs._ResultContent._hauptAdresse._zeile_7 dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._hauptAdresse._versandfaehig dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._hauptAdresse._kopien dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._hauptAdresse._banklagernd '--NOT NULL '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " rechts abfüllen" End If If Not (done) And (Fall = "2" Or Fall = "4") Then 'Links abfüllen done = True dsPartner.Tables(0).Rows(0).Item("BKPAR00") = Left(hlp_GetKurzname(), 255) If _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 <> "" Then dsPartner.Tables(0).Rows(0).Item("BEBAN012") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 Else 'Hilfsfunktion gem. SHU dsPartner.Tables(0).Rows(0).Item("BEBAN012") = hlp_GetDefaultAnrede(_rs._ResultContent._hauptAdresse.__nrpar00) End If dsPartner.Tables(0).Rows(0).Item("BEBAN022") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ012") = _rs._ResultContent._hauptAdresse._zeile_1 dsPartner.Tables(0).Rows(0).Item("TXADZ022") = _rs._ResultContent._hauptAdresse._zeile_2 dsPartner.Tables(0).Rows(0).Item("TXADZ032") = _rs._ResultContent._hauptAdresse._zeile_3 dsPartner.Tables(0).Rows(0).Item("TXADZ042") = _rs._ResultContent._hauptAdresse._zeile_4 dsPartner.Tables(0).Rows(0).Item("TXADZ052") = _rs._ResultContent._hauptAdresse._zeile_5 dsPartner.Tables(0).Rows(0).Item("TXADZ062") = _rs._ResultContent._hauptAdresse._zeile_6 dsPartner.Tables(0).Rows(0).Item("TXADZ072") = _rs._ResultContent._hauptAdresse._zeile_7 dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._hauptAdresse._versandfaehig dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._hauptAdresse._kopien dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._hauptAdresse._banklagernd '--NOT NULL '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " links abfüllen" End If If Not (done) And (Fall = "3") Then done = True 'Rechts abfüllen, Links löschen dsPartner.Tables(0).Rows(0).Item("BKPAR00") = Left(hlp_GetKurzname(), 255) If _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 <> "" Then dsPartner.Tables(0).Rows(0).Item("BEBAN011") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile1 Else 'Hilfsfunktion gem. SHU dsPartner.Tables(0).Rows(0).Item("BEBAN011") = hlp_GetDefaultAnrede(_rs._ResultContent._hauptAdresse.__nrpar00) End If dsPartner.Tables(0).Rows(0).Item("BEBAN21") = _rs._ResultContent._hauptAdresse._briefanrede2Zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._hauptAdresse._zeile_1 dsPartner.Tables(0).Rows(0).Item("TXADZ021") = _rs._ResultContent._hauptAdresse._zeile_2 dsPartner.Tables(0).Rows(0).Item("TXADZ031") = _rs._ResultContent._hauptAdresse._zeile_3 dsPartner.Tables(0).Rows(0).Item("TXADZ041") = _rs._ResultContent._hauptAdresse._zeile_4 dsPartner.Tables(0).Rows(0).Item("TXADZ051") = _rs._ResultContent._hauptAdresse._zeile_5 dsPartner.Tables(0).Rows(0).Item("TXADZ061") = _rs._ResultContent._hauptAdresse._zeile_6 dsPartner.Tables(0).Rows(0).Item("TXADZ071") = _rs._ResultContent._hauptAdresse._zeile_7 dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._hauptAdresse._versandfaehig dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._hauptAdresse._kopien dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._hauptAdresse._banklagernd '--NOT NULL 'löschen dsPartner.Tables(0).Rows(0).Item("BEBAN012") = "" dsPartner.Tables(0).Rows(0).Item("BEBAN022") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ012") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ022") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ032") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ042") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ052") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ062") = "" dsPartner.Tables(0).Rows(0).Item("TXADZ072") = "" 'Div. zusätzliche Anpassungen wegen VI löschen dsPartner.Tables(0).Rows(0).Item("NRPARAD") = "00" & _rs._ResultContent._hauptAdresse.__nrpar00 '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " rechts abfüllen, links löschen" End If Dim cb As New SqlCommandBuilder(daPartner) daPartner.Update(dsPartner, "partner") daPartner.Dispose() dsPartner.Clear() m_log.Log("EDKB04: Hauptadresse Partner : " & _rs._ResultContent._hauptAdresse.__nrpar00 & sAction & " erfolgreich (Fall " & Fall & ")", Common.Common.JournalEntryType.Information) Else m_log.Log("EDKB04: Hauptadresse Partner : Adresse Nr " & _rs._ResultContent._hauptAdresse.__nrpar00 & " nicht gefunden", Common.Common.JournalEntryType.Error) End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.Hauptadresse , Tabelle Partner : " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle Partner ---- '---- Tabelle edoka_etpar0 --- Dim daedoka_etpar0 As New SqlDataAdapter("select * from edoka_etpar0 where nrpar00 = " & _rs._ResultContent._hauptAdresse.__nrpar00, Globals.sConnectionString_edoka) daedoka_etpar0.SelectCommand.CommandTimeout = Params.SqlTimeout Try daedoka_etpar0.Fill(dsedoka_etpar0, "edoka_etpar0") If dsedoka_etpar0.Tables(0).Rows.Count < 1 Then 'Error die Tabelle sollte hier sein!! sAction = " insert" 'Throw New Exception Else '------------UPDATE dsedoka_etpar0.Tables(0).Rows(0).Item("BKPAR00") = Left(hlp_GetKurzname(), 255) 'Timestamp dsedoka_etpar0.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("2") dsedoka_etpar0.Tables(0).Rows(0).Item("CDMUTER") = Params.CDMuter sAction = " update" Dim cb As New SqlCommandBuilder(daedoka_etpar0) daedoka_etpar0.Update(dsedoka_etpar0, "edoka_etpar0") daedoka_etpar0.Dispose() dsedoka_etpar0.Clear() m_log.Log("EDKB04: Hauptadresse edoka_etpar0 : " & _rs._ResultContent._hauptAdresse.__nrpar00 & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.Hauptadresse , Tabelle edoka_etpar0 : " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle edoka_etpar0 ---- '---- Tabelle AVQ_PnrMapping --- If _rs._ResultContent._hauptAdresse._objektNr <> "" Then Dim dsAVQ_PnrMapping As New DataSet Dim sqlstring As String = "" sqlstring = "SELECT * FROM AVQ_PnrMapping WHERE adressid = '" & _rs._ResultContent._hauptAdresse._objektNr & "'" Dim daAVQ_Pnr_Mapping As New SqlDataAdapter(sqlstring, Globals.sConnectionString_edoka) daAVQ_Pnr_Mapping.SelectCommand.CommandTimeout = Params.SqlTimeout Try daAVQ_Pnr_Mapping.Fill(dsAVQ_PnrMapping, "AVQ_PnrMapping") If dsAVQ_PnrMapping.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtAVQ_Pnr_Mapping As DataTable = dsAVQ_PnrMapping.Tables(0) dbRow = dtAVQ_Pnr_Mapping.NewRow() dbRow("NRPAR00") = _rs._ResultContent._hauptAdresse.__nrpar00 dbRow("adressid") = _rs._ResultContent._hauptAdresse._objektNr '--NOT NULL 'KEIN TIMESTAMP VORHANDEN dtAVQ_Pnr_Mapping.Rows.Add(dbRow) sAction = " insert" Else '------------Check ob gleicher Partner If dsAVQ_PnrMapping.Tables(0).Rows(0).Item("nrpar00") = _rs._ResultContent._hauptAdresse.__nrpar00 Then 'OK, nichts machen Else 'Doppelten Eintrag machen und Benachrichtiung ins Journal Dim dtAVQ_Pnr_Mapping As DataTable = dsAVQ_PnrMapping.Tables(0) dbRow = dtAVQ_Pnr_Mapping.NewRow() dbRow("NRPAR00") = _rs._ResultContent._hauptAdresse.__nrpar00 dbRow("adressid") = _rs._ResultContent._hauptAdresse._objektNr '--NOT NULL 'KEIN TIMESTAMP VORHANDEN dtAVQ_Pnr_Mapping.Rows.Add(dbRow) sAction = " insert" m_log.Log("EDKB04: Hauptadresse AVQ_PnrMapping, Doppelte AdressID bei Partnern : " & _rs._ResultContent._hauptAdresse.__nrpar00 & " und " & dsAVQ_PnrMapping.Tables(0).Rows(0).Item("nrpar00") & " / AdressID : " & _rs._ResultContent._hauptAdresse._objektNr, Common.Common.JournalEntryType.Warning) End If End If Dim cb As New SqlCommandBuilder(daAVQ_Pnr_Mapping) daAVQ_Pnr_Mapping.Update(dsAVQ_PnrMapping, "AVQ_PnrMapping") daAVQ_Pnr_Mapping.Dispose() dsAVQ_PnrMapping.Clear() m_log.Log("EDKB04: Hauptadresse AVQ_PnrMapping: " & _rs._ResultContent._hauptAdresse.__nrpar00 & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.Hauptadresse, Tabelle AVQ_PnrMapping: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try Else m_log.Log("EDKB04: Hauptadresse : " & _rs._ResultContent._hauptAdresse.__nrpar00 & " wurde ohne Mapping Key geliefert", Common.Common.JournalEntryType.Warning) End If '---- Tabelle AVQ_PnrMapping ---- Return result End Function Function partnerVersandadresse() As Boolean Dim result As Boolean = True Dim sAction As String = "" '---- Tabelle PARTNER --- Dim dsPartner As New DataSet Dim daPartner As New SqlDataAdapter("select * from partner where nrpar00 = " & _rs._ResultContent._versandAdresse._objektRefNr, Globals.sConnectionString_edoka) daPartner.SelectCommand.CommandTimeout = Params.SqlTimeout Try daPartner.Fill(dsPartner, "partner") If dsPartner.Tables(0).Rows.Count < 1 Then '------------INSERT 'Kann nicht vorkommen, eine Versandadresse macht nur bei einem bestehenden Partner Sinn! m_log.Log("EDKB04: VersandAdresse partner: Fehler, Partner: " & _rs._ResultContent._versandAdresse._objektRefNr & " - übergeordneter Partner existiert nicht", Common.Common.JournalEntryType.Error) result = False Else 'Logik gem. TKB 7.7.08 Dim done As Boolean = False If dsPartner.Tables(0).Rows(0).Item("TXADZ012") = "" And dsPartner.Tables(0).Rows(0).Item("TXADZ011") <> "" Then 'Fall 1 --> HA nach links kopieren und VI rechts abfüllen done = True 'HA nach links kopieren Dim tmp_TXADZ011 As String = "" Dim tmp_TXADZ021 As String = "" Dim tmp_TXADZ031 As String = "" Dim tmp_TXADZ041 As String = "" Dim tmp_TXADZ051 As String = "" Dim tmp_TXADZ061 As String = "" Dim tmp_TXADZ071 As String = "" Dim tmp_BEBAN011 As String = "" Dim tmp_BEBAN21 As String = "" Try tmp_TXADZ011 = dsPartner.Tables(0).Rows(0).Item("TXADZ011") Catch ex As Exception tmp_TXADZ011 = "" End Try Try tmp_TXADZ021 = dsPartner.Tables(0).Rows(0).Item("TXADZ021") Catch ex As Exception tmp_TXADZ021 = "" End Try Try tmp_TXADZ031 = dsPartner.Tables(0).Rows(0).Item("TXADZ031") Catch ex As Exception tmp_TXADZ031 = "" End Try Try tmp_TXADZ041 = dsPartner.Tables(0).Rows(0).Item("TXADZ041") Catch ex As Exception tmp_TXADZ041 = "" End Try Try tmp_TXADZ051 = dsPartner.Tables(0).Rows(0).Item("TXADZ051") Catch ex As Exception tmp_TXADZ051 = "" End Try Try tmp_TXADZ061 = dsPartner.Tables(0).Rows(0).Item("TXADZ061") Catch ex As Exception tmp_TXADZ061 = "" End Try Try tmp_TXADZ071 = dsPartner.Tables(0).Rows(0).Item("TXADZ071") Catch ex As Exception tmp_TXADZ071 = "" End Try Try tmp_BEBAN011 = dsPartner.Tables(0).Rows(0).Item("BEBAN011") Catch ex As Exception tmp_BEBAN011 = "" End Try Try tmp_BEBAN21 = dsPartner.Tables(0).Rows(0).Item("BEBAN21") Catch ex As Exception tmp_BEBAN21 = "" End Try dsPartner.Tables(0).Rows(0).Item("TXADZ012") = tmp_TXADZ011 dsPartner.Tables(0).Rows(0).Item("TXADZ022") = tmp_TXADZ021 dsPartner.Tables(0).Rows(0).Item("TXADZ032") = tmp_TXADZ031 dsPartner.Tables(0).Rows(0).Item("TXADZ042") = tmp_TXADZ041 dsPartner.Tables(0).Rows(0).Item("TXADZ052") = tmp_TXADZ051 dsPartner.Tables(0).Rows(0).Item("TXADZ062") = tmp_TXADZ061 dsPartner.Tables(0).Rows(0).Item("TXADZ072") = tmp_TXADZ071 dsPartner.Tables(0).Rows(0).Item("BEBAN012") = tmp_BEBAN011 dsPartner.Tables(0).Rows(0).Item("BEBAN022") = tmp_BEBAN21 'ENDE HA nach links kopieren 'VI rechts abfüllen dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._versandAdresse._zeile1 dsPartner.Tables(0).Rows(0).Item("TXADZ021") = _rs._ResultContent._versandAdresse._zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ031") = _rs._ResultContent._versandAdresse._zeile3 dsPartner.Tables(0).Rows(0).Item("TXADZ041") = _rs._ResultContent._versandAdresse._zeile4 dsPartner.Tables(0).Rows(0).Item("TXADZ051") = _rs._ResultContent._versandAdresse._zeile5 dsPartner.Tables(0).Rows(0).Item("TXADZ061") = _rs._ResultContent._versandAdresse._zeile6 dsPartner.Tables(0).Rows(0).Item("TXADZ071") = _rs._ResultContent._versandAdresse._zeile7 'Restliche Daten If _rs._ResultContent._versandAdresse.__NRPARAD <> "" Then dsPartner.Tables(0).Rows(0).Item("NRPARAD") = "00" & _rs._ResultContent._versandAdresse.__NRPARAD End If If _rs._ResultContent._versandAdresse._banklagernd <> "" Then dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._versandAdresse._banklagernd End If If _rs._ResultContent._versandAdresse._banklagernd = "Y" And _rs._ResultContent._versandAdresse.__NRADR00 <> "" Then dsPartner.Tables(0).Rows(0).Item("NRADR00") = _rs._ResultContent._versandAdresse.__NRADR00 End If If _rs._ResultContent._versandAdresse._kopien <> "" Then dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._versandAdresse._kopien End If '20080909 - E 'Saldierung bei einer Adresse nicht berücksichtigen 'If _rs._ResultContent._versandAdresse.__saldiert <> "" Then ' dsPartner.Tables(0).Rows(0).Item("saldiert") = CType(_rs._ResultContent._versandAdresse.__saldiert, Boolean) 'End If If _rs._ResultContent._versandAdresse.__SAVRS00 <> "" Then dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._versandAdresse.__SAVRS00 End If 'Anrede in VA abfüllen dsPartner.Tables(0).Rows(0).Item("BEBAN011") = _rs._ResultContent._versandAdresse._briefanrede2Zeile1 dsPartner.Tables(0).Rows(0).Item("BEBAN21") = _rs._ResultContent._versandAdresse._briefanrede2Zeile2 'ENDE VI rechts abfüllen '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update (neue VI, Fall 1)" End If If Not (done) And dsPartner.Tables(0).Rows(0).Item("TXADZ012") = "" And dsPartner.Tables(0).Rows(0).Item("TXADZ011") = "" Then 'Fall 2 --> VI rechts abfüllen done = True 'VI rechts abfüllen If _rs._ResultContent._versandAdresse.__NRPARAD <> "" Then dsPartner.Tables(0).Rows(0).Item("NRPARAD") = "00" & _rs._ResultContent._versandAdresse.__NRPARAD End If If _rs._ResultContent._versandAdresse._banklagernd <> "" Then dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._versandAdresse._banklagernd End If If _rs._ResultContent._versandAdresse._banklagernd = "Y" And _rs._ResultContent._versandAdresse.__NRADR00 <> "" Then dsPartner.Tables(0).Rows(0).Item("NRADR00") = _rs._ResultContent._versandAdresse.__NRADR00 End If If _rs._ResultContent._versandAdresse._kopien <> "" Then dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._versandAdresse._kopien End If '20080909 - E 'Saldierung bei einer Adresse nicht berücksichtigen 'If _rs._ResultContent._versandAdresse.__saldiert <> "" Then ' dsPartner.Tables(0).Rows(0).Item("saldiert") = CType(_rs._ResultContent._versandAdresse.__saldiert, Boolean) 'End If If _rs._ResultContent._versandAdresse.__SAVRS00 <> "" Then dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._versandAdresse.__SAVRS00 End If dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._versandAdresse._zeile1 dsPartner.Tables(0).Rows(0).Item("TXADZ021") = _rs._ResultContent._versandAdresse._zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ031") = _rs._ResultContent._versandAdresse._zeile3 dsPartner.Tables(0).Rows(0).Item("TXADZ041") = _rs._ResultContent._versandAdresse._zeile4 dsPartner.Tables(0).Rows(0).Item("TXADZ051") = _rs._ResultContent._versandAdresse._zeile5 dsPartner.Tables(0).Rows(0).Item("TXADZ061") = _rs._ResultContent._versandAdresse._zeile6 dsPartner.Tables(0).Rows(0).Item("TXADZ071") = _rs._ResultContent._versandAdresse._zeile7 'Anrede in VA abfüllen dsPartner.Tables(0).Rows(0).Item("BEBAN011") = _rs._ResultContent._versandAdresse._briefanrede2Zeile1 dsPartner.Tables(0).Rows(0).Item("BEBAN21") = _rs._ResultContent._versandAdresse._briefanrede2Zeile2 'ENDE VI rechts abfüllen '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update (update VI, Fall 2)" End If If Not (done) And dsPartner.Tables(0).Rows(0).Item("TXADZ012") <> "" And dsPartner.Tables(0).Rows(0).Item("TXADZ011") <> "" Then 'Fall 3 --> VI rechts abfüllen done = True 'VI rechts abfüllen If _rs._ResultContent._versandAdresse.__NRPARAD <> "" Then dsPartner.Tables(0).Rows(0).Item("NRPARAD") = "00" & _rs._ResultContent._versandAdresse.__NRPARAD End If If _rs._ResultContent._versandAdresse._banklagernd <> "" Then dsPartner.Tables(0).Rows(0).Item("CDBAL00") = _rs._ResultContent._versandAdresse._banklagernd End If If _rs._ResultContent._versandAdresse._banklagernd = "Y" And _rs._ResultContent._versandAdresse.__NRADR00 <> "" Then dsPartner.Tables(0).Rows(0).Item("NRADR00") = _rs._ResultContent._versandAdresse.__NRADR00 End If If _rs._ResultContent._versandAdresse._kopien <> "" Then dsPartner.Tables(0).Rows(0).Item("AZEPL00") = _rs._ResultContent._versandAdresse._kopien End If '20080909 - E 'Saldierung bei einer Adresse nicht berücksichtigen 'If _rs._ResultContent._versandAdresse.__saldiert <> "" Then ' dsPartner.Tables(0).Rows(0).Item("saldiert") = CType(_rs._ResultContent._versandAdresse.__saldiert, Boolean) 'End If If _rs._ResultContent._versandAdresse.__SAVRS00 <> "" Then dsPartner.Tables(0).Rows(0).Item("SAVRS00") = _rs._ResultContent._versandAdresse.__SAVRS00 End If dsPartner.Tables(0).Rows(0).Item("TXADZ011") = _rs._ResultContent._versandAdresse._zeile1 dsPartner.Tables(0).Rows(0).Item("TXADZ021") = _rs._ResultContent._versandAdresse._zeile2 dsPartner.Tables(0).Rows(0).Item("TXADZ031") = _rs._ResultContent._versandAdresse._zeile3 dsPartner.Tables(0).Rows(0).Item("TXADZ041") = _rs._ResultContent._versandAdresse._zeile4 dsPartner.Tables(0).Rows(0).Item("TXADZ051") = _rs._ResultContent._versandAdresse._zeile5 dsPartner.Tables(0).Rows(0).Item("TXADZ061") = _rs._ResultContent._versandAdresse._zeile6 dsPartner.Tables(0).Rows(0).Item("TXADZ071") = _rs._ResultContent._versandAdresse._zeile7 'Anrede in VA abfüllen dsPartner.Tables(0).Rows(0).Item("BEBAN011") = _rs._ResultContent._versandAdresse._briefanrede2Zeile1 dsPartner.Tables(0).Rows(0).Item("BEBAN21") = _rs._ResultContent._versandAdresse._briefanrede2Zeile2 'ENDE VI rechts abfüllen '--TIMESTAMP dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update (update VI, Fall 3)" End If End If Dim cb As New SqlCommandBuilder(daPartner) daPartner.Update(dsPartner, "partner") daPartner.Dispose() dsPartner.Clear() m_log.Log("EDKB04: VersandAdresse partner: " & _rs._ResultContent._versandAdresse._objektRefNr & " " & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.VersandAdresse, Tabelle partner: " & _rs._ResultContent._versandAdresse._objektRefNr & " Error: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle Partner ---- Return result End Function 'LEER - Wird nicht per 1.8.2008 realisiert! Function Mitarbeiter() As Boolean Dim result As Boolean = True Return result End Function Function VV() As Boolean Dim result As Boolean = True Dim dsVV As New DataSet Dim dbRow As DataRow Dim sAction As String = "" '---- Tabelle VV --- Dim sqlstring As String = "" If _rs._ResultContent._vv._externeNr <> "" Then sqlstring = "SELECT * FROM vv WHERE NEVVG00 = '" & _rs._ResultContent._vv._externeNr & "'" End If If sqlstring = "" And _rs._ResultContent._vv._formatierteNr <> "" Then sqlstring = "SELECT * FROM vv WHERE NAVVG00 = '" & _rs._ResultContent._vv._formatierteNr & "'" End If If sqlstring = "" Then Throw New Exception("DBHandling: VV: Keine Daten für Referenzierung gefunden") Dim daVV As New SqlDataAdapter(sqlstring, Globals.sConnectionString_edoka) daVV.SelectCommand.CommandTimeout = Params.SqlTimeout Try daVV.Fill(dsVV, "vv") If dsVV.Tables(0).Rows.Count < 1 Then '------------INSERT Dim dtPartner As DataTable = dsVV.Tables(0) dbRow = dtPartner.NewRow() dbRow("NRVVG00") = hlp_GetNewKey_vv() If _rs._ResultContent._vv._ablaufDatum <> "" Then dbRow("validto") = _rs._ResultContent._vv._ablaufDatum End If If _rs._ResultContent._vv._externeNr <> "" Then dbRow("NEVVG00") = _rs._ResultContent._vv._externeNr End If If _rs._ResultContent._vv._formatierteNr <> "" Then dbRow("NAVVG00") = _rs._ResultContent._vv._formatierteNr End If If _rs._ResultContent._vv._produkt <> "" Then dbRow("NRPRD00") = _rs._ResultContent._vv._produkt End If If _rs._ResultContent._vv._kontoTyp <> "" Then dbRow("BEPRDLG") = _rs._ResultContent._vv._kontoTyp End If If _rs._ResultContent._vv.__SAREC00 <> "" Then dbRow("SAREC00") = _rs._ResultContent._vv.__SAREC00 End If If _rs._ResultContent._vv._text <> "" Then dbRow("TXRBK00") = _rs._ResultContent._vv._text End If If _rs._ResultContent._vv._PartnerNummer <> "" Then dbRow("NRPAR00") = _rs._ResultContent._vv._PartnerNummer End If '--NOT NULL 'KEIN TIMESTAMP VORHANDEN dtPartner.Rows.Add(dbRow) sAction = " insert" Else '------------UPDATE If _rs._ResultContent._vv._ablaufDatum <> "" Then dsVV.Tables(0).Rows(0).Item("validto") = _rs._ResultContent._vv._ablaufDatum End If If _rs._ResultContent._vv._externeNr <> "" Then dsVV.Tables(0).Rows(0).Item("NEVVG00") = _rs._ResultContent._vv._externeNr End If If _rs._ResultContent._vv._formatierteNr <> "" Then dsVV.Tables(0).Rows(0).Item("NAVVG00") = _rs._ResultContent._vv._formatierteNr End If If _rs._ResultContent._vv._produkt <> "" Then dsVV.Tables(0).Rows(0).Item("NRPRD00") = _rs._ResultContent._vv._produkt End If If _rs._ResultContent._vv._kontoTyp <> "" Then dsVV.Tables(0).Rows(0).Item("BEPRDLG") = _rs._ResultContent._vv._kontoTyp End If If _rs._ResultContent._vv.__SAREC00 <> "" Then dsVV.Tables(0).Rows(0).Item("SAREC00") = _rs._ResultContent._vv.__SAREC00 End If If _rs._ResultContent._vv._text <> "" Then dsVV.Tables(0).Rows(0).Item("TXRBK00") = _rs._ResultContent._vv._text End If If _rs._ResultContent._vv._PartnerNummer <> "" Then dsVV.Tables(0).Rows(0).Item("NRPAR00") = _rs._ResultContent._vv._PartnerNummer End If sAction = " update" End If Dim cb As New SqlCommandBuilder(daVV) daVV.Update(dsVV, "vv") daVV.Dispose() dsVV.Clear() m_log.Log("EDKB04: vv vv: " & _rs._ResultContent._vv._formatierteNr & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.vv, Tabelle vv: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle VV ---- '---- Tabelle Partner ---- Dim dsPartner As New DataSet Dim daPartner As New SqlDataAdapter("select * from partner where nrpar00 = " & _rs._ResultContent._vv._PartnerNummer, Globals.sConnectionString_edoka) daPartner.SelectCommand.CommandTimeout = Params.SqlTimeout Try daPartner.Fill(dsPartner, "partner") If dsPartner.Tables(0).Rows.Count < 1 Then '------------INSERT m_log.Log("EDKB04: VV partner: " & _rs._ResultContent._vv._PartnerNummer & " existiert noch nicht, die Kontodaten wurden trotzdem gespeichert", Common.Common.JournalEntryType.Warning) Else '------------UPDATE dsPartner.Tables(0).Rows(0).Item("CDVIG00") = _rs._ResultContent._vv.__CDVIG00 '--TIMESTAMP '20080909 - A 'Anpassungen(SHU) 'Mutation auf Ebene Partner bei VV-Anpassungen nicht nachführen ' 'dsPartner.Tables(0).Rows(0).Item("TSMUT00") = hlp_MutDatum("1") 'dsPartner.Tables(0).Rows(0).Item("VDMUTER") = Params.CDMuter sAction = " update" End If Dim cb As New SqlCommandBuilder(daPartner) daPartner.Update(dsPartner, "partner") daPartner.Dispose() dsPartner.Clear() m_log.Log("EDKB04: VV partner: " & _rs._ResultContent._vv._PartnerNummer & sAction & " erfolgreich", Common.Common.JournalEntryType.Information) Catch ex As Exception m_log.Log("EDKB04: DBHandling.vv, Tabelle partner: " & ex.Message, Common.Common.JournalEntryType.Error) result = False End Try '---- Tabelle Partner ---- Return result End Function #Region "Hilfsfunktionen" ''' ''' Prüfung, ob eine Partnersaldierung sofort oder erst in Zukunft durchgeführt werden soll ''' ''' ''' ''' ''' '''Version 1.6 / 23.10.2008 Private Function hlp_Check_Saldierung(ByVal instr As String, ByVal Status As String) As Boolean 'Kein Validto-Datum und Status=7 Saldierung durchfüren If Len(instr) = 0 Then If Status = "7" Then Return True End If 'Validto Datum vorhandên und kleiner oder gleich heute, dann Saldierung druchführen If Len(instr) <> 0 Then If IsDate(instr) And CDate(instr) <= Now And Status = "7" Then Return True If IsDate(instr) And CDate(instr) > Now And Status = "7" Then Return False End If Return False End Function Private Function hlp_Ablaufdatum_beruecksichtigen(ByVal instr As String) As Boolean Dim result As Boolean = False Try If Len(instr) <> 0 Then 'Es ist definiert If CDate(instr) <= Now() Then result = True End If End If Catch ex As Exception result = False End Try Return result End Function Private Function hlp_MutDatum(ByVal sformat As String) As String Dim result As String = "" Dim sMonth As String = Month(Now()) If Len(sMonth) = 1 Then sMonth = "0" + sMonth Dim sDay As String = Day(Now()) If Len(sDay) = 1 Then sDay = "0" & sDay Dim sHour As String = Hour(Now()) If Len(sHour) = 1 Then sHour = "0" & sHour Dim sMinute As String = Minute(Now()) If Len(sMinute) = 1 Then sMinute = "0" & sMinute Dim sSecond As String = Second(Now()) If Len(sSecond) = 1 Then sSecond = "0" & sSecond Select Case sformat Case "1" 'Partner.tsmut00 result = Year(Now()) & "-" & sMonth & "-" & sDay & "-" & sHour & "." & sMinute & "." & sSecond & ".000000" Case "2" 'etparn.TSMUT00 result = sDay & "." & sMonth & "." & Year(Now()) & " " & sHour & ":" & sMinute & ":" & sSecond Case "3" 'etparn.DMERF00 result = sDay & "." & sMonth & "." & Year(Now()) End Select Return result End Function Private Function hlp_GetNewKey_etbez0() As Integer hlp_GetNewKey_etbez0 = 0 Dim ssql As String ssql = "SELECT TOP 1 NRBEZ00 + 1 AS NewRow FROM edoka_etbez0 Order By NRBEZ00 DESC" Dim connection As New SqlConnection() Dim daTemp As New SqlDataAdapter(ssql, connection) Dim dsTemp As New DataSet() Try connection.ConnectionString = Globals.sConnectionString_edoka connection.Open() daTemp.Fill(dsTemp) hlp_GetNewKey_etbez0 = dsTemp.Tables(0).Rows(0).Item(0) Catch ex As Exception Return False Finally dsTemp = Nothing daTemp = Nothing connection.Close() connection = Nothing End Try End Function Private Function hlp_GetNewKey_vv() As Integer hlp_GetNewKey_vv = 0 Dim ssql As String ssql = "SELECT TOP 1 NRVVG00 + 1 AS NewRow FROM vv Order By NRVVG00 DESC" Dim connection As New SqlConnection() Dim daTemp As New SqlDataAdapter(ssql, connection) Dim dsTemp As New DataSet() Try connection.ConnectionString = Globals.sConnectionString_edoka connection.Open() daTemp.Fill(dsTemp) hlp_GetNewKey_vv = dsTemp.Tables(0).Rows(0).Item(0) Catch ex As Exception Return False Finally dsTemp = Nothing daTemp = Nothing connection.Close() connection = Nothing End Try End Function 'ACHTUNG FUNKTIONIERT NUR BEIM AUFRUF AUS HAUPTADRESSE!!! Private Function hlp_GetDefaultAnrede(ByVal nrpar As String) As String Dim result As String = "" 'Check ob Nat oder Jur Dim ssql As String ssql = "SELECT TOP 1 NRSEX00 FROM etparn WHERE nrpar00 = " & nrpar Dim connection As New SqlConnection() Dim daTemp As New SqlDataAdapter(ssql, connection) Dim dsTemp As New DataSet() Try connection.ConnectionString = Globals.sConnectionString_edoka connection.Open() daTemp.Fill(dsTemp) If dsTemp.Tables(0).Rows.Count > 0 Then 'Nat -> Sex auslesen If dsTemp.Tables(0).Rows(0).Item(0) = "1" Then result = "Herr " & _rs._ResultContent._hauptAdresse._nachname Else result = "Frau " & _rs._ResultContent._hauptAdresse._nachname End If Else 'Jur result = "Damen und Herren" End If Catch ex As Exception result = "Damen und Herren" Finally dsTemp = Nothing daTemp = Nothing connection.Close() connection = Nothing End Try Return result End Function 'ACHTUNG FUNKTIONIERT NUR BEIM AUFRUF AUS HAUPTADRESSE!!! Private Function hlp_GetKurzname() As String Dim result As String = "" Dim tmp_Partnertyp As String = "" 'Check ob Nat oder Jur Dim ssql As String ssql = "SELECT TOP 1 nrpar00 FROM etparn WHERE nrpar00 = " & _rs._ResultContent._hauptAdresse.__nrpar00 Dim connection As New SqlConnection() Dim daTemp As New SqlDataAdapter(ssql, connection) Dim dsTemp As New DataSet() Try connection.ConnectionString = Globals.sConnectionString_edoka connection.Open() daTemp.Fill(dsTemp) If dsTemp.Tables(0).Rows.Count > 0 Then 'NAT -> Vorname1 Name, Ort result = _rs._ResultContent._hauptAdresse._vorname1 If result <> "" And _rs._ResultContent._hauptAdresse.__NachnameUngekuerzt <> "" Then result = result & " " End If result = result & _rs._ResultContent._hauptAdresse.__NachnameUngekuerzt If _rs._ResultContent._hauptAdresse._ort <> "" Then result = result & ", " End If result = result & _rs._ResultContent._hauptAdresse._ort Else 'Check ob Firma oder nicht If _rs._ResultContent._hauptAdresse._firma = "" Then '-> Vorname1 Name, Ort result = _rs._ResultContent._hauptAdresse._vorname1 If result <> "" And _rs._ResultContent._hauptAdresse.__NachnameUngekuerzt <> "" Then result = result & " " End If result = result & _rs._ResultContent._hauptAdresse.__NachnameUngekuerzt If _rs._ResultContent._hauptAdresse._ort <> "" Then result = result & ", " End If result = result & _rs._ResultContent._hauptAdresse._ort Else '-> Firma, Ort result = _rs._ResultContent._hauptAdresse._firma If _rs._ResultContent._hauptAdresse._ort <> "" And _rs._ResultContent._hauptAdresse._firma <> "" Then result = result & ", " End If result = result & _rs._ResultContent._hauptAdresse._ort End If End If Catch ex As Exception m_log.Log("EDKB04: DBHandling.hlp_GetKurzname() : " & ex.Message, Common.Common.JournalEntryType.Error) result = "" Finally dsTemp = Nothing daTemp = Nothing connection.Close() connection = Nothing End Try Return result End Function Private Function isVorherigVI(ByVal aktuelle_Pnr As String) As Boolean Dim result As Boolean = False Try If _old.HasVersandadresse Then 'vorherige Msg war VI If CInt(_old._ResultContent._versandAdresse._objektRefNr) = CInt(aktuelle_Pnr) Then 'vorherige Msg war gleicher Partner result = True 'm_log.Log("EDKB04: VersandAdresse: Vorheriges Objekt ist VI von gleichem Partner", Common.Common.JournalEntryType.Information) Else m_log.Log("EDKB04: Vorheriges Objekt ist NICHT VI von gleichem Partner", Common.Common.JournalEntryType.Information) End If End If Catch ex As Exception End Try Return result End Function Private Function hlp_GetBetreuerID_Substitute(ByVal strPnr As String) As String Dim result As String = Params.DefaultBetreuerID 'Prüfen ob bereit ein Betreuer eingetragen ist Dim ssql As String ssql = "SELECT TOP 1 NRBEU01 FROM edoka_etbez0 WHERE nrpar00 = " & strPnr Dim connection As New SqlConnection() Dim daTemp As New SqlDataAdapter(ssql, connection) Dim dsTemp As New DataSet() Try connection.ConnectionString = Globals.sConnectionString_edoka connection.Open() daTemp.Fill(dsTemp) If dsTemp.Tables(0).Rows.Count > 0 Then If CStr(dsTemp.Tables(0).Rows(0).Item(0)) <> "0" Then result = CStr(dsTemp.Tables(0).Rows(0).Item(0)) m_log.Log("EDKB04: Fehler in Partner, keine BetreuerID es wird der vorhandene Betreuer weiterverwendet, PartnerNr: " & strPnr, Common.Common.JournalEntryType.Error) Else m_log.Log("EDKB04: Fehler in Partner, keine BetreuerID es wurde der Defaultbetreuer eingesetzt, PartnerNr: " & strPnr, Common.Common.JournalEntryType.Error) End If Else m_log.Log("EDKB04: Fehler in Partner, keine BetreuerID es wurde der Defaultbetreuer eingesetzt, PartnerNr: " & strPnr, Common.Common.JournalEntryType.Error) End If Catch ex As Exception m_log.Log("EDKB04: Fehler in hlp_GetBetreuerID_Substitute, PartnerNr: " & strPnr & ", Error" & ex.Message, Common.Common.JournalEntryType.Error) Finally dsTemp = Nothing daTemp = Nothing connection.Close() connection = Nothing End Try Return result End Function Private Sub Cutter(ByVal strIn As String, ByVal olen1 As Integer, ByVal olen2 As Integer, ByVal olen3 As Integer, ByRef strOut1 As String, ByRef strOut2 As String, ByRef strOut3 As String) 'HINWEIS: Damit universal einsetzbar werden die Variablen byRef übergeben 'strIN: Inputstring in gesamter Länge 'olen1-3: Maximale Länge der Ausgabefelder 'strout1-3: Rückgabewerte Dim Delimiter As String = " " Dim strtmp1 As String = "" Dim strtmp2 As String = "" Dim i As Integer = 0 Dim foundIt As Boolean = False 'Check ob Länger als len1---------------------------------- If Len(strIn) > olen1 Then 'Suche nach 1. Leerschlag von rechts von olen1 aus For i = -1 To olen1 - 1 If InStr(Mid(strIn, olen1 - i, 1), Delimiter, CompareMethod.Text) > 0 Then 'MsgBox("match1='" & Mid(strIn, olen1 - i, 1) & "'") strOut1 = Microsoft.VisualBasic.Left(strIn, olen1 - i - 1) strtmp1 = Microsoft.VisualBasic.Right(strIn, Len(strIn) - olen1 + i) foundIt = True Exit For End If Next If Not foundIt Then 'Kein Leerschlag drinn, d.h. mitten im Word trennen strOut1 = Microsoft.VisualBasic.Left(strIn, olen1) strtmp1 = Microsoft.VisualBasic.Right(strIn, Len(strIn) - olen1) End If 'Check ob Länger als len2---------------------------------- foundIt = False If Len(strtmp1) > olen2 Then 'Suche nach 1. Leerschlag von rechts von olen2 aus For i = -1 To olen2 - 1 If InStr(Mid(strtmp1, olen2 - i, 1), Delimiter, CompareMethod.Text) > 0 Then strOut2 = Microsoft.VisualBasic.Left(strtmp1, olen2 - i - 1) strtmp2 = Microsoft.VisualBasic.Right(strtmp1, Len(strtmp1) - olen2 + i) foundIt = True Exit For End If Next If Not foundIt Then 'Kein Leerschlag drinn, d.h. mitten im Word trennen strOut2 = Microsoft.VisualBasic.Left(strtmp1, olen2) strtmp2 = Microsoft.VisualBasic.Right(strtmp1, Len(strtmp1) - olen2) End If 'Schluss noch 3. Teil abschneiden wenn nötig strOut3 = Microsoft.VisualBasic.Left(strtmp2, olen3) Else 'Nichts mehr abschneiden strOut2 = strtmp1 strOut3 = "" End If Else strOut1 = strIn strOut2 = "" strOut3 = "" End If End Sub 'Private Function hlp_Versandart(ByVal nrpar00 As Integer) As Integer ' Dim ex As New SqlDataAdapter("Select * from ams_versandart where nrpar00=" & nrpar00, Globals.sConnectionString_edoka) ' Dim exdata As New DataSet ' Dim i As Integer ' hlp_Versandart = 0 ' Try ' ex.Fill(exdata, "ex") ' For i = 0 To exdata.Tables(0).Rows.Count - 1 ' If Not exdata.Tables(0).Rows(i).Item("cdvsa00") Is System.DBNull.Value Then ' If exdata.Tables(0).Rows(i).Item("cdvsa00") <> "00" And exdata.Tables(0).Rows(i).Item("cdvsa00") <> "01" And exdata.Tables(0).Rows(i).Item("cdvsa00") <> "02" Then ' hlp_Versandart = 1 ' End If ' End If ' Next ' Return hlp_Versandart ' Catch exi As Exception ' m_log.Log("EDKB04: Warnung: Versandart " & exi.Message & " - Partner: " & nrpar00, Common.Common.JournalEntryType.Warning) ' Finally ' exdata.Dispose() ' ex.Dispose() ' End Try 'End Function 'Private Function hlp_Exemplare(ByVal nrpar00 As Integer) As Integer ' Dim ex As New SqlDataAdapter("Select * from ams_exemplare where nrpar00=" & nrpar00, Globals.sConnectionString_edoka) ' Dim exdata As New DataSet ' Try ' ex.Fill(exdata, "ex") ' If exdata.Tables(0).Rows.Count = 0 Then ' hlp_Exemplare = 1 ' Else ' If exdata.Tables(0).Rows(0).Item("azepl00") Is System.DBNull.Value Then ' hlp_Exemplare = 1 ' Else ' hlp_Exemplare = exdata.Tables(0).Rows(0).Item("azepl00") ' End If ' End If ' Return hlp_Exemplare ' Catch exi As Exception ' m_log.Log("EDKB04: Fehler Exemplare " & exi.Message & " - Partner: " & nrpar00, Common.Common.JournalEntryType.Error) ' Finally ' exdata.Dispose() ' ex.Dispose() ' End Try 'End Function #End Region End Module