WIP
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
Imports System.Globalization
|
||||
Imports System.IO
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports MultiTool.Shared.Exceptions
|
||||
Imports MultiTool.Shared.Schemas
|
||||
Imports MultiTool.Shared.Winline
|
||||
|
||||
@@ -8,7 +9,7 @@ Namespace Documents
|
||||
Public Class DocumentLoader
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Winline As Winline.Data
|
||||
Private ReadOnly Winline As WinlineData
|
||||
|
||||
Public Property Files As New List(Of Document)
|
||||
Public Event FileLoadComplete As EventHandler(Of FileLoadInfo)
|
||||
@@ -18,7 +19,7 @@ Namespace Documents
|
||||
Public FilesTotal As Integer
|
||||
End Structure
|
||||
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As Winline.Data)
|
||||
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData)
|
||||
MyBase.New(pLogConfig, pLogConfig.GetLogger())
|
||||
Winline = pWinline
|
||||
End Sub
|
||||
@@ -39,14 +40,23 @@ Namespace Documents
|
||||
Logger.Debug("Found [{0}] files in directory [{1}]", oFiles.Count, oDirectory)
|
||||
|
||||
For Each oFile In oFiles
|
||||
Dim oDocument = LoadFile(oFile, pSchema, pMandator)
|
||||
Files.Add(oDocument)
|
||||
Try
|
||||
Dim oDocument = LoadFile(oFile, pSchema, pMandator)
|
||||
Files.Add(oDocument)
|
||||
|
||||
Dim oInfo As FileLoadInfo
|
||||
oInfo.FilesLoaded = Files.Count
|
||||
oInfo.FilesTotal = oFiles.Count
|
||||
Dim oInfo As FileLoadInfo
|
||||
oInfo.FilesLoaded = Files.Count
|
||||
oInfo.FilesTotal = oFiles.Count
|
||||
|
||||
RaiseEvent FileLoadComplete(Me, oInfo)
|
||||
RaiseEvent FileLoadComplete(Me, oInfo)
|
||||
Catch ex As MissingAttributeException
|
||||
Logger.Error(ex)
|
||||
Throw New DocumentLoaderException($"Missing Attribute '{ex.Message}' in File '{oFile.Name}'")
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
Throw ex
|
||||
End Try
|
||||
Next
|
||||
|
||||
Return True
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
Public Class Exceptions
|
||||
Public MustInherit Class DocumentShowException
|
||||
''' <summary>
|
||||
''' Abstract class
|
||||
''' </summary>
|
||||
Public MustInherit Class MultiToolException
|
||||
Inherits ApplicationException
|
||||
|
||||
Public Sub New(message As String)
|
||||
@@ -7,43 +10,59 @@
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
''' -----------------------------------------------
|
||||
|
||||
Public Class DocumentLoaderException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class WebServiceException
|
||||
Inherits ApplicationException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class MissingAttributeException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(attributeName As String)
|
||||
MyBase.New(attributeName)
|
||||
End Sub
|
||||
End Class
|
||||
Public Class MultipleAccountsException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
Public Class NoAccountException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
Public Class NoMandatorException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
Public Class MalformedXmlException
|
||||
Inherits MultiToolException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class NoMandatorException
|
||||
Inherits DocumentShowException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class MultipleAccountsException
|
||||
Inherits DocumentShowException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class NoAccountException
|
||||
Inherits DocumentShowException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
Public Class MalformedXmlException
|
||||
Inherits ApplicationException
|
||||
|
||||
Public Sub New(message As String)
|
||||
MyBase.New(message)
|
||||
End Sub
|
||||
End Class
|
||||
End Class
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
<Compile Include="Serializer.vb" />
|
||||
<Compile Include="Winline\Configuration.vb" />
|
||||
<Compile Include="Winline\Entities\Account.vb" />
|
||||
<Compile Include="Winline\Data.vb" />
|
||||
<Compile Include="Winline\WinlineData.vb" />
|
||||
<Compile Include="Winline\Entities\Article.vb" />
|
||||
<Compile Include="Winline\Entities\Contact.vb" />
|
||||
<Compile Include="Winline\Entities\DocumentKind.vb" />
|
||||
|
||||
@@ -11,4 +11,14 @@
|
||||
Public Property Text8 As String
|
||||
Public Property Text9 As String
|
||||
Public Property Text10 As String
|
||||
Public Property Text11 As String
|
||||
Public Property Text12 As String
|
||||
Public Property Text13 As String
|
||||
Public Property Text14 As String
|
||||
Public Property Text15 As String
|
||||
Public Property Text16 As String
|
||||
Public Property Text17 As String
|
||||
Public Property Text18 As String
|
||||
Public Property Text19 As String
|
||||
Public Property Text20 As String
|
||||
End Class
|
||||
|
||||
@@ -6,7 +6,7 @@ Imports System.Text.RegularExpressions
|
||||
|
||||
|
||||
Namespace Winline
|
||||
Public Class Data
|
||||
Public Class WinlineData
|
||||
Inherits BaseClass
|
||||
|
||||
Private ReadOnly Database As MSSQLServer
|
||||
@@ -411,7 +411,13 @@ Namespace Winline
|
||||
Where(Function(r) r.Name.ToUpper.EndsWith("T026")).
|
||||
ToList()
|
||||
Dim oEANNumbers = oPositions.
|
||||
Select(Function(p) p.Fields.Item("Artikelnummer").Original).
|
||||
Select(Function(p)
|
||||
If p.Fields.ContainsKey("Artikelnummer") Then
|
||||
Return p.Fields.Item("Artikelnummer").Original
|
||||
Else
|
||||
Throw New Exceptions.MissingAttributeException("Artikelnummer")
|
||||
End If
|
||||
End Function).
|
||||
Distinct().
|
||||
ToList()
|
||||
|
||||
Reference in New Issue
Block a user