Exception-Handling verfeinert, kleine Bugfixes durchgeführt.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
Imports System.CodeDom
|
||||
Imports DocumentFormat.OpenXml.Bibliography
|
||||
Imports DocumentFormat.OpenXml.Drawing
|
||||
Imports Org.BouncyCastle.Utilities
|
||||
Imports SDL
|
||||
Imports Therefore.API
|
||||
@@ -36,19 +37,25 @@ Public Class frmRoutendauerBerechnen
|
||||
|
||||
txtNach.Text = destination
|
||||
destinationShortcut = findDestinationAndReplaceToShortCut(destination)
|
||||
initComboboxDeparture()
|
||||
If destinationShortcut = "" Then
|
||||
initComboboxDeparture(destination)
|
||||
Else
|
||||
initComboboxDeparture(destinationShortcut)
|
||||
End If
|
||||
|
||||
txbAbgangsdatum._value = ""
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub initComboboxDeparture()
|
||||
Sub initComboboxDeparture(destination As String)
|
||||
|
||||
cbxVon.Items.Clear()
|
||||
cbxVon.fillWithSQL("SELECT [nctsr_von], [nctsr_von_region] FROM [tblNTCSRouten] WHERE [nctsr_nach] = '" & destinationShortcut & "'", False, "FMZOLL", False)
|
||||
cbxVon.fillWithSQL("SELECT [nctsr_von], [nctsr_von_region] FROM [tblNTCSRouten] WHERE [nctsr_nach] = '" & destination & "'", False, "FMZOLL", False)
|
||||
cbxVon.Items.Add(New VERAG_PROG_ALLGEMEIN.MyListItem("", ""))
|
||||
cbxVon.changeItem("")
|
||||
If cbxVon._value = "" Then
|
||||
MsgBox("Es wurde für die Bestimmungszollstelle " & txtNach.Text & " keine Route definiert." & vbCrLf & "Bitte voraus. Datum des Eintreffens manuell eingeben!")
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -67,17 +74,14 @@ Public Class frmRoutendauerBerechnen
|
||||
checkIfDepatureDateIsNotPast()
|
||||
End Sub
|
||||
|
||||
Function calculateTripDuration() As Integer
|
||||
Function lookUpTripDuration() As Integer
|
||||
|
||||
'Dim destination As String
|
||||
Dim departure As String
|
||||
|
||||
departure = cbxVon._value
|
||||
'destination = txtNach.Text
|
||||
|
||||
|
||||
Try
|
||||
days = CInt(SQL.DLookup("nctsr_dauer_in_tagen", "tblNTCSRouten", "[nctsr_von]='" & departure & "' AND [nctsr_nach]= '" & destinationShortcut & "' AND [nctsr_route]= 'Landweg' AND [nctsr_transportmittel]= '" & transportmittel & "'", "VERAG", -1))
|
||||
days = CInt(SQL.DLookup("nctsr_dauer_in_tagen", "tblNTCSRouten", "[nctsr_von]='" & departure & "' AND [nctsr_nach]= '" & destinationShortcut & "' AND [nctsr_route]= 'Landweg' AND [nctsr_transportmittel]= '" & transportmittel & "'", "VERAG", 0))
|
||||
Catch ex As Exception
|
||||
VERAG_PROG_ALLGEMEIN.cErrorHandler.ERR(ex.Message, ex.StackTrace, System.Reflection.MethodInfo.GetCurrentMethod.Name)
|
||||
End Try
|
||||
@@ -101,8 +105,7 @@ Public Class frmRoutendauerBerechnen
|
||||
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
|
||||
|
||||
calculatedDate = CDate(txbVoraussichtlichesEintreffen._value)
|
||||
' Close()
|
||||
'btnOK.DialogResult = DialogResult.OK
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
|
||||
@@ -113,12 +116,10 @@ Public Class frmRoutendauerBerechnen
|
||||
|
||||
If checkIfDepartureDateIsFilled() = False Then Exit Sub
|
||||
|
||||
|
||||
days = calculateTripDuration()
|
||||
days = lookUpTripDuration()
|
||||
calcDays = days
|
||||
|
||||
|
||||
If days > 0 Then
|
||||
If days >= 0 Then
|
||||
addDaysToGivenDate(txbAbgangsdatum, days)
|
||||
End If
|
||||
|
||||
@@ -139,12 +140,13 @@ Public Class frmRoutendauerBerechnen
|
||||
|
||||
|
||||
Else
|
||||
|
||||
lblWarning.Visible = False
|
||||
isFilled = True
|
||||
lblDauer.Visible = True
|
||||
btnOK.DialogResult = DialogResult.OK
|
||||
|
||||
calcDuration()
|
||||
|
||||
|
||||
|
||||
End If
|
||||
@@ -177,7 +179,7 @@ Public Class frmRoutendauerBerechnen
|
||||
End Function
|
||||
|
||||
|
||||
Function calcDuration()
|
||||
Function calcDuration() As Integer
|
||||
Dim result As Integer = 0
|
||||
|
||||
If txbVoraussichtlichesEintreffen._value <> "" Then
|
||||
@@ -186,12 +188,14 @@ Public Class frmRoutendauerBerechnen
|
||||
result = (EndDate - StartDate).Days
|
||||
If (result < 0) Then
|
||||
MsgBox("Transportdauer kann nicht negativ sein!")
|
||||
|
||||
btnOK.DialogResult = DialogResult.None
|
||||
Else
|
||||
|
||||
btnOK.DialogResult = DialogResult.OK
|
||||
End If
|
||||
End If
|
||||
Return result
|
||||
Return result
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Reference in New Issue
Block a user