only mark fields with missing account as error if required, re-add selected field for checkboxes in file list, make automatic price calculation configurable
This commit is contained in:
parent
17d5f5ca1b
commit
1c3d5dd543
@ -5,4 +5,5 @@ Public Class Config
|
|||||||
Public Property ConnectionString As String = ""
|
Public Property ConnectionString As String = ""
|
||||||
Public Property LastUsedMandator As String = ""
|
Public Property LastUsedMandator As String = ""
|
||||||
Public Property Debug As Boolean = False
|
Public Property Debug As Boolean = False
|
||||||
|
Public Property AutomaticPriceCalculation As Boolean = True
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
@ -21,9 +21,14 @@ Namespace Documents
|
|||||||
|
|
||||||
Public Property Imported As Boolean = False
|
Public Property Imported As Boolean = False
|
||||||
|
|
||||||
|
''' <summary>
|
||||||
|
''' This is used for saving the selected state via checkbox, don't remove!
|
||||||
|
''' </summary>
|
||||||
|
Public Property Selected As Boolean = False
|
||||||
|
|
||||||
Public ReadOnly Property HasErrors As Boolean
|
Public ReadOnly Property HasErrors As Boolean
|
||||||
Get
|
Get
|
||||||
Return Mandator Is Nothing Or Rows.Any(Function(r As DocumentRow) r.HasErrors)
|
Return Errors.Count > 0
|
||||||
End Get
|
End Get
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,7 @@ Namespace Documents
|
|||||||
Private ReadOnly Winline As WinlineData
|
Private ReadOnly Winline As WinlineData
|
||||||
Private ReadOnly MappingConfig As MappingConfig
|
Private ReadOnly MappingConfig As MappingConfig
|
||||||
Private ReadOnly TemplateConfig As TemplateConfig
|
Private ReadOnly TemplateConfig As TemplateConfig
|
||||||
|
Private ReadOnly ApplicationConfig As Config
|
||||||
|
|
||||||
Public Property Files As New List(Of Document)
|
Public Property Files As New List(Of Document)
|
||||||
|
|
||||||
@ -44,11 +45,12 @@ Namespace Documents
|
|||||||
End Sub
|
End Sub
|
||||||
End Class
|
End Class
|
||||||
|
|
||||||
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData, pMappingConfig As MappingConfig, pTemplateConfig As TemplateConfig)
|
Public Sub New(pLogConfig As LogConfig, pWinline As WinlineData, pMappingConfig As MappingConfig, pTemplateConfig As TemplateConfig, pApplicationConfig As Config)
|
||||||
MyBase.New(pLogConfig)
|
MyBase.New(pLogConfig)
|
||||||
Winline = pWinline
|
Winline = pWinline
|
||||||
MappingConfig = pMappingConfig
|
MappingConfig = pMappingConfig
|
||||||
TemplateConfig = pTemplateConfig
|
TemplateConfig = pTemplateConfig
|
||||||
|
ApplicationConfig = pApplicationConfig
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Async Function LoadFiles(pTemplate As Template, pMandator As Mandator) As Task(Of Boolean)
|
Public Async Function LoadFiles(pTemplate As Template, pMandator As Mandator) As Task(Of Boolean)
|
||||||
@ -273,8 +275,10 @@ Namespace Documents
|
|||||||
.RunningFunction = "Preis-Funktionen"
|
.RunningFunction = "Preis-Funktionen"
|
||||||
})
|
})
|
||||||
|
|
||||||
' These functions will only be applied if the document does not have errors
|
If ApplicationConfig.AutomaticPriceCalculation = True Then
|
||||||
pDocument = Await MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate)
|
' These functions will only be applied if the document does not have errors
|
||||||
|
pDocument = Await MaybeApplyPriceFunctions(pDocument, oMandator, pTemplate)
|
||||||
|
End If
|
||||||
|
|
||||||
RaiseEvent FileLoadProgress(Me, New FileLoadProgressInfo(FilesTotal, FilesLoaded) With {
|
RaiseEvent FileLoadProgress(Me, New FileLoadProgressInfo(FilesTotal, FilesLoaded) With {
|
||||||
.RunningFunction = "Feld-Funktionen"
|
.RunningFunction = "Feld-Funktionen"
|
||||||
@ -567,7 +571,11 @@ Namespace Documents
|
|||||||
'})
|
'})
|
||||||
End If
|
End If
|
||||||
Else
|
Else
|
||||||
oNumberItem.Error = FieldError.AccountNotFound
|
' If no account was found and the field is required,
|
||||||
|
' mark it as error. Otherwise, do nothing.
|
||||||
|
If oNumberItem.IsRequired Then
|
||||||
|
oNumberItem.Error = FieldError.AccountNotFound
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ Public Class frmImportMain
|
|||||||
lookupMandator.ForceInitialize()
|
lookupMandator.ForceInitialize()
|
||||||
lookupMandator.Properties.View.BestFitColumns()
|
lookupMandator.Properties.View.BestFitColumns()
|
||||||
|
|
||||||
DocumentLoader = New Documents.DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration)
|
DocumentLoader = New Documents.DocumentLoader(LogConfig, Winline, My.MappingConfiguration, My.TemplateConfiguration, ConfigManager.Config)
|
||||||
DocumentCleaner = New Documents.DocumentCleaner(LogConfig, CurrentTemplate)
|
DocumentCleaner = New Documents.DocumentCleaner(LogConfig, CurrentTemplate)
|
||||||
|
|
||||||
GridLoader = New GridLoader(LogConfig)
|
GridLoader = New GridLoader(LogConfig)
|
||||||
@ -600,19 +600,21 @@ Public Class frmImportMain
|
|||||||
Next
|
Next
|
||||||
|
|
||||||
txtCurrentFile.Caption = String.Format(My.Resources.frmImportMainExtra.Aktuelle_Datei___0_, pDocument.FileName)
|
txtCurrentFile.Caption = String.Format(My.Resources.frmImportMainExtra.Aktuelle_Datei___0_, pDocument.FileName)
|
||||||
txtErrors.Caption = String.Format("Fehler: {0}", pDocument.Errors.Count)
|
|
||||||
|
|
||||||
CurrentDocument = pDocument
|
If pDocument.Errors.Count > 0 Then
|
||||||
|
txtErrors.Caption = String.Format("Fehler: {0}", pDocument.Errors.Count)
|
||||||
|
txtErrors.Visibility = DevExpress.XtraBars.BarItemVisibility.Always
|
||||||
|
Else
|
||||||
|
txtErrors.Visibility = DevExpress.XtraBars.BarItemVisibility.Never
|
||||||
|
End If
|
||||||
|
|
||||||
SetDocumentButtonsEnabled(True)
|
If pDocument.HasErrors = True Then
|
||||||
|
|
||||||
If CurrentDocument.HasErrors = True Then
|
|
||||||
btnCalculatePrices.Enabled = False
|
btnCalculatePrices.Enabled = False
|
||||||
Else
|
Else
|
||||||
btnCalculatePrices.Enabled = True
|
btnCalculatePrices.Enabled = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If CurrentDocument.Mandator Is Nothing Then
|
If pDocument.Mandator Is Nothing Then
|
||||||
RibbonPageGroupEdit.Enabled = False
|
RibbonPageGroupEdit.Enabled = False
|
||||||
RibbonPageGroupTransfer.Enabled = False
|
RibbonPageGroupTransfer.Enabled = False
|
||||||
CurrentDocumentReadOnly = True
|
CurrentDocumentReadOnly = True
|
||||||
@ -624,6 +626,9 @@ Public Class frmImportMain
|
|||||||
CurrentDocumentReadOnly = False
|
CurrentDocumentReadOnly = False
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
CurrentDocument = pDocument
|
||||||
|
SetDocumentButtonsEnabled(True)
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
SetDocumentButtonsEnabled(False)
|
SetDocumentButtonsEnabled(False)
|
||||||
Logger.Error(ex)
|
Logger.Error(ex)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user