vermerke
This commit is contained in:
@@ -25,18 +25,10 @@ Public Class frmAddSendungsvermerkShort
|
||||
Private ReadOnly _bereichByCodeId As New Dictionary(Of Integer, Integer)
|
||||
Private _selectedDocumentCodeId As Integer = 0
|
||||
Private _isLoadingDocumentEditor As Boolean = False
|
||||
Private pnlDocumentEditor As Panel
|
||||
Private lblDocumentEditorTitle As Label
|
||||
Private lblDocumentEditorName As Label
|
||||
Private txtDocumentEditorName As TextBox
|
||||
Private lblDocumentEditorAnhangsart As Label
|
||||
Private cmbDocumentEditorAnhangsart As ComboBox
|
||||
Private lblDocumentEditorInfo As Label
|
||||
Private txtDocumentEditorInfo As TextBox
|
||||
Private lblDocumentEditorStatus As Label
|
||||
Private Const DefaultDocumentBaseText As String = "Bitte das Dokument hochladen."
|
||||
Private Const BereichDokumentMain As Integer = 1
|
||||
Private Const BereichAngefordert As Integer = 2
|
||||
Private _dokumentanforderungState As New frmSendungsDokumentanforderung.DokumentanforderungState()
|
||||
|
||||
Dim Neuanlage As Boolean = False
|
||||
Dim hStatus As Integer
|
||||
@@ -87,16 +79,17 @@ Public Class frmAddSendungsvermerkShort
|
||||
End Sub
|
||||
|
||||
Private Sub frmEintragVermerk_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein._TRANSLATE(Me)
|
||||
'cboDokumente.Items.Clear()
|
||||
' cboDokumente.Items.Add(New MyListItem("nachgefordert", CStr(0)))
|
||||
'cboDokumente.Items.Add(New MyListItem("erhalten", CStr(1)))
|
||||
'cboDokumente.SelectedIndex = 0
|
||||
|
||||
Me.CenterToParent()
|
||||
If My.Computer.Screen.WorkingArea.Height < Me.Height Then
|
||||
Me.Height = My.Computer.Screen.WorkingArea.Height
|
||||
Dim pt As Point = Cursor.Position
|
||||
Dim screenBounds As Rectangle = Screen.FromPoint(pt).WorkingArea
|
||||
If pt.X + Me.Width > screenBounds.Right Then
|
||||
pt.X = screenBounds.Right - Me.Width
|
||||
End If
|
||||
If pt.Y + Me.Height > screenBounds.Bottom Then
|
||||
pt.Y = screenBounds.Bottom - Me.Height
|
||||
End If
|
||||
Me.Location = pt
|
||||
|
||||
VERAG_PROG_ALLGEMEIN.cAllgemein._TRANSLATE(Me)
|
||||
|
||||
If cmbCustomerUploadLanguage IsNot Nothing Then
|
||||
If cmbCustomerUploadLanguage.SelectedIndex < 0 Then
|
||||
@@ -109,6 +102,8 @@ Public Class frmAddSendungsvermerkShort
|
||||
End If
|
||||
End If
|
||||
|
||||
InitializeDocumentEditor()
|
||||
|
||||
For Each c In Me.Controls
|
||||
If c.GetType.Name.ToString = "RadioButton" Then
|
||||
AddHandler DirectCast(c, RadioButton).CheckedChanged, AddressOf selectionChanged
|
||||
@@ -123,6 +118,8 @@ Public Class frmAddSendungsvermerkShort
|
||||
End If
|
||||
|
||||
SetupDynamicAnforderungCheckboxes()
|
||||
_dokumentanforderungState = BuildDokumentanforderungState()
|
||||
SetDokumentbereichVisible(False)
|
||||
|
||||
hStatus = myAviso.Status
|
||||
If hStatus = cGlobal.Status_Vorbereitet Or hStatus = cGlobal.Status_Vorgeschrieben Or hStatus = cGlobal.Status_Erfasst Then
|
||||
@@ -156,6 +153,33 @@ Public Class frmAddSendungsvermerkShort
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub InitializeDocumentEditor()
|
||||
If txtDocumentEditorName IsNot Nothing Then
|
||||
RemoveHandler txtDocumentEditorName.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
AddHandler txtDocumentEditorName.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
End If
|
||||
|
||||
If txtDocumentEditorInfo IsNot Nothing Then
|
||||
RemoveHandler txtDocumentEditorInfo.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
AddHandler txtDocumentEditorInfo.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
End If
|
||||
|
||||
EnsureAnhangsartenOptionsLoaded()
|
||||
|
||||
If cmbDocumentEditorAnhangsart IsNot Nothing Then
|
||||
RemoveHandler cmbDocumentEditorAnhangsart.SelectedIndexChanged, AddressOf DocumentEditorAnhangsartChanged
|
||||
cmbDocumentEditorAnhangsart.BeginUpdate()
|
||||
cmbDocumentEditorAnhangsart.Items.Clear()
|
||||
For Each optionItem In _anhangsartenOptions
|
||||
cmbDocumentEditorAnhangsart.Items.Add(optionItem)
|
||||
Next
|
||||
cmbDocumentEditorAnhangsart.EndUpdate()
|
||||
AddHandler cmbDocumentEditorAnhangsart.SelectedIndexChanged, AddressOf DocumentEditorAnhangsartChanged
|
||||
End If
|
||||
|
||||
ClearDocumentEditor()
|
||||
End Sub
|
||||
|
||||
Private Sub SetupDynamicAnforderungCheckboxes()
|
||||
_anforderungCheckboxes.Clear()
|
||||
_anhangsartIdByCheckbox.Clear()
|
||||
@@ -185,44 +209,8 @@ Public Class frmAddSendungsvermerkShort
|
||||
End If
|
||||
EnsureAnhangsartenOptionsLoaded()
|
||||
|
||||
Dim docsLeft = Label1.Left + 3
|
||||
Dim docsTop = Label1.Bottom + 6
|
||||
Dim docsWidth = PictureBox1.Width - (docsLeft * 2)
|
||||
Dim docsMainHeight = Math.Max(10, cbxSonstDok.Top - docsTop - 6)
|
||||
Dim docsMainPanel = CreateAnforderungFlowPanel("flpDokumenteFehlenMain", docsLeft, docsTop, docsWidth, docsMainHeight, Color.WhiteSmoke)
|
||||
docsMainPanel.FlowDirection = FlowDirection.LeftToRight
|
||||
docsMainPanel.WrapContents = True
|
||||
|
||||
Dim docsExtraFound = pnlSendungsVermker.Controls.Find("flpDokumenteFehlenExtra", True)
|
||||
If docsExtraFound IsNot Nothing AndAlso docsExtraFound.Length > 0 Then
|
||||
Dim docsExtraPanel = TryCast(docsExtraFound(0), FlowLayoutPanel)
|
||||
If docsExtraPanel IsNot Nothing Then
|
||||
docsExtraPanel.Visible = False
|
||||
docsExtraPanel.Controls.Clear()
|
||||
End If
|
||||
End If
|
||||
|
||||
PositionDocumentEditorAndUpload()
|
||||
|
||||
Dim lblSonstigeVermerke As Label = TryCast(pnlSendungsVermker.Controls.Find("lblSonstigeVermerke", True).FirstOrDefault(), Label)
|
||||
If lblSonstigeVermerke Is Nothing Then
|
||||
lblSonstigeVermerke = New Label()
|
||||
lblSonstigeVermerke.Name = "lblSonstigeVermerke"
|
||||
lblSonstigeVermerke.Text = "Sonstige Vermerke:"
|
||||
lblSonstigeVermerke.Font = New Font("Microsoft Sans Serif", 10.0!, FontStyle.Bold)
|
||||
lblSonstigeVermerke.AutoSize = True
|
||||
lblSonstigeVermerke.BackColor = Color.White
|
||||
pnlSendungsVermker.Controls.Add(lblSonstigeVermerke)
|
||||
End If
|
||||
lblSonstigeVermerke.Left = docsLeft
|
||||
lblSonstigeVermerke.Top = PictureBox1.Bottom + 8
|
||||
lblSonstigeVermerke.BringToFront()
|
||||
|
||||
Dim anforderungLeft = docsLeft
|
||||
Dim anforderungTop = lblSonstigeVermerke.Bottom + 6
|
||||
Dim anforderungWidth = pnlSendungsVermker.Width - (anforderungLeft * 2)
|
||||
Dim anforderungHeight = 198
|
||||
Dim anforderungPanel = CreateAnforderungFlowPanel("flpAngefordert", anforderungLeft, anforderungTop, anforderungWidth, anforderungHeight, Color.White)
|
||||
flpDokumenteFehlenMain.Controls.Clear()
|
||||
flpAngefordert.Controls.Clear()
|
||||
|
||||
For Each row As DataRow In dt.Rows
|
||||
Dim id As Integer
|
||||
@@ -245,7 +233,7 @@ Public Class frmAddSendungsvermerkShort
|
||||
Dim cb As New CheckBox()
|
||||
cb.Text = frontendBezeichnung
|
||||
cb.Tag = id
|
||||
cb.Margin = New Padding(0, 0, 8, 2)
|
||||
cb.Margin = New Padding(0, 0, 4, 0)
|
||||
AddHandler cb.CheckedChanged, AddressOf DynamicAnforderungCheckboxChanged
|
||||
|
||||
If bezeichnung.ToLowerInvariant().Contains("nicht leserlich") Then
|
||||
@@ -274,256 +262,46 @@ Public Class frmAddSendungsvermerkShort
|
||||
_bereichByCodeId(id) = bereich
|
||||
|
||||
If bereich = BereichDokumentMain Then
|
||||
cb.BackColor = Color.WhiteSmoke
|
||||
cb.BackColor = Color.Transparent
|
||||
cb.UseVisualStyleBackColor = False
|
||||
ConfigureAnforderungCheckbox(cb, docsMainPanel)
|
||||
docsMainPanel.Controls.Add(cb)
|
||||
ConfigureAnforderungCheckbox(cb, flpDokumenteFehlenMain)
|
||||
flpDokumenteFehlenMain.Controls.Add(cb)
|
||||
Else
|
||||
ConfigureAnforderungCheckbox(cb, anforderungPanel)
|
||||
anforderungPanel.Controls.Add(cb)
|
||||
ConfigureAnforderungCheckbox(cb, flpAngefordert)
|
||||
flpAngefordert.Controls.Add(cb)
|
||||
End If
|
||||
|
||||
_anforderungCheckboxes.Add(cb)
|
||||
Next
|
||||
|
||||
ArrangeSections(docsMainPanel, anforderungPanel)
|
||||
cbxSonstDok.BringToFront()
|
||||
txtSonstigesDokumentFehlt.BringToFront()
|
||||
cbxNichtLeserlich.BringToFront()
|
||||
lblErrDokument.BringToFront()
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function CreateAnforderungFlowPanel(name As String, left As Integer, top As Integer, width As Integer, height As Integer, backColor As Color) As FlowLayoutPanel
|
||||
Dim found = pnlSendungsVermker.Controls.Find(name, True)
|
||||
If found IsNot Nothing AndAlso found.Length > 0 Then
|
||||
Dim existing = TryCast(found(0), FlowLayoutPanel)
|
||||
If existing IsNot Nothing Then
|
||||
existing.Left = left
|
||||
existing.Top = top
|
||||
existing.Width = width
|
||||
existing.Height = height
|
||||
existing.BackColor = backColor
|
||||
existing.FlowDirection = FlowDirection.TopDown
|
||||
existing.WrapContents = True
|
||||
existing.AutoScroll = True
|
||||
existing.Controls.Clear()
|
||||
existing.BringToFront()
|
||||
Return existing
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim flp As New FlowLayoutPanel()
|
||||
flp.Name = name
|
||||
flp.Left = left
|
||||
flp.Top = top
|
||||
flp.Width = width
|
||||
flp.Height = height
|
||||
flp.FlowDirection = FlowDirection.TopDown
|
||||
flp.WrapContents = True
|
||||
flp.AutoScroll = True
|
||||
flp.BackColor = backColor
|
||||
flp.Padding = New Padding(0)
|
||||
flp.Margin = New Padding(0)
|
||||
pnlSendungsVermker.Controls.Add(flp)
|
||||
flp.BringToFront()
|
||||
Return flp
|
||||
End Function
|
||||
|
||||
Private Sub ConfigureAnforderungCheckbox(cb As CheckBox, container As Control)
|
||||
If cb Is Nothing OrElse container Is Nothing Then Return
|
||||
|
||||
cb.AutoSize = False
|
||||
cb.Height = 20
|
||||
cb.Height = 18
|
||||
|
||||
Dim cols As Integer = 2
|
||||
Dim colGap As Integer = 14
|
||||
Dim minCbWidth As Integer = 120
|
||||
If String.Equals(container.Name, "flpDokumenteFehlenMain", StringComparison.OrdinalIgnoreCase) Then
|
||||
cols = 3
|
||||
colGap = 8
|
||||
minCbWidth = 150
|
||||
colGap = 2
|
||||
minCbWidth = 80
|
||||
ElseIf String.Equals(container.Name, "flpAngefordert", StringComparison.OrdinalIgnoreCase) Then
|
||||
cols = 2
|
||||
colGap = 14
|
||||
minCbWidth = 180
|
||||
End If
|
||||
Dim usableWidth = Math.Max(120, container.Width - 12)
|
||||
|
||||
Dim usableWidth = Math.Max(120, container.Width - 20)
|
||||
Dim cbWidth = CInt(Math.Floor((usableWidth - ((cols - 1) * colGap)) / cols))
|
||||
cb.Width = Math.Max(minCbWidth, cbWidth)
|
||||
End Sub
|
||||
|
||||
Private Sub PositionDocumentEditorAndUpload()
|
||||
EnsureDocumentEditorControls()
|
||||
|
||||
Dim topSectionBottom = Math.Max(cbxSonstDok.Bottom, lblErrDokument.Bottom)
|
||||
|
||||
pnlDocumentEditor.Left = 8
|
||||
pnlDocumentEditor.Top = topSectionBottom + 12
|
||||
pnlDocumentEditor.Width = pnlSendungsVermker.Width - 16
|
||||
pnlDocumentEditor.Height = 152
|
||||
pnlDocumentEditor.BackColor = Color.WhiteSmoke
|
||||
pnlDocumentEditor.BringToFront()
|
||||
|
||||
Label5.Top = pnlDocumentEditor.Bottom + 8
|
||||
Label5.BackColor = Color.WhiteSmoke
|
||||
Label5.BringToFront()
|
||||
|
||||
Label20.Left = Label5.Right + 10
|
||||
Label20.Top = Label5.Top + 2
|
||||
Label20.BackColor = Color.WhiteSmoke
|
||||
Label20.AutoSize = True
|
||||
Label20.ForeColor = Color.FromArgb(0, 102, 153)
|
||||
Label20.Text = "Bitte zuerst Dokument(e) oben auswählen."
|
||||
Label20.BringToFront()
|
||||
|
||||
lblCustomerUploadLanguage.Top = Label5.Bottom + 10
|
||||
lblCustomerUploadLanguage.BackColor = Color.WhiteSmoke
|
||||
lblCustomerUploadLanguage.BringToFront()
|
||||
cmbCustomerUploadLanguage.Top = lblCustomerUploadLanguage.Top - 3
|
||||
cmbCustomerUploadLanguage.BringToFront()
|
||||
|
||||
lblCustomerUploadValidityHours.Top = lblCustomerUploadLanguage.Top
|
||||
lblCustomerUploadValidityHours.BackColor = Color.WhiteSmoke
|
||||
lblCustomerUploadValidityHours.BringToFront()
|
||||
nudCustomerUploadValidityHours.Top = lblCustomerUploadLanguage.Top - 2
|
||||
nudCustomerUploadValidityHours.BringToFront()
|
||||
|
||||
btnCustomerUploadLink.Top = lblCustomerUploadLanguage.Top - 4
|
||||
btnCustomerUploadLink.BringToFront()
|
||||
|
||||
lblCustomerUploadEmail.Top = lblCustomerUploadLanguage.Top + 26
|
||||
lblCustomerUploadEmail.BackColor = Color.WhiteSmoke
|
||||
lblCustomerUploadEmail.BringToFront()
|
||||
txtCustomerUploadEmail.Top = lblCustomerUploadEmail.Top - 3
|
||||
txtCustomerUploadEmail.BringToFront()
|
||||
|
||||
btnCustomerUploadEmail.Top = txtCustomerUploadEmail.Top - 2
|
||||
btnCustomerUploadEmail.BringToFront()
|
||||
|
||||
lblCustomerUploadEmailText.Top = lblCustomerUploadEmail.Top + 22
|
||||
lblCustomerUploadEmailText.BackColor = Color.WhiteSmoke
|
||||
lblCustomerUploadEmailText.BringToFront()
|
||||
txtCustomerUploadEmailText.Top = lblCustomerUploadEmailText.Top - 3
|
||||
txtCustomerUploadEmailText.BringToFront()
|
||||
|
||||
pnlCustomerUploadSeparator.Visible = False
|
||||
|
||||
PictureBox1.Height = txtCustomerUploadEmailText.Bottom + 12
|
||||
End Sub
|
||||
|
||||
Private Sub ArrangeSections(docsMainPanel As FlowLayoutPanel, anforderungPanel As FlowLayoutPanel)
|
||||
If docsMainPanel Is Nothing OrElse anforderungPanel Is Nothing Then Return
|
||||
|
||||
Label13.Top = anforderungPanel.Bottom + 14
|
||||
PictureBox4.Top = Label13.Top - 10
|
||||
|
||||
optSpeditionWeitergeleitet.Top = Label13.Bottom + 10
|
||||
txtSpedition.Top = optSpeditionWeitergeleitet.Top - 2
|
||||
Label2.Top = optSpeditionWeitergeleitet.Top - 18
|
||||
Label3.Top = optSpeditionWeitergeleitet.Top + 1
|
||||
lblErrSpedition.Top = Label2.Top
|
||||
|
||||
optFreierText.Top = optSpeditionWeitergeleitet.Bottom + 9
|
||||
txtFreierText.Top = optFreierText.Top - 2
|
||||
Label17.Top = txtFreierText.Bottom + 4
|
||||
Label9.Top = Label17.Top
|
||||
lblErrGrund.Top = Label17.Top
|
||||
|
||||
Label4.Top = Label17.Bottom + 14
|
||||
optFremd_SendungAvisiert.Top = Label4.Bottom + 7
|
||||
optFremd_ATB.Top = optFremd_SendungAvisiert.Bottom + 6
|
||||
optATAangefordert.Top = optFremd_ATB.Top
|
||||
|
||||
PictureBox4.Height = (optFremd_ATB.Bottom + 12) - PictureBox4.Top
|
||||
|
||||
lblZustzlFreitext.Top = PictureBox4.Bottom + 8
|
||||
txtDetail.Top = lblZustzlFreitext.Bottom + 4
|
||||
btnOK.Top = txtDetail.Top
|
||||
lblErr240Zeichen.Top = txtDetail.Top - 16
|
||||
|
||||
Dim contentBottom = Math.Max(btnOK.Bottom, txtDetail.Bottom) + 12
|
||||
pnlSendungsVermker.Height = contentBottom
|
||||
pnlMain.Height = contentBottom
|
||||
Me.ClientSize = New Size(Me.ClientSize.Width, contentBottom)
|
||||
End Sub
|
||||
|
||||
Private flpDocumentTabs As FlowLayoutPanel
|
||||
|
||||
Private Sub EnsureDocumentEditorControls()
|
||||
If pnlDocumentEditor IsNot Nothing Then Return
|
||||
|
||||
pnlDocumentEditor = New Panel()
|
||||
pnlDocumentEditor.BackColor = Color.WhiteSmoke
|
||||
pnlDocumentEditor.BorderStyle = BorderStyle.FixedSingle
|
||||
pnlSendungsVermker.Controls.Add(pnlDocumentEditor)
|
||||
|
||||
flpDocumentTabs = New FlowLayoutPanel()
|
||||
flpDocumentTabs.Location = New Point(0, 0)
|
||||
flpDocumentTabs.Width = pnlDocumentEditor.Width
|
||||
flpDocumentTabs.Height = 50
|
||||
flpDocumentTabs.BackColor = Color.FromArgb(220, 220, 220)
|
||||
flpDocumentTabs.WrapContents = False
|
||||
flpDocumentTabs.AutoScroll = True
|
||||
flpDocumentTabs.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
|
||||
pnlDocumentEditor.Controls.Add(flpDocumentTabs)
|
||||
|
||||
lblDocumentEditorTitle = New Label()
|
||||
lblDocumentEditorTitle.AutoSize = True
|
||||
lblDocumentEditorTitle.Font = New Font("Microsoft Sans Serif", 8.25!, FontStyle.Bold, GraphicsUnit.Point, CType(0, Byte))
|
||||
lblDocumentEditorTitle.Location = New Point(8, 58)
|
||||
lblDocumentEditorTitle.Text = "Dokumentdetails"
|
||||
pnlDocumentEditor.Controls.Add(lblDocumentEditorTitle)
|
||||
|
||||
lblDocumentEditorName = New Label()
|
||||
lblDocumentEditorName.AutoSize = True
|
||||
lblDocumentEditorName.Location = New Point(8, 80)
|
||||
lblDocumentEditorName.Text = "Dokumentname:"
|
||||
pnlDocumentEditor.Controls.Add(lblDocumentEditorName)
|
||||
|
||||
txtDocumentEditorName = New TextBox()
|
||||
txtDocumentEditorName.BackColor = Color.White
|
||||
txtDocumentEditorName.Location = New Point(110, 77)
|
||||
txtDocumentEditorName.MaxLength = 120
|
||||
txtDocumentEditorName.Size = New Size(128, 20)
|
||||
AddHandler txtDocumentEditorName.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
pnlDocumentEditor.Controls.Add(txtDocumentEditorName)
|
||||
|
||||
lblDocumentEditorAnhangsart = New Label()
|
||||
lblDocumentEditorAnhangsart.AutoSize = True
|
||||
lblDocumentEditorAnhangsart.Location = New Point(248, 80)
|
||||
lblDocumentEditorAnhangsart.Text = "Anhangsart:"
|
||||
pnlDocumentEditor.Controls.Add(lblDocumentEditorAnhangsart)
|
||||
|
||||
cmbDocumentEditorAnhangsart = New ComboBox()
|
||||
cmbDocumentEditorAnhangsart.BackColor = Color.White
|
||||
cmbDocumentEditorAnhangsart.DropDownStyle = ComboBoxStyle.DropDownList
|
||||
cmbDocumentEditorAnhangsart.Location = New Point(320, 77)
|
||||
cmbDocumentEditorAnhangsart.Size = New Size(124, 21)
|
||||
EnsureAnhangsartenOptionsLoaded()
|
||||
For Each o In _anhangsartenOptions
|
||||
cmbDocumentEditorAnhangsart.Items.Add(o)
|
||||
Next
|
||||
AddHandler cmbDocumentEditorAnhangsart.SelectedIndexChanged, AddressOf DocumentEditorAnhangsartChanged
|
||||
pnlDocumentEditor.Controls.Add(cmbDocumentEditorAnhangsart)
|
||||
|
||||
lblDocumentEditorInfo = New Label()
|
||||
lblDocumentEditorInfo.AutoSize = True
|
||||
lblDocumentEditorInfo.Location = New Point(8, 104)
|
||||
lblDocumentEditorInfo.Text = "Dokument Info:"
|
||||
pnlDocumentEditor.Controls.Add(lblDocumentEditorInfo)
|
||||
|
||||
txtDocumentEditorInfo = New TextBox()
|
||||
txtDocumentEditorInfo.BackColor = Color.White
|
||||
txtDocumentEditorInfo.Location = New Point(110, 101)
|
||||
txtDocumentEditorInfo.MaxLength = 500
|
||||
txtDocumentEditorInfo.Size = New Size(334, 20)
|
||||
txtDocumentEditorInfo.Text = DefaultDocumentBaseText
|
||||
AddHandler txtDocumentEditorInfo.TextChanged, AddressOf DocumentEditorInputChanged
|
||||
pnlDocumentEditor.Controls.Add(txtDocumentEditorInfo)
|
||||
|
||||
lblDocumentEditorStatus = New Label()
|
||||
lblDocumentEditorStatus.AutoSize = True
|
||||
lblDocumentEditorStatus.ForeColor = Color.FromArgb(0, 102, 153)
|
||||
lblDocumentEditorStatus.Location = New Point(8, 128)
|
||||
lblDocumentEditorStatus.Text = "Wählen Sie ein Dokument, um Name und Dokument Info anzupassen."
|
||||
pnlDocumentEditor.Controls.Add(lblDocumentEditorStatus)
|
||||
cb.Width = Math.Max(minCbWidth, Math.Min(cbWidth, 220))
|
||||
End Sub
|
||||
|
||||
Private Sub DocumentEditorInputChanged(sender As Object, e As EventArgs)
|
||||
@@ -845,8 +623,6 @@ Public Class frmAddSendungsvermerkShort
|
||||
End Sub
|
||||
|
||||
Private Sub LoadDocumentEditorForCheckbox(cb As CheckBox)
|
||||
EnsureDocumentEditorControls()
|
||||
|
||||
Dim codeId As Integer = 0
|
||||
If Not TryGetCheckboxCodeId(cb, codeId) Then
|
||||
_selectedDocumentCodeId = 0
|
||||
@@ -986,6 +762,145 @@ Public Class frmAddSendungsvermerkShort
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub SetDokumentbereichVisible(visible As Boolean)
|
||||
flpDokumenteFehlenMain.Visible = visible
|
||||
pnlDocumentEditor.Visible = visible
|
||||
Label5.Visible = visible
|
||||
txtSonstigesDokumentFehlt.Visible = visible
|
||||
btnCustomerUploadLink.Visible = visible
|
||||
btnCustomerUploadEmail.Visible = visible
|
||||
txtCustomerUploadEmail.Visible = visible
|
||||
lblCustomerUploadEmail.Visible = visible
|
||||
lblCustomerUploadValidityHours.Visible = visible
|
||||
nudCustomerUploadValidityHours.Visible = visible
|
||||
cmbCustomerUploadLanguage.Visible = visible
|
||||
lblCustomerUploadLanguage.Visible = visible
|
||||
txtCustomerUploadEmailText.Visible = visible
|
||||
lblCustomerUploadEmailText.Visible = visible
|
||||
Label20.Visible = visible
|
||||
cbxNichtLeserlich.Visible = visible
|
||||
cbxSonstDok.Visible = visible
|
||||
lblErrDokument.Visible = False
|
||||
If PictureBox1 IsNot Nothing Then
|
||||
PictureBox1.Visible = visible
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function BuildDokumentanforderungState() As frmSendungsDokumentanforderung.DokumentanforderungState
|
||||
Dim result As New frmSendungsDokumentanforderung.DokumentanforderungState()
|
||||
result.SelectedCodeIds = New List(Of Integer)
|
||||
For Each cb In _anforderungCheckboxes
|
||||
Dim codeId As Integer = 0
|
||||
If cb IsNot Nothing AndAlso cb.Checked AndAlso Integer.TryParse(If(cb.Tag, "").ToString(), codeId) Then
|
||||
If _bereichByCodeId.ContainsKey(codeId) AndAlso _bereichByCodeId(codeId) = BereichDokumentMain Then
|
||||
result.SelectedCodeIds.Add(codeId)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
result.SelectedAnhangsartIdByCodeId = New Dictionary(Of Integer, Integer)(_selectedAnhangsartIdByCodeId)
|
||||
result.DocumentCustomNameByCodeId = New Dictionary(Of Integer, String)(_documentCustomNameByCodeId)
|
||||
result.DocumentBaseTextByCodeId = New Dictionary(Of Integer, String)(_documentBaseTextByCodeId)
|
||||
result.SonstDokChecked = cbxSonstDok.Checked
|
||||
result.SonstigesDokumentName = If(txtSonstigesDokumentFehlt.Text, "").Trim()
|
||||
result.NichtLeserlichChecked = cbxNichtLeserlich.Checked
|
||||
result.CustomerUploadEmail = If(txtCustomerUploadEmail.Text, "").Trim()
|
||||
result.CustomerUploadLanguage = If(TryCast(cmbCustomerUploadLanguage.SelectedItem, String), If(cmbCustomerUploadLanguage.Text, "").Trim())
|
||||
result.CustomerUploadEmailText = If(txtCustomerUploadEmailText.Text, "").Trim()
|
||||
result.CustomerUploadValidityHours = CInt(nudCustomerUploadValidityHours.Value)
|
||||
Return result
|
||||
End Function
|
||||
|
||||
Private Function InsertNurDokumentVermerk() As Boolean
|
||||
Dim dokumentVermerkGesetzt As Boolean = False
|
||||
|
||||
For Each cb In _anforderungCheckboxes
|
||||
If cb Is Nothing OrElse Not cb.Checked Then Continue For
|
||||
Dim codeId As Integer = 0
|
||||
If Not Integer.TryParse(If(cb.Tag, "").ToString(), codeId) Then Continue For
|
||||
If Not _bereichByCodeId.ContainsKey(codeId) OrElse _bereichByCodeId(codeId) <> BereichDokumentMain Then Continue For
|
||||
|
||||
Dim text = ""
|
||||
If _backendBezeichnungByCodeId.ContainsKey(codeId) Then
|
||||
text = If(_backendBezeichnungByCodeId(codeId), "").Trim()
|
||||
End If
|
||||
If text = "" Then text = cb.Text.Trim()
|
||||
|
||||
Dim sendText = txtSendung.Text.Trim()
|
||||
If text <> "" AndAlso sendText <> "" AndAlso InStr(text, "sendung", CompareMethod.Text) = 0 Then
|
||||
text &= " bei Sendung '" & sendText & "'"
|
||||
End If
|
||||
|
||||
If text <> "" Then
|
||||
insertSendungsVermerk(SendungID, myAviso.AvisoID, text, codeId)
|
||||
dokumentVermerkGesetzt = True
|
||||
End If
|
||||
Next
|
||||
|
||||
If cbxSonstDok.Checked Then
|
||||
If txtSonstigesDokumentFehlt.Text.Trim = "" Then
|
||||
lblErrDokument.Visible = True
|
||||
txtSonstigesDokumentFehlt.Focus()
|
||||
Return False
|
||||
End If
|
||||
insertSendungsVermerk(SendungID, myAviso.AvisoID, "Dokument '" & txtSonstigesDokumentFehlt.Text.Trim & "' fehlt - angefordert.", 25)
|
||||
dokumentVermerkGesetzt = True
|
||||
End If
|
||||
|
||||
If cbxNichtLeserlich.Checked Then
|
||||
insertSendungsVermerk(SendungID, myAviso.AvisoID, "Dokument(e) nachgefordert, da nicht leserlich.", 42)
|
||||
dokumentVermerkGesetzt = True
|
||||
End If
|
||||
|
||||
If Not dokumentVermerkGesetzt Then
|
||||
lblErrDokument.Visible = True
|
||||
Return False
|
||||
End If
|
||||
|
||||
Return True
|
||||
End Function
|
||||
|
||||
Private Sub ApplyDokumentanforderungState(state As frmSendungsDokumentanforderung.DokumentanforderungState)
|
||||
If state Is Nothing Then Return
|
||||
_selectedAnhangsartIdByCodeId.Clear()
|
||||
_documentCustomNameByCodeId.Clear()
|
||||
_documentBaseTextByCodeId.Clear()
|
||||
For Each kvp In state.SelectedAnhangsartIdByCodeId
|
||||
_selectedAnhangsartIdByCodeId(kvp.Key) = kvp.Value
|
||||
Next
|
||||
For Each kvp In state.DocumentCustomNameByCodeId
|
||||
_documentCustomNameByCodeId(kvp.Key) = kvp.Value
|
||||
Next
|
||||
For Each kvp In state.DocumentBaseTextByCodeId
|
||||
_documentBaseTextByCodeId(kvp.Key) = kvp.Value
|
||||
Next
|
||||
|
||||
For Each cb In _anforderungCheckboxes
|
||||
Dim codeId As Integer = 0
|
||||
If cb Is Nothing Then Continue For
|
||||
If Not Integer.TryParse(If(cb.Tag, "").ToString(), codeId) Then Continue For
|
||||
If _bereichByCodeId.ContainsKey(codeId) AndAlso _bereichByCodeId(codeId) = BereichDokumentMain Then
|
||||
cb.Checked = state.SelectedCodeIds.Contains(codeId)
|
||||
End If
|
||||
Next
|
||||
|
||||
cbxSonstDok.Checked = state.SonstDokChecked
|
||||
txtSonstigesDokumentFehlt.Text = If(state.SonstigesDokumentName, "")
|
||||
cbxNichtLeserlich.Checked = state.NichtLeserlichChecked
|
||||
txtCustomerUploadEmail.Text = If(state.CustomerUploadEmail, "")
|
||||
txtCustomerUploadEmailText.Text = If(state.CustomerUploadEmailText, "")
|
||||
|
||||
Dim targetValidity = Math.Max(CInt(nudCustomerUploadValidityHours.Minimum), Math.Min(CInt(nudCustomerUploadValidityHours.Maximum), state.CustomerUploadValidityHours))
|
||||
nudCustomerUploadValidityHours.Value = targetValidity
|
||||
|
||||
Dim language = If(state.CustomerUploadLanguage, "").Trim()
|
||||
Dim languageIdx = cmbCustomerUploadLanguage.Items.IndexOf(language)
|
||||
If languageIdx >= 0 Then
|
||||
cmbCustomerUploadLanguage.SelectedIndex = languageIdx
|
||||
End If
|
||||
|
||||
SyncTabs()
|
||||
End Sub
|
||||
|
||||
' Private Sub btnAbbruch_Click(sender As System.Object, e As System.EventArgs) Handles btnAbbruch.Click
|
||||
' Me.Close()
|
||||
' End Sub
|
||||
@@ -1193,18 +1108,53 @@ Public Class frmAddSendungsvermerkShort
|
||||
|
||||
|
||||
Private Sub frmAddSendungsvermerk_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
Dim p = Cursor.Position
|
||||
If (p.X + Me.Width) > My.Computer.Screen.WorkingArea.Width Then p.X = My.Computer.Screen.WorkingArea.Width - Me.Width
|
||||
If (p.Y + Me.Height) > My.Computer.Screen.WorkingArea.Height Then p.Y = My.Computer.Screen.WorkingArea.Height - Me.Height
|
||||
Me.Location = p '.Me.PointToClient(System.Cursor.Position)
|
||||
txtSendung.SelectionLength = 0
|
||||
txtFreierText.Focus()
|
||||
End Sub
|
||||
|
||||
' --- Dragging Logic ---
|
||||
Private drag As Boolean
|
||||
Private mouseX As Integer
|
||||
Private mouseY As Integer
|
||||
|
||||
Private Sub Form_MouseDown(sender As Object, e As MouseEventArgs) Handles lblDragIndicator.MouseDown
|
||||
If e.Button = MouseButtons.Left Then
|
||||
drag = True
|
||||
mouseX = Cursor.Position.X - Me.Left
|
||||
mouseY = Cursor.Position.Y - Me.Top
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Form_MouseMove(sender As Object, e As MouseEventArgs) Handles lblDragIndicator.MouseMove
|
||||
If drag Then
|
||||
Me.Top = Cursor.Position.Y - mouseY
|
||||
Me.Left = Cursor.Position.X - mouseX
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub Form_MouseUp(sender As Object, e As MouseEventArgs) Handles lblDragIndicator.MouseUp
|
||||
drag = False
|
||||
End Sub
|
||||
' ----------------------
|
||||
|
||||
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnCLose.Click
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub btnDokumtanforderung_Click(sender As Object, e As EventArgs) Handles btnDokumtanforderung.Click
|
||||
_dokumentanforderungState = BuildDokumentanforderungState()
|
||||
Using frm As New frmSendungsDokumentanforderung(AvisoID, SendungID, _dokumentanforderungState)
|
||||
If frm.ShowDialog(Me) = DialogResult.OK Then
|
||||
_dokumentanforderungState = frm.BuildState()
|
||||
ApplyDokumentanforderungState(_dokumentanforderungState)
|
||||
If InsertNurDokumentVermerk() Then
|
||||
frmHauptfenster.avisoAktualisierenAktiveIdBehalten(myAviso.AvisoID)
|
||||
Me.Close()
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
End Sub
|
||||
|
||||
Private Sub Button2_Click(sender As Object, e As EventArgs)
|
||||
If insertVermerke() Then
|
||||
VERAG_PROG_ALLGEMEIN.cAvisoBenachrichtigungen.INSERT_BENACHRICHTIGUNG(myAviso.AvisoID, SendungID, 1, "T", 13, , 1)
|
||||
|
||||
Reference in New Issue
Block a user