Verbesserung Vermerke

This commit is contained in:
2026-03-18 17:05:07 +01:00
parent 32f7ea288e
commit 41e7399640
2 changed files with 388 additions and 48 deletions

View File

@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("4.2.4.9")>
<Assembly: AssemblyFileVersion("4.2.4.9")>
<Assembly: AssemblyVersion("4.2.5.0")>
<Assembly: AssemblyFileVersion("4.2.5.0")>

View File

@@ -17,10 +17,12 @@ Public Class frmAddSendungsvermerkShort
Dim aktChanged As Boolean = False
Private ReadOnly _anforderungCheckboxes As New List(Of CheckBox)
Private ReadOnly _anhangsartIdByCheckbox As New Dictionary(Of CheckBox, Integer)
Private ReadOnly _backendBezeichnungByCodeId As New Dictionary(Of Integer, String)
Private ReadOnly _selectedAnhangsartIdByCodeId As New Dictionary(Of Integer, Integer)
Private ReadOnly _documentCustomNameByCodeId As New Dictionary(Of Integer, String)
Private ReadOnly _documentBaseTextByCodeId As New Dictionary(Of Integer, String)
Private ReadOnly _anhangsartenOptions As New List(Of AnhangsartOption)
Private ReadOnly _bereichByCodeId As New Dictionary(Of Integer, Integer)
Private _selectedDocumentCodeId As Integer = 0
Private _isLoadingDocumentEditor As Boolean = False
Private pnlDocumentEditor As Panel
@@ -157,16 +159,25 @@ Public Class frmAddSendungsvermerkShort
Private Sub SetupDynamicAnforderungCheckboxes()
_anforderungCheckboxes.Clear()
_anhangsartIdByCheckbox.Clear()
_backendBezeichnungByCodeId.Clear()
_selectedAnhangsartIdByCodeId.Clear()
_documentCustomNameByCodeId.Clear()
_documentBaseTextByCodeId.Clear()
_bereichByCodeId.Clear()
_selectedDocumentCodeId = 0
If flpDocumentTabs IsNot Nothing Then
flpDocumentTabs.Controls.Clear()
End If
Dim dt As DataTable = Nothing
Try
dt = AvisoDAL.loadDataTableBySQL("SELECT [VermerkCodeId],[Bezeichnung],[AvisoAnhangsartId],[AnforderungBereich] FROM [VermerkeCodes] WHERE [Anforderung]=1 ORDER BY [Bezeichnung]")
dt = AvisoDAL.loadDataTableBySQL("SELECT [VermerkCodeId],[Bezeichnung],[FrontendBezeichnung],[AvisoAnhangsartId],[AnforderungBereich] FROM [VermerkeCodes] WHERE [Anforderung]=1 ORDER BY [Bezeichnung]")
Catch
Return
Try
dt = AvisoDAL.loadDataTableBySQL("SELECT [VermerkCodeId],[Bezeichnung],[AvisoAnhangsartId],[AnforderungBereich] FROM [VermerkeCodes] WHERE [Anforderung]=1 ORDER BY [Bezeichnung]")
Catch
Return
End Try
End Try
If dt Is Nothing OrElse dt.Rows.Count = 0 Then
@@ -179,6 +190,8 @@ Public Class frmAddSendungsvermerkShort
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
@@ -189,10 +202,26 @@ Public Class frmAddSendungsvermerkShort
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 = PictureBox1.Bottom + 2
Dim anforderungTop = lblSonstigeVermerke.Bottom + 6
Dim anforderungWidth = pnlSendungsVermker.Width - (anforderungLeft * 2)
Dim anforderungHeight = Math.Max(10, Label13.Top - anforderungTop - 10)
Dim anforderungHeight = 198
Dim anforderungPanel = CreateAnforderungFlowPanel("flpAngefordert", anforderungLeft, anforderungTop, anforderungWidth, anforderungHeight, Color.White)
For Each row As DataRow In dt.Rows
@@ -205,9 +234,16 @@ Public Class frmAddSendungsvermerkShort
Dim bezeichnung = If(IsDBNull(row("Bezeichnung")), "", CStr(row("Bezeichnung"))).Trim()
If bezeichnung = "" Then Continue For
_backendBezeichnungByCodeId(id) = bezeichnung
Dim frontendBezeichnung = bezeichnung
If dt.Columns.Contains("FrontendBezeichnung") Then
frontendBezeichnung = If(IsDBNull(row("FrontendBezeichnung")), "", CStr(row("FrontendBezeichnung"))).Trim()
If frontendBezeichnung = "" Then frontendBezeichnung = bezeichnung
End If
Dim cb As New CheckBox()
cb.Text = bezeichnung
cb.Text = frontendBezeichnung
cb.Tag = id
cb.Margin = New Padding(0, 0, 8, 2)
AddHandler cb.CheckedChanged, AddressOf DynamicAnforderungCheckboxChanged
@@ -235,6 +271,7 @@ Public Class frmAddSendungsvermerkShort
End If
Catch
End Try
_bereichByCodeId(id) = bereich
If bereich = BereichDokumentMain Then
cb.BackColor = Color.WhiteSmoke
@@ -300,10 +337,75 @@ Public Class frmAddSendungsvermerkShort
cb.Height = 20
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
End If
Dim usableWidth = Math.Max(120, container.Width - 12)
Dim colGap = 14
Dim cbWidth = CInt(Math.Floor((usableWidth - ((cols - 1) * colGap)) / cols))
cb.Width = Math.Max(120, cbWidth)
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)
@@ -331,34 +433,7 @@ Public Class frmAddSendungsvermerkShort
PictureBox4.Height = (optFremd_ATB.Bottom + 12) - PictureBox4.Top
EnsureDocumentEditorControls()
pnlDocumentEditor.Left = 8
pnlDocumentEditor.Top = PictureBox4.Bottom + 8
pnlDocumentEditor.Width = pnlSendungsVermker.Width - 16
pnlDocumentEditor.Height = 102
Label5.Top = pnlDocumentEditor.Bottom + 8
Label20.Left = Label5.Right + 10
Label20.Top = Label5.Top + 2
Label20.AutoSize = True
Label20.ForeColor = Color.FromArgb(0, 102, 153)
Label20.Text = "Bitte zuerst Dokument(e) oben auswählen."
lblCustomerUploadLanguage.Top = Label5.Bottom + 10
cmbCustomerUploadLanguage.Top = lblCustomerUploadLanguage.Top - 3
lblCustomerUploadValidityHours.Top = lblCustomerUploadLanguage.Top
nudCustomerUploadValidityHours.Top = lblCustomerUploadLanguage.Top - 2
btnCustomerUploadLink.Top = lblCustomerUploadLanguage.Top - 4
lblCustomerUploadEmail.Top = lblCustomerUploadLanguage.Top + 26
txtCustomerUploadEmail.Top = lblCustomerUploadEmail.Top - 3
btnCustomerUploadEmail.Top = txtCustomerUploadEmail.Top - 2
lblCustomerUploadEmailText.Top = lblCustomerUploadEmail.Top + 22
txtCustomerUploadEmailText.Top = lblCustomerUploadEmailText.Top - 3
pnlCustomerUploadSeparator.Top = txtCustomerUploadEmailText.Bottom + 10
lblZustzlFreitext.Top = pnlCustomerUploadSeparator.Top + 8
lblZustzlFreitext.Top = PictureBox4.Bottom + 8
txtDetail.Top = lblZustzlFreitext.Bottom + 4
btnOK.Top = txtDetail.Top
lblErr240Zeichen.Top = txtDetail.Top - 16
@@ -369,6 +444,8 @@ Public Class frmAddSendungsvermerkShort
Me.ClientSize = New Size(Me.ClientSize.Width, contentBottom)
End Sub
Private flpDocumentTabs As FlowLayoutPanel
Private Sub EnsureDocumentEditorControls()
If pnlDocumentEditor IsNot Nothing Then Return
@@ -377,22 +454,32 @@ Public Class frmAddSendungsvermerkShort
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, 8)
lblDocumentEditorTitle.Location = New Point(8, 58)
lblDocumentEditorTitle.Text = "Dokumentdetails"
pnlDocumentEditor.Controls.Add(lblDocumentEditorTitle)
lblDocumentEditorName = New Label()
lblDocumentEditorName.AutoSize = True
lblDocumentEditorName.Location = New Point(8, 30)
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, 27)
txtDocumentEditorName.Location = New Point(110, 77)
txtDocumentEditorName.MaxLength = 120
txtDocumentEditorName.Size = New Size(128, 20)
AddHandler txtDocumentEditorName.TextChanged, AddressOf DocumentEditorInputChanged
@@ -400,14 +487,14 @@ Public Class frmAddSendungsvermerkShort
lblDocumentEditorAnhangsart = New Label()
lblDocumentEditorAnhangsart.AutoSize = True
lblDocumentEditorAnhangsart.Location = New Point(248, 30)
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, 27)
cmbDocumentEditorAnhangsart.Location = New Point(320, 77)
cmbDocumentEditorAnhangsart.Size = New Size(124, 21)
EnsureAnhangsartenOptionsLoaded()
For Each o In _anhangsartenOptions
@@ -418,13 +505,13 @@ Public Class frmAddSendungsvermerkShort
lblDocumentEditorInfo = New Label()
lblDocumentEditorInfo.AutoSize = True
lblDocumentEditorInfo.Location = New Point(8, 54)
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, 51)
txtDocumentEditorInfo.Location = New Point(110, 101)
txtDocumentEditorInfo.MaxLength = 500
txtDocumentEditorInfo.Size = New Size(334, 20)
txtDocumentEditorInfo.Text = DefaultDocumentBaseText
@@ -434,7 +521,7 @@ Public Class frmAddSendungsvermerkShort
lblDocumentEditorStatus = New Label()
lblDocumentEditorStatus.AutoSize = True
lblDocumentEditorStatus.ForeColor = Color.FromArgb(0, 102, 153)
lblDocumentEditorStatus.Location = New Point(8, 78)
lblDocumentEditorStatus.Location = New Point(8, 128)
lblDocumentEditorStatus.Text = "Wählen Sie ein Dokument, um Name und Dokument Info anzupassen."
pnlDocumentEditor.Controls.Add(lblDocumentEditorStatus)
End Sub
@@ -445,6 +532,21 @@ Public Class frmAddSendungsvermerkShort
_documentCustomNameByCodeId(_selectedDocumentCodeId) = If(txtDocumentEditorName.Text, "").Trim()
_documentBaseTextByCodeId(_selectedDocumentCodeId) = If(txtDocumentEditorInfo.Text, "").Trim()
If flpDocumentTabs IsNot Nothing Then
Dim tab = TryCast(flpDocumentTabs.Controls("tab_" & _selectedDocumentCodeId), Panel)
If tab IsNot Nothing Then
Dim lblText = TryCast(tab.Controls("lblText"), Label)
Dim lblClose = TryCast(tab.Controls("lblClose"), Label)
If lblText IsNot Nothing AndAlso lblClose IsNot Nothing Then
lblText.Text = _documentCustomNameByCodeId(_selectedDocumentCodeId)
If lblText.Text = "" Then lblText.Text = "Unbenannt"
lblText.PerformLayout()
lblClose.Location = New Point(lblText.Right + 5, 5)
tab.Width = lblClose.Right + 5
End If
End If
End If
End Sub
Private Sub DocumentEditorAnhangsartChanged(sender As Object, e As EventArgs)
@@ -527,6 +629,221 @@ Public Class frmAddSendungsvermerkShort
Return Integer.TryParse(cb.Tag.ToString(), codeId) AndAlso codeId > 0
End Function
Private Sub ClearDocumentEditor()
_selectedDocumentCodeId = 0
_isLoadingDocumentEditor = True
txtDocumentEditorName.Text = ""
txtDocumentEditorInfo.Text = ""
If cmbDocumentEditorAnhangsart IsNot Nothing Then
cmbDocumentEditorAnhangsart.SelectedIndex = -1
End If
_isLoadingDocumentEditor = False
If lblDocumentEditorStatus IsNot Nothing Then
lblDocumentEditorStatus.Text = "Wählen Sie ein Dokument, um Name und Dokument Info anzupassen."
End If
End Sub
Private Sub SelectDocument(codeId As Integer)
_selectedDocumentCodeId = codeId
If codeId <= 0 Then
ClearDocumentEditor()
SyncTabs()
Return
End If
Dim targetCb As CheckBox = Nothing
For Each cb In _anforderungCheckboxes
If cb.Tag IsNot Nothing AndAlso cb.Tag.ToString() = codeId.ToString() Then
targetCb = cb
Exit For
End If
Next
If targetCb IsNot Nothing Then
Dim anhangsartId = GetEffectiveAnhangsartId(targetCb)
Dim customName = ""
If _documentCustomNameByCodeId.ContainsKey(codeId) Then
customName = If(_documentCustomNameByCodeId(codeId), "").Trim()
Else
customName = GetAnhangsartDisplayTextById(anhangsartId)
_documentCustomNameByCodeId(codeId) = customName
End If
Dim baseText = GetDocumentBaseTextByCodeId(codeId)
_isLoadingDocumentEditor = True
txtDocumentEditorName.Text = customName
txtDocumentEditorInfo.Text = baseText
SelectAnhangsartInEditor(anhangsartId)
_isLoadingDocumentEditor = False
If anhangsartId > 0 Then
_selectedAnhangsartIdByCodeId(codeId) = anhangsartId
End If
lblDocumentEditorStatus.ForeColor = Color.FromArgb(0, 102, 153)
lblDocumentEditorStatus.Text = "Ausgewählt: " & If(targetCb.Text, "").Trim()
End If
SyncTabs()
End Sub
Private Function CreateTab(codeId As Integer, text As String) As Panel
Dim pnl As New Panel()
pnl.Name = "tab_" & codeId
pnl.Tag = codeId
pnl.Height = 28
pnl.BackColor = Color.White
pnl.BorderStyle = BorderStyle.FixedSingle
pnl.Margin = New Padding(2, 4, 2, 0)
pnl.Cursor = Cursors.Hand
Dim lblText As New Label()
lblText.Name = "lblText"
lblText.Text = If(text = "", "Unbenannt", text)
lblText.AutoSize = True
lblText.Location = New Point(5, 5)
lblText.Tag = codeId
lblText.Cursor = Cursors.Hand
AddHandler lblText.Click, AddressOf Tab_Click
pnl.Controls.Add(lblText)
Dim lblClose As New Label()
lblClose.Name = "lblClose"
lblClose.Text = "X"
lblClose.AutoSize = True
lblClose.ForeColor = Color.Red
lblClose.Font = New Font("Microsoft Sans Serif", 8.25!, FontStyle.Bold)
lblClose.Cursor = Cursors.Hand
lblClose.Tag = codeId
AddHandler lblClose.Click, AddressOf TabClose_Click
pnl.Controls.Add(lblClose)
lblText.PerformLayout()
lblClose.Location = New Point(lblText.Right + 5, 5)
pnl.Width = lblClose.Right + 5
AddHandler pnl.Click, AddressOf Tab_Click
Return pnl
End Function
Private Sub SyncTabs()
If flpDocumentTabs Is Nothing Then Return
flpDocumentTabs.SuspendLayout()
Dim requiredCodeIds As New List(Of Integer)
For Each cb In _anforderungCheckboxes
If cb.Checked Then
Dim codeId As Integer = 0
If Integer.TryParse(cb.Tag.ToString(), codeId) Then
If _bereichByCodeId.ContainsKey(codeId) AndAlso _bereichByCodeId(codeId) = BereichDokumentMain Then
requiredCodeIds.Add(codeId)
End If
End If
End If
Next
Dim i As Integer = flpDocumentTabs.Controls.Count - 1
While i >= 0
Dim pnl = TryCast(flpDocumentTabs.Controls(i), Panel)
If pnl IsNot Nothing Then
Dim codeId = CInt(pnl.Tag)
If Not requiredCodeIds.Contains(codeId) Then
flpDocumentTabs.Controls.RemoveAt(i)
pnl.Dispose()
End If
End If
i -= 1
End While
For Each codeId In requiredCodeIds
Dim existingTab = TryCast(flpDocumentTabs.Controls("tab_" & codeId), Panel)
Dim text = ""
If _documentCustomNameByCodeId.ContainsKey(codeId) Then
text = _documentCustomNameByCodeId(codeId)
End If
If text = "" Then
For Each cb In _anforderungCheckboxes
If cb.Tag IsNot Nothing AndAlso cb.Tag.ToString() = codeId.ToString() Then
text = cb.Text
Exit For
End If
Next
End If
If existingTab Is Nothing Then
existingTab = CreateTab(codeId, text)
flpDocumentTabs.Controls.Add(existingTab)
Else
Dim lblText = TryCast(existingTab.Controls("lblText"), Label)
Dim lblClose = TryCast(existingTab.Controls("lblClose"), Label)
If lblText IsNot Nothing AndAlso lblClose IsNot Nothing Then
lblText.Text = If(text = "", "Unbenannt", text)
lblText.PerformLayout()
lblClose.Location = New Point(lblText.Right + 5, 5)
existingTab.Width = lblClose.Right + 5
End If
End If
If codeId = _selectedDocumentCodeId Then
existingTab.BackColor = Color.White
existingTab.BorderStyle = BorderStyle.FixedSingle
existingTab.Height = 28
existingTab.Margin = New Padding(2, 2, 2, 0)
Dim lblText = TryCast(existingTab.Controls("lblText"), Label)
If lblText IsNot Nothing Then lblText.Font = New Font("Microsoft Sans Serif", 8.25!, FontStyle.Bold)
Else
existingTab.BackColor = Color.LightGray
existingTab.BorderStyle = BorderStyle.None
existingTab.Height = 25
existingTab.Margin = New Padding(2, 5, 2, 0)
Dim lblText = TryCast(existingTab.Controls("lblText"), Label)
If lblText IsNot Nothing Then lblText.Font = New Font("Microsoft Sans Serif", 8.25!, FontStyle.Regular)
End If
Next
flpDocumentTabs.ResumeLayout()
If _selectedDocumentCodeId > 0 AndAlso Not requiredCodeIds.Contains(_selectedDocumentCodeId) Then
If requiredCodeIds.Count > 0 Then
SelectDocument(requiredCodeIds(0))
Else
ClearDocumentEditor()
End If
ElseIf _selectedDocumentCodeId = 0 AndAlso requiredCodeIds.Count > 0 Then
SelectDocument(requiredCodeIds(0))
End If
End Sub
Private Sub Tab_Click(sender As Object, e As EventArgs)
Dim ctrl = TryCast(sender, Control)
If ctrl IsNot Nothing AndAlso ctrl.Tag IsNot Nothing Then
Dim codeId As Integer = 0
If Integer.TryParse(ctrl.Tag.ToString(), codeId) Then
SelectDocument(codeId)
End If
End If
End Sub
Private Sub TabClose_Click(sender As Object, e As EventArgs)
Dim ctrl = TryCast(sender, Control)
If ctrl IsNot Nothing AndAlso ctrl.Tag IsNot Nothing Then
Dim codeId As Integer = 0
If Integer.TryParse(ctrl.Tag.ToString(), codeId) Then
For Each cb In _anforderungCheckboxes
If cb.Tag IsNot Nothing AndAlso cb.Tag.ToString() = codeId.ToString() Then
cb.Checked = False
Exit For
End If
Next
End If
End If
End Sub
Private Sub LoadDocumentEditorForCheckbox(cb As CheckBox)
EnsureDocumentEditorControls()
@@ -645,9 +962,28 @@ Public Class frmAddSendungsvermerkShort
Private Sub DynamicAnforderungCheckboxChanged(sender As Object, e As EventArgs)
Dim cb = TryCast(sender, CheckBox)
If cb Is Nothing Then Return
If Not cb.Checked Then Return
LoadDocumentEditorForCheckbox(cb)
Dim bereich As Integer = 0
Dim codeId As Integer = 0
If cb.Tag IsNot Nothing Then
If Integer.TryParse(cb.Tag.ToString(), codeId) Then
If _bereichByCodeId.ContainsKey(codeId) Then
bereich = _bereichByCodeId(codeId)
Else
bereich = BereichAngefordert
End If
End If
End If
If bereich = BereichAngefordert Then
Return
End If
If cb.Checked Then
SelectDocument(codeId)
Else
SyncTabs()
End If
End Sub
' Private Sub btnAbbruch_Click(sender As System.Object, e As System.EventArgs) Handles btnAbbruch.Click
@@ -701,7 +1037,11 @@ Public Class frmAddSendungsvermerkShort
Continue For
End Try
Dim text = cb.Text.Trim()
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 & "'"