Fehlerhandling verbessert.

This commit is contained in:
2023-06-19 14:55:23 +02:00
parent 5276cdabdc
commit 8621d57df2
4 changed files with 193 additions and 132 deletions

View File

@@ -30,8 +30,6 @@ Partial Class usrcntlCreditsafe
Me.lblFirma = New System.Windows.Forms.Label() Me.lblFirma = New System.Windows.Forms.Label()
Me.lblLand = New System.Windows.Forms.Label() Me.lblLand = New System.Windows.Forms.Label()
Me.lblWarning = New System.Windows.Forms.Label() Me.lblWarning = New System.Windows.Forms.Label()
Me.dgvCreditsafe = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.cboLand = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.btnUebernehmen = New System.Windows.Forms.Button() Me.btnUebernehmen = New System.Windows.Forms.Button()
Me.txtStrasse = New System.Windows.Forms.TextBox() Me.txtStrasse = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label() Me.Label1 = New System.Windows.Forms.Label()
@@ -39,6 +37,10 @@ Partial Class usrcntlCreditsafe
Me.Label2 = New System.Windows.Forms.Label() Me.Label2 = New System.Windows.Forms.Label()
Me.txtOrt = New System.Windows.Forms.TextBox() Me.txtOrt = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label() Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.cbxSprache = New VERAG_PROG_ALLGEMEIN.MyComboBox()
Me.dgvCreditsafe = New VERAG_PROG_ALLGEMEIN.MyDatagridview(Me.components)
Me.cboLand = New VERAG_PROG_ALLGEMEIN.MyComboBox()
CType(Me.dgvCreditsafe, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.dgvCreditsafe, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout() Me.SuspendLayout()
' '
@@ -62,7 +64,7 @@ Partial Class usrcntlCreditsafe
Me.lblUID.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.lblUID.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.lblUID.AutoSize = True Me.lblUID.AutoSize = True
Me.lblUID.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!) Me.lblUID.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.lblUID.Location = New System.Drawing.Point(671, 16) Me.lblUID.Location = New System.Drawing.Point(671, 52)
Me.lblUID.Name = "lblUID" Me.lblUID.Name = "lblUID"
Me.lblUID.Size = New System.Drawing.Size(40, 13) Me.lblUID.Size = New System.Drawing.Size(40, 13)
Me.lblUID.TabIndex = 1 Me.lblUID.TabIndex = 1
@@ -72,7 +74,7 @@ Partial Class usrcntlCreditsafe
' '
Me.txtUID.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Me.txtUID.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtUID.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!) Me.txtUID.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtUID.Location = New System.Drawing.Point(674, 32) Me.txtUID.Location = New System.Drawing.Point(674, 68)
Me.txtUID.Name = "txtUID" Me.txtUID.Name = "txtUID"
Me.txtUID.Size = New System.Drawing.Size(134, 23) Me.txtUID.Size = New System.Drawing.Size(134, 23)
Me.txtUID.TabIndex = 3 Me.txtUID.TabIndex = 3
@@ -82,7 +84,7 @@ Partial Class usrcntlCreditsafe
Me.txtFirma.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Me.txtFirma.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtFirma.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!) Me.txtFirma.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtFirma.Location = New System.Drawing.Point(75, 33) Me.txtFirma.Location = New System.Drawing.Point(75, 69)
Me.txtFirma.Name = "txtFirma" Me.txtFirma.Name = "txtFirma"
Me.txtFirma.Size = New System.Drawing.Size(173, 23) Me.txtFirma.Size = New System.Drawing.Size(173, 23)
Me.txtFirma.TabIndex = 1 Me.txtFirma.TabIndex = 1
@@ -91,7 +93,7 @@ Partial Class usrcntlCreditsafe
' '
Me.lblFirma.AutoSize = True Me.lblFirma.AutoSize = True
Me.lblFirma.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!) Me.lblFirma.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.lblFirma.Location = New System.Drawing.Point(72, 16) Me.lblFirma.Location = New System.Drawing.Point(72, 52)
Me.lblFirma.Name = "lblFirma" Me.lblFirma.Name = "lblFirma"
Me.lblFirma.Size = New System.Drawing.Size(32, 13) Me.lblFirma.Size = New System.Drawing.Size(32, 13)
Me.lblFirma.TabIndex = 3 Me.lblFirma.TabIndex = 3
@@ -101,7 +103,7 @@ Partial Class usrcntlCreditsafe
' '
Me.lblLand.AutoSize = True Me.lblLand.AutoSize = True
Me.lblLand.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!) Me.lblLand.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.lblLand.Location = New System.Drawing.Point(11, 16) Me.lblLand.Location = New System.Drawing.Point(11, 52)
Me.lblLand.Name = "lblLand" Me.lblLand.Name = "lblLand"
Me.lblLand.Size = New System.Drawing.Size(31, 13) Me.lblLand.Size = New System.Drawing.Size(31, 13)
Me.lblLand.TabIndex = 5 Me.lblLand.TabIndex = 5
@@ -112,11 +114,109 @@ Partial Class usrcntlCreditsafe
Me.lblWarning.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles) Me.lblWarning.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
Me.lblWarning.AutoSize = True Me.lblWarning.AutoSize = True
Me.lblWarning.ForeColor = System.Drawing.Color.Red Me.lblWarning.ForeColor = System.Drawing.Color.Red
Me.lblWarning.Location = New System.Drawing.Point(11, 421) Me.lblWarning.Location = New System.Drawing.Point(11, 451)
Me.lblWarning.Name = "lblWarning" Me.lblWarning.Name = "lblWarning"
Me.lblWarning.Size = New System.Drawing.Size(0, 13) Me.lblWarning.Size = New System.Drawing.Size(0, 13)
Me.lblWarning.TabIndex = 8 Me.lblWarning.TabIndex = 8
' '
'btnUebernehmen
'
Me.btnUebernehmen.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnUebernehmen.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnUebernehmen.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnUebernehmen.Location = New System.Drawing.Point(786, 451)
Me.btnUebernehmen.Name = "btnUebernehmen"
Me.btnUebernehmen.Size = New System.Drawing.Size(136, 41)
Me.btnUebernehmen.TabIndex = 9
Me.btnUebernehmen.Text = "Übernehmen"
Me.btnUebernehmen.UseVisualStyleBackColor = True
'
'txtStrasse
'
Me.txtStrasse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtStrasse.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtStrasse.Location = New System.Drawing.Point(254, 69)
Me.txtStrasse.Name = "txtStrasse"
Me.txtStrasse.Size = New System.Drawing.Size(163, 23)
Me.txtStrasse.TabIndex = 101
'
'Label1
'
Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label1.Location = New System.Drawing.Point(251, 53)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(42, 13)
Me.Label1.TabIndex = 100
Me.Label1.Text = "Strasse"
'
'txtPLZ
'
Me.txtPLZ.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtPLZ.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtPLZ.Location = New System.Drawing.Point(584, 68)
Me.txtPLZ.Name = "txtPLZ"
Me.txtPLZ.Size = New System.Drawing.Size(84, 23)
Me.txtPLZ.TabIndex = 103
'
'Label2
'
Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label2.Location = New System.Drawing.Point(581, 52)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(27, 13)
Me.Label2.TabIndex = 102
Me.Label2.Text = "PLZ"
'
'txtOrt
'
Me.txtOrt.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtOrt.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtOrt.Location = New System.Drawing.Point(423, 68)
Me.txtOrt.Name = "txtOrt"
Me.txtOrt.Size = New System.Drawing.Size(155, 23)
Me.txtOrt.TabIndex = 105
'
'Label3
'
Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label3.Location = New System.Drawing.Point(420, 52)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(21, 13)
Me.Label3.TabIndex = 104
Me.Label3.Text = "Ort"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label4.Location = New System.Drawing.Point(11, 6)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(535, 13)
Me.Label4.TabIndex = 106
Me.Label4.Text = "Sprache (Wird nur für Länder verwendet, in denen mehr als ein Firmenname für vers" &
"chiedene Sprachen existiert)"
Me.Label4.Visible = False
'
'cbxSprache
'
Me.cbxSprache._allowedValuesFreiText = Nothing
Me.cbxSprache._allowFreiText = True
Me.cbxSprache._value = ""
Me.cbxSprache.DropDownWidth = 300
Me.cbxSprache.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.cbxSprache.FormattingEnabled = True
Me.cbxSprache.Location = New System.Drawing.Point(14, 22)
Me.cbxSprache.Name = "cbxSprache"
Me.cbxSprache.Size = New System.Drawing.Size(58, 24)
Me.cbxSprache.TabIndex = 107
Me.cbxSprache.Visible = False
'
'dgvCreditsafe 'dgvCreditsafe
' '
Me.dgvCreditsafe.AKTUALISIERUNGS_INTERVALL = -1 Me.dgvCreditsafe.AKTUALISIERUNGS_INTERVALL = -1
@@ -128,12 +228,12 @@ Partial Class usrcntlCreditsafe
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.dgvCreditsafe.BackgroundColor = System.Drawing.Color.White Me.dgvCreditsafe.BackgroundColor = System.Drawing.Color.White
Me.dgvCreditsafe.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize Me.dgvCreditsafe.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvCreditsafe.Location = New System.Drawing.Point(14, 68) Me.dgvCreditsafe.Location = New System.Drawing.Point(14, 105)
Me.dgvCreditsafe.Name = "dgvCreditsafe" Me.dgvCreditsafe.Name = "dgvCreditsafe"
Me.dgvCreditsafe.ReadOnly = True Me.dgvCreditsafe.ReadOnly = True
Me.dgvCreditsafe.RowHeadersVisible = False Me.dgvCreditsafe.RowHeadersVisible = False
Me.dgvCreditsafe.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect Me.dgvCreditsafe.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgvCreditsafe.Size = New System.Drawing.Size(908, 347) Me.dgvCreditsafe.Size = New System.Drawing.Size(908, 340)
Me.dgvCreditsafe.TabIndex = 7 Me.dgvCreditsafe.TabIndex = 7
' '
'cboLand 'cboLand
@@ -144,89 +244,19 @@ Partial Class usrcntlCreditsafe
Me.cboLand.DropDownWidth = 300 Me.cboLand.DropDownWidth = 300
Me.cboLand.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!) Me.cboLand.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.cboLand.FormattingEnabled = True Me.cboLand.FormattingEnabled = True
Me.cboLand.Location = New System.Drawing.Point(14, 32) Me.cboLand.Location = New System.Drawing.Point(14, 68)
Me.cboLand.Name = "cboLand" Me.cboLand.Name = "cboLand"
Me.cboLand.Size = New System.Drawing.Size(58, 24) Me.cboLand.Size = New System.Drawing.Size(58, 24)
Me.cboLand.TabIndex = 99 Me.cboLand.TabIndex = 99
' '
'btnUebernehmen
'
Me.btnUebernehmen.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.btnUebernehmen.DialogResult = System.Windows.Forms.DialogResult.OK
Me.btnUebernehmen.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btnUebernehmen.Location = New System.Drawing.Point(786, 421)
Me.btnUebernehmen.Name = "btnUebernehmen"
Me.btnUebernehmen.Size = New System.Drawing.Size(136, 41)
Me.btnUebernehmen.TabIndex = 9
Me.btnUebernehmen.Text = "Übernehmen"
Me.btnUebernehmen.UseVisualStyleBackColor = True
'
'txtStrasse
'
Me.txtStrasse.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtStrasse.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtStrasse.Location = New System.Drawing.Point(254, 33)
Me.txtStrasse.Name = "txtStrasse"
Me.txtStrasse.Size = New System.Drawing.Size(163, 23)
Me.txtStrasse.TabIndex = 101
'
'Label1
'
Me.Label1.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label1.Location = New System.Drawing.Point(251, 17)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(42, 13)
Me.Label1.TabIndex = 100
Me.Label1.Text = "Strasse"
'
'txtPLZ
'
Me.txtPLZ.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtPLZ.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtPLZ.Location = New System.Drawing.Point(584, 32)
Me.txtPLZ.Name = "txtPLZ"
Me.txtPLZ.Size = New System.Drawing.Size(84, 23)
Me.txtPLZ.TabIndex = 103
'
'Label2
'
Me.Label2.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label2.Location = New System.Drawing.Point(581, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(27, 13)
Me.Label2.TabIndex = 102
Me.Label2.Text = "PLZ"
'
'txtOrt
'
Me.txtOrt.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.txtOrt.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!)
Me.txtOrt.Location = New System.Drawing.Point(423, 32)
Me.txtOrt.Name = "txtOrt"
Me.txtOrt.Size = New System.Drawing.Size(155, 23)
Me.txtOrt.TabIndex = 105
'
'Label3
'
Me.Label3.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.0!)
Me.Label3.Location = New System.Drawing.Point(420, 16)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(21, 13)
Me.Label3.TabIndex = 104
Me.Label3.Text = "Ort"
'
'usrcntlCreditsafe 'usrcntlCreditsafe
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.AutoScroll = True Me.AutoScroll = True
Me.BackColor = System.Drawing.Color.White Me.BackColor = System.Drawing.Color.White
Me.Controls.Add(Me.cbxSprache)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.txtOrt) Me.Controls.Add(Me.txtOrt)
Me.Controls.Add(Me.Label3) Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.txtPLZ) Me.Controls.Add(Me.txtPLZ)
@@ -244,7 +274,7 @@ Partial Class usrcntlCreditsafe
Me.Controls.Add(Me.lblUID) Me.Controls.Add(Me.lblUID)
Me.Controls.Add(Me.btnSearch) Me.Controls.Add(Me.btnSearch)
Me.Name = "usrcntlCreditsafe" Me.Name = "usrcntlCreditsafe"
Me.Size = New System.Drawing.Size(938, 465) Me.Size = New System.Drawing.Size(938, 495)
CType(Me.dgvCreditsafe, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.dgvCreditsafe, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False) Me.ResumeLayout(False)
Me.PerformLayout() Me.PerformLayout()
@@ -267,4 +297,6 @@ Partial Class usrcntlCreditsafe
Friend WithEvents Label2 As Label Friend WithEvents Label2 As Label
Friend WithEvents txtOrt As TextBox Friend WithEvents txtOrt As TextBox
Friend WithEvents Label3 As Label Friend WithEvents Label3 As Label
Friend WithEvents cbxSprache As VERAG_PROG_ALLGEMEIN.MyComboBox
Friend WithEvents Label4 As Label
End Class End Class

View File

@@ -49,6 +49,11 @@ Public Class usrcntlCreditsafe
If land = "" Then land = "AT" If land = "" Then land = "AT"
cbxSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("EN", "EN"))
cbxSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("DE", "DE"))
cbxSprache.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem(" ", ""))
cbxSprache.changeItem("")
cboLand.changeItem(land) cboLand.changeItem(land)
initDataTable() initDataTable()
btnUebernehmen.Enabled = False btnUebernehmen.Enabled = False
@@ -98,7 +103,7 @@ Public Class usrcntlCreditsafe
If cs.authenticate(user, pw) = "200" Then If cs.authenticate(user, pw) = "200" Then
Dim company = New cCreditSafeAPI.Company(txtFirma.Text, txtUID.Text, cboLand.SelectedItem.Value, "", "", Nothing, txtStrasse.Text, txtPLZ.Text, txtOrt.Text, "", "", "", "", "") Dim company = New cCreditSafeAPI.Company(cbxSprache._value, txtFirma.Text, txtUID.Text, cboLand.SelectedItem.Value, "", "", Nothing, txtStrasse.Text, txtPLZ.Text, txtOrt.Text, "", "", "", "", "")
lblWarning.Text = cs.searchCompanies(company, dataTable).ToString lblWarning.Text = cs.searchCompanies(company, dataTable).ToString
initDGV(dataTable) initDGV(dataTable)
Cursor = Cursors.Default Cursor = Cursors.Default
@@ -316,6 +321,10 @@ Public Class usrcntlCreditsafe
End If End If
End Sub End Sub
Private Sub cbxSprache_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxSprache.SelectedIndexChanged
dataTable.Clear()
End Sub
Private Sub dgvCreditsafe_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvCreditsafe.CellDoubleClick Private Sub dgvCreditsafe_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgvCreditsafe.CellDoubleClick
If dgvCreditsafe.SelectedRows.Count = 1 Then If dgvCreditsafe.SelectedRows.Count = 1 Then
btnUebernehmen.PerformClick() btnUebernehmen.PerformClick()

View File

@@ -2758,7 +2758,7 @@ Public Class usrCntlKundenuebersicht
End Select End Select
Dim company As New cCreditSafeAPI.Company("", "", land, KUNDE_ERW.kde_CreditSaveNo, KUNDE_ERW.kde_CreditSaveId, Nothing, "", "", "", "", "", "", "", "") Dim company As New cCreditSafeAPI.Company("", "", "", land, KUNDE_ERW.kde_CreditSaveNo, KUNDE_ERW.kde_CreditSaveId, Nothing, "", "", "", "", "", "", "", "")
If lblBonitaetsdatum._value <> Nothing Then If lblBonitaetsdatum._value <> Nothing Then
@@ -2972,8 +2972,14 @@ Public Class usrCntlKundenuebersicht
Private Sub setCreditsafereportEntry(cs As cCreditSafeAPI, company As cCreditSafeAPI.Company) Private Sub setCreditsafereportEntry(cs As cCreditSafeAPI, company As cCreditSafeAPI.Company)
Dim pdfObject As Byte() = Nothing Dim pdfObject As Byte() = Nothing
Dim failureDesc As String = ""
cs.getReport(company, True) Dim failureDesc As String = cs.getReport(company, True)
If failureDesc <> "" Then
MsgBox(failureDesc)
Cursor = Cursors.Default
Exit Sub
End If
pdfObject = cs.getPDF(company, failureDesc) pdfObject = cs.getPDF(company, failureDesc)
If pdfObject Is Nothing Then If pdfObject Is Nothing Then
setCreditSafeEntry(company, Nothing, kdNr) setCreditSafeEntry(company, Nothing, kdNr)

View File

@@ -2,6 +2,7 @@
Imports System.IO Imports System.IO
Imports System.Net Imports System.Net
Imports System.Text Imports System.Text
Imports System.Threading
Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls
Imports System.Windows.Forms Imports System.Windows.Forms
Imports Chilkat Imports Chilkat
@@ -123,10 +124,20 @@ Public Class cCreditSafeAPI
Return failureDesc Return failureDesc
Else Else
If (rest.ResponseStatusCode <> 200) Then If (rest.ResponseStatusCode <> 200) Then
Dim sbErrorText As New Chilkat.StringBuilder For i = 0 To 4 'Versuche das PDF 5x abzufragen (funktioniert ab und zu nicht).
sbErrorText.AppendBd(pdfData, "utf-8", 0, 0) responseJson = rest.FullRequestNoBodyBd(method, url, pdfData)
failureDesc = sbErrorText.GetAsString() If rest.ResponseStatusCode = 200 Then Exit For
Return failureDesc & vbNewLine & url Thread.Sleep(500)
i = i + 1
Next
If rest.ResponseStatusCode <> 200 Then
Dim sbErrorText As New Chilkat.StringBuilder
sbErrorText.AppendBd(pdfData, "utf-8", 0, 0)
failureDesc = sbErrorText.GetAsString()
Return failureDesc
End If
Else Else
Return pdfData.GetEncoded("base64") Return pdfData.GetEncoded("base64")
@@ -145,9 +156,16 @@ Public Class cCreditSafeAPI
Return failureDesc Return failureDesc
Else Else
Return responseJson If (rest.ResponseStatusCode <> 200) Then
failureDesc = rest.ResponseStatusText
Return failureDesc
Else
Return responseJson
End If
End If End If
End If End If
@@ -174,6 +192,7 @@ Public Class cCreditSafeAPI
Shared Function searchCompanies(company As Company, ByRef dataTable As DataTable) As String Shared Function searchCompanies(company As Company, ByRef dataTable As DataTable) As String
VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat() VERAG_PROG_ALLGEMEIN.cChilkat_Helper.UnlockCilkat()
Dim failureDesc As String Dim failureDesc As String
Dim myUrl As String = API_STRING & "/v1/companies" Dim myUrl As String = API_STRING & "/v1/companies"
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc) Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, company, "application/json", "GET", token, failureDesc)
@@ -268,15 +287,15 @@ Public Class cCreditSafeAPI
End Function End Function
Shared Function getReport(ByRef company As Company, withPDF As Boolean) As String 'Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String Shared Function getReport(ByRef company As Company, withPDF As Boolean) As String 'Shared Function getReport(ByRef company As Company, withPDF As Boolean, ByRef bytes As Byte()) As String
Dim failureDesc As String Dim failureDesc As String = ""
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/" Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/"
If company.country = "DE" Then If company.country = "DE" Then
'Abfragen für DE benötigen einen Reason-Code 'Abfragen für DE benötigen einen Reason-Code
myUrl &= "?customData=de_reason_code::2" myUrl &= "?customData=de_reason_code::3"
myUrl &= "&?language=DE&?template=full" myUrl &= "&?language=DE"
Else Else
myUrl &= "?language=DE&?template=full" myUrl &= "?language=DE"
End If End If
Dim acceptContentType = "application/json" Dim acceptContentType = "application/json"
@@ -287,14 +306,11 @@ Public Class cCreditSafeAPI
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token, failureDesc) Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token, failureDesc)
If failureDesc <> "" Then Return failureDesc
Dim json As New Chilkat.JsonObject Dim json As New Chilkat.JsonObject
Dim success As Boolean = json.Load(jsonRespString) Dim success As Boolean = json.Load(jsonRespString)
If (success <> True) Then If (success <> True) Then Return "Verbindungsfehler"
Debug.WriteLine(json.LastErrorText)
Return "Verbindungsfehler"
End If
'Aubbau JSON Object 'Aubbau JSON Object
@@ -433,40 +449,32 @@ Public Class cCreditSafeAPI
End Function End Function
Shared Function getPDF(ByRef company As Company, ByRef failure As String) As Byte() Shared Function getPDF(ByVal company As Company, ByRef failure As String) As Byte()
If company IsNot Nothing AndAlso company.creditSafeId <> "" Then
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/"
If company.country = "DE" Then
'Abfragen für DE benötigen einen Reason-Code
myUrl &= "?customData=de_reason_code::2"
myUrl &= "&?language=DE&?template=full"
Else
myUrl &= "?template=full"
End If
Dim acceptContentType = "application/pdf"
Dim pdfData2 As New Chilkat.BinData
Dim failureDesc As String
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token, failureDesc)
failure = failureDesc
If jsonRespString IsNot Nothing And failure = "" Then
Dim success = pdfData2.AppendEncoded(jsonRespString, "base64")
If success Then
Return pdfData2.GetBinary
End If
'Return Convert.FromBase64String(test)
End If
Dim myUrl As String = API_STRING & "/v1/companies/" & company.creditSafeId & "/"
If company.country = "DE" Then
'Abfragen für DE benötigen einen Reason-Code
myUrl &= "?customData=de_reason_code::3"
myUrl &= "&?language=DE"
Else Else
myUrl &= "?language=DE"
Return Nothing
End If End If
Dim acceptContentType = "application/pdf"
Dim pdfData2 As New Chilkat.BinData
Dim failureDesc As String = ""
Dim jsonRespString = SendGetRequestWithAuthHeader(myUrl, Nothing, acceptContentType, "GET", token, failureDesc)
If failureDesc <> "" Then Return Nothing
If jsonRespString IsNot Nothing Then
Dim success = pdfData2.AppendEncoded(jsonRespString, "base64")
If success Then
Return pdfData2.GetBinary
End If
Return Nothing
End If
Return Nothing
End Function End Function
@@ -477,10 +485,13 @@ Public Class cCreditSafeAPI
rest.AddQueryParam("countries", company.country) rest.AddQueryParam("countries", company.country)
If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel If company.creditsafeNo <> "" Then 'Eindeutiger Schlüssel
rest.AddQueryParam("safeNo", company.creditsafeNo) rest.AddQueryParam("safeNo", company.creditsafeNo)
Else Else
If company.language <> "" Then rest.AddQueryParam("language", company.language)
If company.vatNo <> "" Then If company.vatNo <> "" Then
rest.AddQueryParam("vatNo", company.vatNo) rest.AddQueryParam("vatNo", company.vatNo)
@@ -571,11 +582,13 @@ Public Class cCreditSafeAPI
Public Property csShareholder As String Public Property csShareholder As String
Public Property csCEO As String Public Property csCEO As String
Public Property language As String
Public Property csBank As String Public Property csBank As String
Public Sub New(_name As String, _vatNo As String, _country As String, _creditsafeNo As String, _creditSafeId As String, _lastChecked As Date, _street As String, _postalCode As String, _city As String, _sumEmployees As String, _businessPurpose As String, _shareholder As String, _ceo As String, _bank As String) Public Sub New(_language As String, _name As String, _vatNo As String, _country As String, _creditsafeNo As String, _creditSafeId As String, _lastChecked As Date, _street As String, _postalCode As String, _city As String, _sumEmployees As String, _businessPurpose As String, _shareholder As String, _ceo As String, _bank As String)
creditSafeId = _creditSafeId creditSafeId = _creditSafeId
name = _name name = _name
vatNo = _vatNo vatNo = _vatNo
@@ -590,6 +603,7 @@ Public Class cCreditSafeAPI
csShareholder = _shareholder csShareholder = _shareholder
csCEO = _ceo csCEO = _ceo
csBank = _bank csBank = _bank
language = _language
End Sub End Sub
Public Sub New() Public Sub New()