Finish FinalSQL, GLN/EAN for export, double click to open template, exporting multiple documents
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared.Documents
|
||||
Imports MultiTool.Shared.Templates
|
||||
Imports MultiTool.Shared.Winline.Entities
|
||||
|
||||
Public Class Patterns
|
||||
Inherits BaseClass
|
||||
@@ -13,7 +14,7 @@ Public Class Patterns
|
||||
GeneralConfig = pGeneralConfig
|
||||
End Sub
|
||||
|
||||
Public Function Replace(pDocument As Document, pRow As DocumentRow, oString As String)
|
||||
Public Function ReplaceForImport(pDocument As Documents.Document, pRow As DocumentRow, oString As String)
|
||||
Dim oRegex = New Regex("{#(\w+)#([\w\s_-]+)}+")
|
||||
Dim oMatches As MatchCollection = oRegex.Matches(oString)
|
||||
|
||||
@@ -34,7 +35,7 @@ Public Class Patterns
|
||||
Case "CONST"
|
||||
Dim oValue = ""
|
||||
|
||||
Select Case oMatch.Groups.Item(2).Value.ToUpper
|
||||
Select Case oPlaceholderValue.ToUpper
|
||||
Case "MESOYEAR"
|
||||
oValue = GeneralConfig.GetWinLineYear()
|
||||
|
||||
@@ -56,7 +57,59 @@ Public Class Patterns
|
||||
End Select
|
||||
|
||||
If oValue <> "" Then
|
||||
oString = oString.Replace(oPlaceholderValue, oValue)
|
||||
oString = oString.Replace(oPlaceholderString, oValue)
|
||||
End If
|
||||
End Select
|
||||
Next
|
||||
|
||||
Return oString
|
||||
End Function
|
||||
|
||||
Public Function ReplaceForExport(pTemplate As Template, pDocument As Winline.Entities.Document, pMandator As Mandator, oString As String)
|
||||
Dim oRegex = New Regex("{#(\w+)#([\w\s_-]+)}+")
|
||||
Dim oMatches As MatchCollection = oRegex.Matches(oString)
|
||||
|
||||
For Each oMatch As Match In oMatches
|
||||
Dim oPlaceholderString As String = oMatch.Groups.Item(0)?.Value
|
||||
Dim oPlaceholderType As String = oMatch.Groups.Item(1)?.Value
|
||||
Dim oPlaceholderValue As String = oMatch.Groups.Item(2)?.Value
|
||||
|
||||
Select Case oPlaceholderType.ToUpper
|
||||
Case "CONST"
|
||||
Dim oValue = ""
|
||||
|
||||
Select Case oPlaceholderValue.ToUpper
|
||||
Case "MESOYEAR"
|
||||
oValue = GeneralConfig.GetWinLineYear()
|
||||
|
||||
Case "MESOCOMP"
|
||||
oValue = pMandator.Id
|
||||
|
||||
Case "USERNAME"
|
||||
oValue = Environment.UserName
|
||||
|
||||
Case "CURRENTDATE"
|
||||
oValue = Now.ToString()
|
||||
|
||||
Case "FILENAME"
|
||||
oValue = pDocument.FilenameExport
|
||||
|
||||
Case "ACCOUNTNUMBER"
|
||||
oValue = pDocument.Account.Id
|
||||
|
||||
Case "RUNNINGNUMBER"
|
||||
oValue = pDocument.RunningNumber
|
||||
|
||||
Case "MANDATORDB"
|
||||
oValue = pMandator.Database
|
||||
|
||||
Case Else
|
||||
oValue = ""
|
||||
|
||||
End Select
|
||||
|
||||
If oValue <> "" Then
|
||||
oString = oString.Replace(oPlaceholderString, oValue)
|
||||
End If
|
||||
End Select
|
||||
Next
|
||||
|
||||
Reference in New Issue
Block a user