From 1e1bd2e53eab1427011a20a34165d00772c2adee Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Mon, 2 Jun 2025 11:16:35 +0200 Subject: [PATCH] temp --- BeWo/BeWo.csproj | 1 + BeWo/Core/BeWoUtils.cs | 13 ---- ...ceReferences_AccountingEnhancedService.bat | 33 ++++++++++ ...ferences_AccountingEnhancedService_Log.bat | 23 +++++++ .../GeneratedAccountingEnhancedService.cs | 61 +++++++++++++++++ .../GeneratedOperationsEnhancedService.cs | 6 +- BeWo/ServiceProxy/ServiceFacade.cs | 14 +++- BeWo/Services/BeWoWindowFactory.cs | 14 +++- BeWo/Services/BeWoWindowService.cs | 44 +++++++------ BeWo/Services/IWindowFactory.cs | 2 +- BeWo/Services/IWindowService.cs | 14 +++- BeWo/View/Controls/TextViewer.xaml | 3 +- .../Detail/Accounting/InvoiceOverview.xaml.cs | 23 ++++++- Data/Access/DAOFactory.cs | 8 ++- Data/Access/LocalFileStorageDAO.cs | 66 +++++++++++++++++++ Data/Data.csproj | 1 + Host/AccountingEnhancedService.svc | 1 + Host/AiEnhancedService.svc | 2 +- Host/Host.csproj | 1 + Host/Login.aspx.cs | 1 - Host/OperationsEnhancedService.svc | 2 +- Host/ServiceRecordPage.aspx.cs | 1 - Host/Web.Secrets.config.template | 2 +- Host/Web.config | 11 ++-- Report/ReportObjects/AuslastungBerechnung.cs | 1 - ...MitarbeiterstundenkontoBerechnungMonate.cs | 1 - .../GroupOfPeopleDC_GroupOfPeople.cs | 1 - .../WohneinheitDC_Wohneinheit.cs | 1 - Service/Invoicing/EquityInvoiceCreation.cs | 1 - Service/Invoicing/GeneralInvoiceCreation.cs | 1 - Service/Plugins/AccountingService.cs | 1 - Service/Plugins/AiService.cs | 1 - .../Security/SecurityContextInitializer.cs | 1 - Service/Service.csproj | 10 +-- .../Enhanced/IAccountingEnhancedService.cs | 22 +++++++ .../{ => Enhanced}/IAiEnhancedService.cs | 2 +- .../IOperationsEnhancedService.cs | 8 +-- Service/ServiceContracts/IApiService.cs | 12 ---- Service/ServiceContracts/IApiStreamService.cs | 2 +- .../ServiceImplementations/ApiServiceImp.cs | 20 ------ .../ApiStreamServiceImp.cs | 29 ++++---- .../AccountingEnhancedServiceImp.cs} | 13 ++-- .../{ => Enhanced}/AiEnhancedServiceImp.cs | 4 +- .../Enhanced/OperationsEnhancedServiceImp.cs | 37 +++++++++++ Service/ServiceProxy/XRechnungFacade.cs | 4 +- .../DistanceCalculator/OpenrouteServiceAPI.cs | 10 +-- Service/ServiceUtils/ServiceHelper.cs | 1 - Shared/BeWoEntityEnums.cs | 7 ++ Shared/Core/AppError.cs | 5 ++ Shared/Core/WebClientFacade.cs | 7 +- Shared/Interface/IFileStorageDAO.cs | 18 +++++ Shared/Shared.csproj | 1 + XRechnungUnitTest/XRechnungUnitTest.csproj | 3 +- 53 files changed, 423 insertions(+), 148 deletions(-) create mode 100644 BeWo/Scripts/ServiceReferences_AccountingEnhancedService.bat create mode 100644 BeWo/Scripts/ServiceReferences_AccountingEnhancedService_Log.bat create mode 100644 BeWo/ServiceProxy/GeneratedAccountingEnhancedService.cs create mode 100644 Data/Access/LocalFileStorageDAO.cs create mode 100644 Host/AccountingEnhancedService.svc create mode 100644 Service/ServiceContracts/Enhanced/IAccountingEnhancedService.cs rename Service/ServiceContracts/{ => Enhanced}/IAiEnhancedService.cs (97%) rename Service/ServiceContracts/{ => Enhanced}/IOperationsEnhancedService.cs (67%) rename Service/ServiceImplementations/{OperationsEnhancedServiceImp.cs => Enhanced/AccountingEnhancedServiceImp.cs} (82%) rename Service/ServiceImplementations/{ => Enhanced}/AiEnhancedServiceImp.cs (98%) create mode 100644 Service/ServiceImplementations/Enhanced/OperationsEnhancedServiceImp.cs create mode 100644 Shared/Interface/IFileStorageDAO.cs diff --git a/BeWo/BeWo.csproj b/BeWo/BeWo.csproj index e78c8d441..0efe14c8d 100644 --- a/BeWo/BeWo.csproj +++ b/BeWo/BeWo.csproj @@ -98,6 +98,7 @@ + diff --git a/BeWo/Core/BeWoUtils.cs b/BeWo/Core/BeWoUtils.cs index 4d8445804..6d7449602 100644 --- a/BeWo/Core/BeWoUtils.cs +++ b/BeWo/Core/BeWoUtils.cs @@ -2045,19 +2045,6 @@ namespace BeWo.Core BeWoApp.MainControl.EndWaiting(); } - public static void ShowPdfWindow(byte[] bytes) - => ShowPdfWindow(new MemoryStream(bytes)); - public static void ShowPdfWindow(MemoryStream ms) - { - var control = new PdfViewer(); - - control.PdfData = ms; - - var window = BeWoWindowBuilder.GetBeWoWindow("eRechnung", control); - - window.Show(); - } - public static PasswortSecurityStrength CheckPasswordSecurity(string paswd) { PasswortSicherheit pwS = new PasswortSicherheit(); diff --git a/BeWo/Scripts/ServiceReferences_AccountingEnhancedService.bat b/BeWo/Scripts/ServiceReferences_AccountingEnhancedService.bat new file mode 100644 index 000000000..682fe6afe --- /dev/null +++ b/BeWo/Scripts/ServiceReferences_AccountingEnhancedService.bat @@ -0,0 +1,33 @@ +..\svcutil.exe /noConfig /noLogo /edb /n:*,BeWo.ServiceProxy /out:..\ServiceProxy\GeneratedAccountingEnhancedService.cs /ct:System.Collections.Generic.List`1 /r:..\..\Shared\bin\Debug\BS.Shared.dll http://localhost:3777/Host/AccountingEnhancedService.svc?wsdl + +@echo off +setlocal EnableDelayedExpansion + +set "input=..\ServiceProxy\GeneratedAccountingEnhancedService.cs" +set "output=temp.txt" +set /a start=12 +set /a end=162 +set /a line=0 + +REM Zeilen zählen +set /a total=0 +for /f "usebackq delims=" %%A in ("%input%") do ( + set /a total+=1 +) + +REM Nur löschen, wenn genug Zeilen vorhanden +if %total% leq %end% ( + echo Datei hat nur %total% Zeilen – nichts wird gelöscht. + copy /y "%input%" "%input2%" + goto :eof +) + +> "%output%" ( + for /f "usebackq delims=" %%A in ("%input%") do ( + set /a line+=1 + if !line! lss %start% echo(%%A + if !line! gtr %end% echo(%%A + ) +) + +move /y "%output%" "%input%" \ No newline at end of file diff --git a/BeWo/Scripts/ServiceReferences_AccountingEnhancedService_Log.bat b/BeWo/Scripts/ServiceReferences_AccountingEnhancedService_Log.bat new file mode 100644 index 000000000..8320ccf11 --- /dev/null +++ b/BeWo/Scripts/ServiceReferences_AccountingEnhancedService_Log.bat @@ -0,0 +1,23 @@ +@echo off +REM Diese Batch-Datei führt eine andere Batch-Datei aus und schreibt das Ergebnis in eine Log-Datei + +REM Pfad zur anderen Batch-Datei +set "SCRIPT_PATH=ServiceReferences_AccountingEnhancedService.bat" + +REM Pfad zur Log-Datei +set "LOG_FILE=ServiceReferences_AccountingEnhancedService_Log.log.txt" + +REM Leere die Log-Datei vor dem Start +echo. > %LOG_FILE% + +REM Führe die andere Batch-Datei aus und leite die Ausgabe in die Log-Datei um +call %SCRIPT_PATH% >> %LOG_FILE% 2>&1 + +REM Überprüfe, ob die Ausführung erfolgreich war +if %errorlevel% equ 0 ( + echo Die Ausführung von %SCRIPT_PATH% war erfolgreich. >> %LOG_FILE% +) else ( + echo Die Ausführung von %SCRIPT_PATH% ist fehlgeschlagen. >> %LOG_FILE% +) + +echo Log wurde in %LOG_FILE% geschrieben. \ No newline at end of file diff --git a/BeWo/ServiceProxy/GeneratedAccountingEnhancedService.cs b/BeWo/ServiceProxy/GeneratedAccountingEnhancedService.cs new file mode 100644 index 000000000..07417eeed --- /dev/null +++ b/BeWo/ServiceProxy/GeneratedAccountingEnhancedService.cs @@ -0,0 +1,61 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ +namespace BeWo.ServiceProxy +{ + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="BeWo.ServiceProxy.IAccountingEnhancedService")] + public interface IAccountingEnhancedService + { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAccountingEnhancedService/CreateXRechnung", ReplyAction="http://tempuri.org/IAccountingEnhancedService/CreateXRechnungResponse")] + [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IAccountingEnhancedService/CreateXRechnungBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] + byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IAccountingEnhancedServiceChannel : BeWo.ServiceProxy.IAccountingEnhancedService, System.ServiceModel.IClientChannel + { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class AccountingEnhancedServiceClient : System.ServiceModel.ClientBase, BeWo.ServiceProxy.IAccountingEnhancedService + { + + public AccountingEnhancedServiceClient() + { + } + + public AccountingEnhancedServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) + { + } + + public AccountingEnhancedServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public AccountingEnhancedServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) + { + } + + public AccountingEnhancedServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) + { + } + + public byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url) + { + return base.Channel.CreateXRechnung(invoice_base_oid, report_type, report_url); + } + } +} diff --git a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs index 289c4c0ed..cee7970c8 100644 --- a/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs +++ b/BeWo/ServiceProxy/GeneratedOperationsEnhancedService.cs @@ -20,9 +20,7 @@ namespace BeWo.ServiceProxy [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/CreateXRechnung", ReplyAction="http://tempuri.org/IOperationsEnhancedService/CreateXRechnungResponse")] [System.ServiceModel.FaultContractAttribute(typeof(BeWo.ServiceProxy.BeWoFault), Action="http://tempuri.org/IOperationsEnhancedService/CreateXRechnungBeWoFaultFault", Name="BeWoFault", Namespace="http://schemas.datacontract.org/2004/07/BeWo.Service.ServiceContracts")] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BeWo.ServiceProxy.BeWoFault))] - [System.ServiceModel.ServiceKnownTypeAttribute(typeof(BeWo.ServiceProxy.BeWoFaultType))] - object CreateXRechnung(long invoice_base_oid, int report_type, string report_url); + byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url); } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] @@ -64,7 +62,7 @@ namespace BeWo.ServiceProxy base.Channel.HelloWorld(); } - public object CreateXRechnung(long invoice_base_oid, int report_type, string report_url) + public byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url) { return base.Channel.CreateXRechnung(invoice_base_oid, report_type, report_url); } diff --git a/BeWo/ServiceProxy/ServiceFacade.cs b/BeWo/ServiceProxy/ServiceFacade.cs index 2c908ab63..f897f4ffc 100644 --- a/BeWo/ServiceProxy/ServiceFacade.cs +++ b/BeWo/ServiceProxy/ServiceFacade.cs @@ -65,7 +65,8 @@ namespace BeWo.ServiceProxy { typeof(IAccountingService), new EndpointAddress(_ServerName + "AccountingService.svc") }, { typeof(IGkvAccountingService), new EndpointAddress(_ServerName + "GkvAccountingService.svc") }, { typeof(IReportService), new EndpointAddress(_ServerName + "ReportService.svc") }, - { typeof(IAiEnhancedService), new EndpointAddress(_ServerName + "AiEnhancedService.svc") } + { typeof(IAiEnhancedService), new EndpointAddress(_ServerName + "AiEnhancedService.svc") }, + { typeof(IAccountingEnhancedService), new EndpointAddress(_ServerName + "AccountingEnhancedService.svc") } }; } @@ -75,6 +76,17 @@ namespace BeWo.ServiceProxy _ProxyCache = new Dictionary(); } + #region AccountingEnhancedService + public static void DoAccountingEnhancedServiceSnyc(Action pAction) + => DoSync(pAction); + public static T DoAccountingEnhancedServiceSnyc(Func pFunc) + => DoSync(pFunc); + public static void DoAccountingEnhancedServiceAsnyc(Action pAction, Action pCallback = null, Action pErrorCallback = null, bool showWaitDialog = true, UserControl caller = null) + => DoAsync(pAction, pCallback, pErrorCallback, showWaitDialog, caller?.Dispatcher); + public static void DoAccountingEnhancedServiceAsnyc(Func pFunc, Action pCallback = null, Action pErrorCallback = null, bool showWaitDialog = true, UserControl caller = null) + => DoAsync(pFunc, pCallback, pErrorCallback, showWaitDialog, caller?.Dispatcher); + #endregion + #region AiEnhancedService public static void DoAiEnhancedServiceSnyc(Action pAction) => DoSync(pAction); diff --git a/BeWo/Services/BeWoWindowFactory.cs b/BeWo/Services/BeWoWindowFactory.cs index 53191d9c9..e2b29cead 100644 --- a/BeWo/Services/BeWoWindowFactory.cs +++ b/BeWo/Services/BeWoWindowFactory.cs @@ -9,17 +9,25 @@ using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; +using System.Windows.Controls.Primitives; namespace BeWo.Services { internal class BeWoWindowFactory : IWindowFactory { - public AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double height, double width) + public AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double? height, double? width) { var beWoWindow = new AnimatedBeWoWindow(); - beWoWindow.Height = height; - beWoWindow.Width = width; + if (height is double h) + beWoWindow.Height = h; + else + beWoWindow.Height = double.NaN; + + if (width is double w) + beWoWindow.Width = w; + else + beWoWindow.Width = double.NaN; beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow; diff --git a/BeWo/Services/BeWoWindowService.cs b/BeWo/Services/BeWoWindowService.cs index 261855418..8ce3a1e08 100644 --- a/BeWo/Services/BeWoWindowService.cs +++ b/BeWo/Services/BeWoWindowService.cs @@ -52,6 +52,13 @@ namespace BeWo.Services height, width); } + public void ShowERechnungWindow(MemoryStream pdf) + { + ShowWindowDialog( + "E-Rechnung", + cf => cf.GetPdfViewer(pdf)); + } + public void ShowERechnungModalViewWindow(MemoryStream pdf) { ShowModalViewWindow( @@ -67,6 +74,19 @@ namespace BeWo.Services height, width); } + public void ShowPdfViewerWindow(string title, MemoryStream pdf, double height = 900, double width = 600) + { + ShowWindowDialog(title, + cf => cf.GetPdfViewer(pdf), + height, width); + } + + public void ShowPdfViewerModalViewWindow(string title, MemoryStream pdf) + { + ShowModalViewWindow(title, + cf => cf.GetPdfViewer(pdf)); + } + public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungVM vm, CancelEventHandler cancelEvent, double height, double width) { // Kleiner Hack @@ -80,45 +100,31 @@ namespace BeWo.Services private void ShowWindow(Func getTitle, Func getControl, double height, double width) => ShowWindow(getTitle(_windowFactory), getControl, height, width); - private void ShowWindowDialog(Func getTitle, Func getControl, double height, double width) + private void ShowWindowDialog(Func getTitle, Func getControl, double? height = null, double? width = null) => ShowWindowDialog(getTitle(_windowFactory), getControl, height, width); - private void ShowModalViewWindow(Func getTitle, Func getControl) - => ShowModalViewWindow(getTitle(_windowFactory), getControl); - private void ShowModalViewWindow(Func getTitle, Func getControl, double height, double width) + private void ShowModalViewWindow(Func getTitle, Func getControl, double? height = null, double? width = null) => ShowModalViewWindow(getTitle(_windowFactory), getControl, height, width); - private void ShowWindow(string title, Func getControl, double height, double width) + private void ShowWindow(string title, Func getControl, double? height = null, double? width = null) { var control = getControl(_controlFactory); var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width); window.Show(); } - private void ShowWindowDialog(string title, Func getControl, double height, double width) + private void ShowWindowDialog(string title, Func getControl, double? height = null, double? width = null) { var control = getControl(_controlFactory); var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width); window.ShowDialog(); } - private void ShowModalViewWindow(string title, Func getControl) - { - var control = getControl(_controlFactory); - var window = _windowFactory.GetGenericModalViewWindow(title, control); - window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => BeWoApp.MainControl.CloseCurrentPopUp())); - BeWoApp.MainControl.ShowControlAsModalPopup(window); - } - - private void ShowModalViewWindow(string title, Func getControl, double height, double width) + private void ShowModalViewWindow(string title, Func getControl, double? height = null, double? width = null) { var control = getControl(_controlFactory); var window = _windowFactory.GetGenericModalViewWindow(title, control, height, width); window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => BeWoApp.MainControl.CloseCurrentPopUp())); BeWoApp.MainControl.ShowControlAsModalPopup(window); } - public void ShowTest(string str) - { - throw new NotImplementedException(); - } } } diff --git a/BeWo/Services/IWindowFactory.cs b/BeWo/Services/IWindowFactory.cs index e5a11d74e..a17422464 100644 --- a/BeWo/Services/IWindowFactory.cs +++ b/BeWo/Services/IWindowFactory.cs @@ -13,7 +13,7 @@ namespace BeWo.Services { internal interface IWindowFactory { - AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double height, double width); + AnimatedBeWoWindow GetAnimatedBeWoWindow(string title, Control control, double? height = null, double? width = null); Control GetGenericModalViewWindow(string title, Control control, double? height = null, double? width = null); string GetAiTitle(UIContext context); diff --git a/BeWo/Services/IWindowService.cs b/BeWo/Services/IWindowService.cs index b2cd66951..2f3f500fd 100644 --- a/BeWo/Services/IWindowService.cs +++ b/BeWo/Services/IWindowService.cs @@ -14,13 +14,23 @@ namespace BeWo.Services { internal interface IWindowService { + #region special void ShowAiConversationWindow(UIContext uIContext, Dictionary bewoObjects, long? reference_oid = null, double height = 600, double width = 1200); void ShowAiConversationModalViewWindow(UIContext uIContext, Dictionary bewoObjects, long? reference_oid = null, double height = 600, double width = 1200); - void ShowERechnungModalViewWindow(MemoryStream pdf); + void ShowGkvAbrechnungDetailWindow(GkvAbrechnungVM vm, CancelEventHandler cancelEvent, double height = 900, double width = 600); + #endregion + #region base extended + void ShowERechnungWindow(MemoryStream pdf); + void ShowERechnungModalViewWindow(MemoryStream pdf); + #endregion + + #region base void ShowTextViewerWindow(string title, string text, double height = 900, double width = 600); - void ShowGkvAbrechnungDetailWindow(GkvAbrechnungVM vm, CancelEventHandler cancelEvent, double height = 900, double width = 600); + void ShowPdfViewerWindow(string title, MemoryStream pdf, double height = 900, double width = 600); + void ShowPdfViewerModalViewWindow(string title, MemoryStream pdf); + #endregion } } diff --git a/BeWo/View/Controls/TextViewer.xaml b/BeWo/View/Controls/TextViewer.xaml index 7a994debb..4ff5787ea 100644 --- a/BeWo/View/Controls/TextViewer.xaml +++ b/BeWo/View/Controls/TextViewer.xaml @@ -27,7 +27,8 @@ BorderThickness="1" Foreground="Black" IsReadOnly="True" - VerticalScrollBarVisibility="Auto" /> + VerticalScrollBarVisibility="Auto" + HorizontalScrollBarVisibility="Auto"/>