Compare commits

...

4 Commits

Author SHA1 Message Date
Jonathan Jenne
e168c65ca9 Version 1.3.4 2022-05-13 13:54:46 +02:00
Jonathan Jenne
bc8289e1b7 Improve logging 2022-05-13 13:54:24 +02:00
Jonathan Jenne
cd1cdfe19a add clipboard handler for all grids 2022-05-13 13:54:11 +02:00
Jonathan Jenne
ddaacfe75c disable NOCOUNT after executing pricedure 2022-05-13 13:53:18 +02:00
7 changed files with 43 additions and 18 deletions

View File

@@ -398,6 +398,10 @@ Namespace Documents
Dim oFunctionName = oColumn.Config.FunctionName Dim oFunctionName = oColumn.Config.FunctionName
Dim oFunctionParams = oColumn.Config.FunctionParams Dim oFunctionParams = oColumn.Config.FunctionParams
If oFunctionName = String.Empty Then
Continue For
End If
Logger.Debug("Running Function: [{0}]", oFunctionName) Logger.Debug("Running Function: [{0}]", oFunctionName)
Logger.Debug("With Parameters: [{0}]", oFunctionParams) Logger.Debug("With Parameters: [{0}]", oFunctionParams)

View File

@@ -52,6 +52,7 @@ Namespace Winline
Dim oWS = Config Dim oWS = Config
RaiseEvent WebServiceProgress(Me, "Einstellungen laden") RaiseEvent WebServiceProgress(Me, "Einstellungen laden")
Logger.Debug("Loading setting and creating directories")
' --- Build all teh filenamez and pathz ' --- Build all teh filenamez and pathz
Dim oBaseFileName As String = FileEx.GetDateTimeString() Dim oBaseFileName As String = FileEx.GetDateTimeString()
@@ -72,12 +73,14 @@ Namespace Winline
Dim oImportRelativeFilePath = IO.Path.Combine(oRelativePath, oFileName) Dim oImportRelativeFilePath = IO.Path.Combine(oRelativePath, oFileName)
RaiseEvent WebServiceProgress(Me, "Dateien schreiben") RaiseEvent WebServiceProgress(Me, "Dateien schreiben")
Logger.Debug("Writing request file to [{oOutputFilePath}]")
' --- Serialize Data into XML string ' --- Serialize Data into XML string
IO.File.WriteAllBytes(oOutputFilePath, oBytes) IO.File.WriteAllBytes(oOutputFilePath, oBytes)
' --- Copy file to Winline Import Directory ' --- Copy file to Winline Import Directory
Try Try
Logger.Debug("Copying request file to [{oImportAbsoluteFilePath}]")
IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True) IO.File.Copy(oOutputFilePath, oImportAbsoluteFilePath, True)
Catch ex As Exception Catch ex As Exception
Logger.Error(ex) Logger.Error(ex)
@@ -87,6 +90,7 @@ Namespace Winline
' --- Prepare URL and HTTP Client ' --- Prepare URL and HTTP Client
Dim oTemplateType = pDocument.TemplateType Dim oTemplateType = pDocument.TemplateType
Dim oTemplateName = pDocument.TemplateName Dim oTemplateName = pDocument.TemplateName
Logger.Debug("Using Template [{0}/{1}]", oTemplateName, oTemplateType)
' ActionCode: Should this be a test or not? ' ActionCode: Should this be a test or not?
' 0 = Test call ' 0 = Test call
@@ -95,6 +99,7 @@ Namespace Winline
If pIsTest = True Then If pIsTest = True Then
oActionCode = 0 oActionCode = 0
End If End If
Logger.Debug("Using ActionCode [{0}]", oActionCode)
' Byref: Should data be supplied as file or as string? ' Byref: Should data be supplied as file or as string?
' 0 = As String ' 0 = As String
@@ -113,6 +118,8 @@ Namespace Winline
' --- Bring the action! ' --- Bring the action!
Try Try
Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL) Dim oResponse As HttpResponseMessage = Await oClient.GetAsync(oURL)
Logger.Debug("HTTP Response recevied!")
Await HandleImportResponse(oResponse, pTemplate, oBaseFileName) Await HandleImportResponse(oResponse, pTemplate, oBaseFileName)
Return True Return True
@@ -133,8 +140,12 @@ Namespace Winline
RaiseEvent WebServiceProgress(Me, "Antwort verarbeiten") RaiseEvent WebServiceProgress(Me, "Antwort verarbeiten")
Logger.Debug("Response ContentType: [{0}]", oContentType)
Select Case oContentType Select Case oContentType
Case "text/xml" Case "text/xml"
Logger.Debug("Got XML Response. Checking.")
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml") WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody) Dim oBytes As Byte() = Encoding.UTF8.GetBytes(oResponseBody)
@@ -146,8 +157,8 @@ Namespace Winline
For Each oDetails As Templates.Entities.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails For Each oDetails As Templates.Entities.MESOWebServiceResultResultDetails In oResponseObject.ResultDetails
If oDetails.Success = True Then If oDetails.Success = True Then
Logger.Info("KeyValue: [{0}]", oDetails.KeyValue) Logger.Debug("KeyValue: [{0}]", oDetails.KeyValue)
Logger.Info("VoucherNumber: [{0}]", oDetails.VoucherNumber) Logger.Debug("VoucherNumber: [{0}]", oDetails.VoucherNumber)
Else Else
Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode) Logger.Warn("ErrorCode: [{0}]", oDetails.ErrorCode)
Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText) Logger.Warn("ErrorText: [{0}]", oDetails.ErrorText)
@@ -159,17 +170,23 @@ Namespace Winline
If oResponseObject.OverallSuccess = False Then If oResponseObject.OverallSuccess = False Then
Dim oMessage = $"Request to Webservice was unsuccessful:{vbNewLine}{vbNewLine}{String.Join(vbNewLine, oErrorStrings.ToArray)}" Dim oMessage = $"Request to Webservice was unsuccessful:{vbNewLine}{vbNewLine}{String.Join(vbNewLine, oErrorStrings.ToArray)}"
Logger.Warn("Overall Success was [false]")
Throw New WebServiceException(oMessage) Throw New WebServiceException(oMessage)
End If End If
End Using End Using
Case "text/html" Case "text/html"
Logger.Debug("Got TEXT/HTML Response. Throwing.")
WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml") WriteResponseFile(oOutputDirectory, oResponseBody, $"{pTemplate.Name}-{pBaseFileName}-Response.xml")
Throw New WebServiceException(oResponseBody) Throw New WebServiceException(oResponseBody)
Case Else Case Else
Logger.Debug("Unknown Response ContentType: [{0}]", oContentType)
Throw New WebServiceException(oResponseBody) Throw New WebServiceException(oResponseBody)
End Select End Select
End Function End Function
@@ -216,7 +233,7 @@ Namespace Winline
#End Region #End Region
#Region "Export" #Region "Export"
Async Function ExportDocumentFromWinline(pDocument As Entities.ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean) Async Function ExportDocumentFromWinline(pDocument As ExportDocument, pTemplate As Template, pMandator As Mandator, Optional pIsTest As Boolean = False) As Task(Of Boolean)
Dim oWS = Config Dim oWS = Config
Logger.Info("Exporting document from Winline") Logger.Info("Exporting document from Winline")

View File

@@ -433,7 +433,8 @@ Namespace Winline
@pPrintDebug = 0, @pPrintDebug = 0,
@pLog2DB = {oDebug}, @pLog2DB = {oDebug},
@pComment = 'Multitool/{pTemplate.Name}', @pComment = 'Multitool/{pTemplate.Name}',
@pResultType = 'CalcPricing' @pResultType = 'CalcPricing';
SET NOCOUNT OFF;
" "
Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL) Dim oTable As DataTable = Await Database.GetDatatableAsync(oSQL)

View File

@@ -39,6 +39,7 @@ Public Class FormHelper
MsgBox(oMessage, MsgBoxStyle.Exclamation, Form.Text) MsgBox(oMessage, MsgBoxStyle.Exclamation, Form.Text)
End Sub End Sub
Public Sub TryOpenDirectory(pPath As String, pDisplayName As String) Public Sub TryOpenDirectory(pPath As String, pDisplayName As String)
If IO.Directory.Exists(pPath) Then If IO.Directory.Exists(pPath) Then
Process.Start(pPath) Process.Start(pPath)

View File

@@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyCompany("Digital Data")> <Assembly: AssemblyCompany("Digital Data")>
<Assembly: AssemblyProduct("WebService Multitool")> <Assembly: AssemblyProduct("WebService Multitool")>
<Assembly: AssemblyCopyright("Copyright © 2022")> <Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("1.3.3.0")> <Assembly: AssemblyTrademark("1.3.4.0")>
<Assembly: ComVisible(False)> <Assembly: ComVisible(False)>
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben: ' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.3.3.0")> <Assembly: AssemblyVersion("1.3.4.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@@ -44,13 +44,7 @@ Public Class frmExportMain
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString) Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
Database = New MSSQLServer(LogConfig, oConnectionString) Database = New MSSQLServer(LogConfig, oConnectionString)
Dim oViews As New List(Of GridView) From { GridBuilder = New GridBuilder(GridViewDocuments, lookupMandator.Properties.View, lookupAccount.Properties.View).
GridViewDocuments,
lookupMandator.Properties.View,
lookupAccount.Properties.View
}
GridBuilder = New GridBuilder(oViews)
GridBuilder.
WithDefaults(). WithDefaults().
WithReadOnlyOptions(). WithReadOnlyOptions().
WithClipboardHandler() WithClipboardHandler()

View File

@@ -64,8 +64,10 @@ Public Class frmImportMain
Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString) Dim oConnectionString = MSSQLServer.DecryptConnectionString(ConfigManager.Config.ConnectionString)
Database = New MSSQLServer(LogConfig, oConnectionString) Database = New MSSQLServer(LogConfig, oConnectionString)
GridBuilder = New GridBuilder(GridViewFiles) GridBuilder = New GridBuilder(GridViewFiles, GridView1, GridView2, GridView3, GridView4).
GridBuilder.WithDefaults.WithReadOnlyOptions.WithClipboardHandler() WithDefaults().
WithReadOnlyOptions().
WithClipboardHandler()
GridViewFiles.OptionsView.ShowAutoFilterRow = False GridViewFiles.OptionsView.ShowAutoFilterRow = False
Winline = My.Winline Winline = My.Winline
@@ -413,7 +415,8 @@ Public Class frmImportMain
If oFailedDocuments.Count > 0 Then If oFailedDocuments.Count > 0 Then
Dim oErrorMessages = String.Join(vbNewLine, oFailedDocuments) Dim oErrorMessages = String.Join(vbNewLine, oFailedDocuments)
Dim oMessage = String.Format("Für {0} Dateien ist die Übertragung in die Winline fehlgeschlagen. Folgende Fehler sind aufgetreten: {2}{1}", oFailedDocuments.Count, oErrorMessages, vbNewLine) Dim oFailedCount = oFailedDocuments.Count
Dim oMessage = $"Für {oFailedCount} Dateien ist die Übertragung in die Winline fehlgeschlagen. Folgende Fehler sind aufgetreten: {oErrorMessages}{vbNewLine}"
MsgBox(oMessage, MsgBoxStyle.Exclamation, Text) MsgBox(oMessage, MsgBoxStyle.Exclamation, Text)
End If End If
@@ -441,8 +444,6 @@ Public Class frmImportMain
End If End If
End Sub End Sub
Private Async Function btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles btnLoadFiles.ItemClick Private Async Function btnLoadFiles_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) As Task Handles btnLoadFiles.ItemClick
Await LoadFiles() Await LoadFiles()
End Function End Function
@@ -753,24 +754,31 @@ Public Class frmImportMain
Return False Return False
End If End If
Logger.Info("Transferring file [{0}] to Winline", pDocument.FileName)
Dim oResult = Await WebService.TransferDocumentToWinline(pDocument, CurrentTemplate, lookupMandator.EditValue, pIsTest) Dim oResult = Await WebService.TransferDocumentToWinline(pDocument, CurrentTemplate, lookupMandator.EditValue, pIsTest)
Logger.Debug("Transfer successful: [{0}]", oResult)
If oResult = True Then If oResult = True Then
' If this was only a test, we are done. ' If this was only a test, we are done.
If pIsTest = True Then If pIsTest = True Then
Logger.Debug("This was a Test Transfer. Exiting.")
Return True Return True
End If End If
' Generate the report ' Generate the report
WebService.RaiseWebServiceProgress("Bericht erzeugen") WebService.RaiseWebServiceProgress("Bericht erzeugen")
Logger.Debug("Creating report for file [{0}]", pDocument.FileName)
Dim oReportResult = ReportGenerator.GenerateReport(pDocument, CurrentTemplate) Dim oReportResult = ReportGenerator.GenerateReport(pDocument, CurrentTemplate)
' Export it to pdf ' Export it to pdf
WebService.RaiseWebServiceProgress("Bericht exportieren") WebService.RaiseWebServiceProgress("Bericht exportieren")
Logger.Debug("Exporting report to [{0}]", oReportResult.FileName)
oReportResult.Report.ExportToPdf(oReportResult.FileName) oReportResult.Report.ExportToPdf(oReportResult.FileName)
' Mark Document as Imported, will be moved on Form Close or File Reload ' Mark Document as Imported, will be moved on Form Close or File Reload
Logger.Debug("Setting file [{0}] to Imported", pDocument.FileName)
pDocument.Imported = True pDocument.Imported = True
Return True Return True