This commit is contained in:
2025-06-02 11:16:35 +02:00
parent 924a5072e8
commit 1e1bd2e53e
53 changed files with 423 additions and 148 deletions

View File

@@ -98,6 +98,7 @@
<Compile Include="Converter\AddressToStringConverter.cs" /> <Compile Include="Converter\AddressToStringConverter.cs" />
<Compile Include="Converter\Features\AiConversationMessageSystemConverter.cs" /> <Compile Include="Converter\Features\AiConversationMessageSystemConverter.cs" />
<Compile Include="Converter\NewlineConverter.cs" /> <Compile Include="Converter\NewlineConverter.cs" />
<Compile Include="ServiceProxy\GeneratedAccountingEnhancedService.cs" />
<Compile Include="ServiceProxy\GeneratedAiEnhancedService.cs" /> <Compile Include="ServiceProxy\GeneratedAiEnhancedService.cs" />
<Compile Include="Services\BeWoControlFactory.cs" /> <Compile Include="Services\BeWoControlFactory.cs" />
<Compile Include="Services\BeWoWindowFactory.cs" /> <Compile Include="Services\BeWoWindowFactory.cs" />

View File

@@ -2045,19 +2045,6 @@ namespace BeWo.Core
BeWoApp.MainControl.EndWaiting(); 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) public static PasswortSecurityStrength CheckPasswordSecurity(string paswd)
{ {
PasswortSicherheit pwS = new PasswortSicherheit(); PasswortSicherheit pwS = new PasswortSicherheit();

View File

@@ -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%"

View File

@@ -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.

View File

@@ -0,0 +1,61 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
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>, 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);
}
}
}

View File

@@ -20,9 +20,7 @@ namespace BeWo.ServiceProxy
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IOperationsEnhancedService/CreateXRechnung", ReplyAction="http://tempuri.org/IOperationsEnhancedService/CreateXRechnungResponse")] [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.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))] byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url);
[System.ServiceModel.ServiceKnownTypeAttribute(typeof(BeWo.ServiceProxy.BeWoFaultType))]
object CreateXRechnung(long invoice_base_oid, int report_type, string report_url);
} }
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@@ -64,7 +62,7 @@ namespace BeWo.ServiceProxy
base.Channel.HelloWorld(); 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); return base.Channel.CreateXRechnung(invoice_base_oid, report_type, report_url);
} }

View File

@@ -65,7 +65,8 @@ namespace BeWo.ServiceProxy
{ typeof(IAccountingService), new EndpointAddress(_ServerName + "AccountingService.svc") }, { typeof(IAccountingService), new EndpointAddress(_ServerName + "AccountingService.svc") },
{ typeof(IGkvAccountingService), new EndpointAddress(_ServerName + "GkvAccountingService.svc") }, { typeof(IGkvAccountingService), new EndpointAddress(_ServerName + "GkvAccountingService.svc") },
{ typeof(IReportService), new EndpointAddress(_ServerName + "ReportService.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<Type, object>(); _ProxyCache = new Dictionary<Type, object>();
} }
#region AccountingEnhancedService
public static void DoAccountingEnhancedServiceSnyc(Action<IAccountingEnhancedService> pAction)
=> DoSync<AccountingEnhancedServiceClient, IAccountingEnhancedService>(pAction);
public static T DoAccountingEnhancedServiceSnyc<T>(Func<IAccountingEnhancedService, T> pFunc)
=> DoSync<AccountingEnhancedServiceClient, IAccountingEnhancedService, T>(pFunc);
public static void DoAccountingEnhancedServiceAsnyc(Action<IAccountingEnhancedService> pAction, Action pCallback = null, Action<Exception> pErrorCallback = null, bool showWaitDialog = true, UserControl caller = null)
=> DoAsync<AccountingEnhancedServiceClient, IAccountingEnhancedService>(pAction, pCallback, pErrorCallback, showWaitDialog, caller?.Dispatcher);
public static void DoAccountingEnhancedServiceAsnyc<T>(Func<IAccountingEnhancedService, T> pFunc, Action<T> pCallback = null, Action<Exception> pErrorCallback = null, bool showWaitDialog = true, UserControl caller = null)
=> DoAsync<AccountingEnhancedServiceClient, IAccountingEnhancedService, T>(pFunc, pCallback, pErrorCallback, showWaitDialog, caller?.Dispatcher);
#endregion
#region AiEnhancedService #region AiEnhancedService
public static void DoAiEnhancedServiceSnyc(Action<IAiEnhancedService> pAction) public static void DoAiEnhancedServiceSnyc(Action<IAiEnhancedService> pAction)
=> DoSync<AiEnhancedServiceClient, IAiEnhancedService>(pAction); => DoSync<AiEnhancedServiceClient, IAiEnhancedService>(pAction);

View File

@@ -9,17 +9,25 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Controls.Primitives;
namespace BeWo.Services namespace BeWo.Services
{ {
internal class BeWoWindowFactory : IWindowFactory 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(); var beWoWindow = new AnimatedBeWoWindow();
beWoWindow.Height = height; if (height is double h)
beWoWindow.Width = width; 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.WindowStartupLocation = WindowStartupLocation.CenterOwner;
beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow; beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow;

View File

@@ -52,6 +52,13 @@ namespace BeWo.Services
height, width); height, width);
} }
public void ShowERechnungWindow(MemoryStream pdf)
{
ShowWindowDialog(
"E-Rechnung",
cf => cf.GetPdfViewer(pdf));
}
public void ShowERechnungModalViewWindow(MemoryStream pdf) public void ShowERechnungModalViewWindow(MemoryStream pdf)
{ {
ShowModalViewWindow( ShowModalViewWindow(
@@ -67,6 +74,19 @@ namespace BeWo.Services
height, width); 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) public void ShowGkvAbrechnungDetailWindow(GkvAbrechnungVM vm, CancelEventHandler cancelEvent, double height, double width)
{ {
// Kleiner Hack // Kleiner Hack
@@ -80,45 +100,31 @@ namespace BeWo.Services
private void ShowWindow(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double height, double width) private void ShowWindow(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double height, double width)
=> ShowWindow(getTitle(_windowFactory), getControl, height, width); => ShowWindow(getTitle(_windowFactory), getControl, height, width);
private void ShowWindowDialog(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double height, double width) private void ShowWindowDialog(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double? height = null, double? width = null)
=> ShowWindowDialog(getTitle(_windowFactory), getControl, height, width); => ShowWindowDialog(getTitle(_windowFactory), getControl, height, width);
private void ShowModalViewWindow(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl) private void ShowModalViewWindow(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double? height = null, double? width = null)
=> ShowModalViewWindow(getTitle(_windowFactory), getControl);
private void ShowModalViewWindow(Func<IWindowFactory, string> getTitle, Func<IControlFactory, Control> getControl, double height, double width)
=> ShowModalViewWindow(getTitle(_windowFactory), getControl, height, width); => ShowModalViewWindow(getTitle(_windowFactory), getControl, height, width);
private void ShowWindow(string title, Func<IControlFactory, Control> getControl, double height, double width) private void ShowWindow(string title, Func<IControlFactory, Control> getControl, double? height = null, double? width = null)
{ {
var control = getControl(_controlFactory); var control = getControl(_controlFactory);
var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width); var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width);
window.Show(); window.Show();
} }
private void ShowWindowDialog(string title, Func<IControlFactory, Control> getControl, double height, double width) private void ShowWindowDialog(string title, Func<IControlFactory, Control> getControl, double? height = null, double? width = null)
{ {
var control = getControl(_controlFactory); var control = getControl(_controlFactory);
var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width); var window = _windowFactory.GetAnimatedBeWoWindow(title, control, height, width);
window.ShowDialog(); window.ShowDialog();
} }
private void ShowModalViewWindow(string title, Func<IControlFactory, Control> getControl) private void ShowModalViewWindow(string title, Func<IControlFactory, Control> getControl, double? height = null, double? width = null)
{
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<IControlFactory, Control> getControl, double height, double width)
{ {
var control = getControl(_controlFactory); var control = getControl(_controlFactory);
var window = _windowFactory.GetGenericModalViewWindow(title, control, height, width); var window = _windowFactory.GetGenericModalViewWindow(title, control, height, width);
window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => BeWoApp.MainControl.CloseCurrentPopUp())); window.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (s, e) => BeWoApp.MainControl.CloseCurrentPopUp()));
BeWoApp.MainControl.ShowControlAsModalPopup(window); BeWoApp.MainControl.ShowControlAsModalPopup(window);
} }
public void ShowTest(string str)
{
throw new NotImplementedException();
}
} }
} }

View File

@@ -13,7 +13,7 @@ namespace BeWo.Services
{ {
internal interface IWindowFactory 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); Control GetGenericModalViewWindow(string title, Control control, double? height = null, double? width = null);
string GetAiTitle(UIContext context); string GetAiTitle(UIContext context);

View File

@@ -14,13 +14,23 @@ namespace BeWo.Services
{ {
internal interface IWindowService internal interface IWindowService
{ {
#region special
void ShowAiConversationWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null, double height = 600, double width = 1200); void ShowAiConversationWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null, double height = 600, double width = 1200);
void ShowAiConversationModalViewWindow(UIContext uIContext, Dictionary<TableID, long[]> bewoObjects, long? reference_oid = null, double height = 600, double width = 1200); void ShowAiConversationModalViewWindow(UIContext uIContext, Dictionary<TableID, long[]> 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 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
} }
} }

View File

@@ -27,7 +27,8 @@
BorderThickness="1" BorderThickness="1"
Foreground="Black" Foreground="Black"
IsReadOnly="True" IsReadOnly="True"
VerticalScrollBarVisibility="Auto" /> VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"/>
</Grid> </Grid>
<Button <Button

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Policy; using System.Security.Policy;
using System.Text;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Documents; using System.Windows.Documents;
@@ -657,7 +658,25 @@ namespace BeWo.View.Detail.Accounting
ServiceFacade.DoOperationsEnhancedServiceAsnyc( ServiceFacade.DoOperationsEnhancedServiceAsnyc(
x => x.CreateXRechnung(invoice_base_oid, invoice_type, report_link), x => x.CreateXRechnung(invoice_base_oid, invoice_type, report_link),
cb => BeWoApp.MainControl.WindowService.ShowTextViewerWindow("Debug", cb as string)); cb =>
{
if (cb is byte[] bytes)
{
File.WriteAllBytes(@"C:\Users\ownSoft\Desktop\XRechnung\test.pdf", bytes);
var t = Encoding.ASCII.GetString(bytes);
File.WriteAllText(@"C:\Users\ownSoft\Desktop\XRechnung\test2.pdf", t);
BeWoApp.MainControl.WindowService.ShowTextViewerWindow("Test", t);
//BeWoApp.MainControl.WindowService.ShowERechnungWindow(new MemoryStream(bytes));
}
else
MessageBox.Show("cb is null");
});
} }
} }
} }

View File

@@ -1,4 +1,5 @@
using System; using BS.Shared.Interface;
using System;
namespace BeWo.Data.Access namespace BeWo.Data.Access
{ {
@@ -23,5 +24,10 @@ namespace BeWo.Data.Access
public static ScriptDAO ScriptDAO => _ScriptDAO.Value; public static ScriptDAO ScriptDAO => _ScriptDAO.Value;
public static SearchDAO SearchDAO => _SearchDAO.Value; public static SearchDAO SearchDAO => _SearchDAO.Value;
public static UserDAO UserDAO => _UserDAO.Value; public static UserDAO UserDAO => _UserDAO.Value;
public static IFileStorageDAO GetLocalFileStorage(string rootpath)
{
return new LocalFileStorageDAO(rootpath);
}
} }
} }

View File

@@ -0,0 +1,66 @@
using BS.Shared;
using BS.Shared.Interface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BeWo.Data.Access
{
public class LocalFileStorageDAO : IFileStorageDAO
{
private readonly string _rootPath;
public LocalFileStorageDAO(string rootPath)
{
_rootPath = rootPath;
}
private string GetFilePath(string customerId, BWPFeature feature, string fileName)
{
return Path.Combine(_rootPath, customerId, feature.ToString(), fileName);
}
public async Task SaveFileAsync(string customerId, BWPFeature feature, string fileName, Stream content, CancellationToken cancellationToken = default)
{
var path = GetFilePath(customerId, feature, fileName);
var directory = Path.GetDirectoryName(path);
Directory.CreateDirectory(directory);
using (var stream = File.Create(path))
{
await content.CopyToAsync(stream, bufferSize: 81920, cancellationToken).ConfigureAwait(true);
};
}
public Task<bool> FileExistsAsync(string customerId, BWPFeature feature, string fileName, CancellationToken cancellationToken = default)
{
return Task.FromResult(File.Exists(GetFilePath(customerId, feature, fileName)));
}
public Task<Stream> GetFileAsync(string customerId, BWPFeature feature, string fileName, CancellationToken cancellationToken = default)
{
var path = GetFilePath(customerId, feature, fileName);
if (!File.Exists(path))
return Task.FromResult<Stream>(null);
Stream stream = File.OpenRead(path);
return Task.FromResult(stream);
}
public Task<bool> DeleteFileAsync(string customerId, BWPFeature feature, string fileName, CancellationToken cancellationToken = default)
{
var path = GetFilePath(customerId, feature, fileName);
if (File.Exists(path))
{
File.Delete(path);
return Task.FromResult(true);
}
return Task.FromResult(false);
}
}
}

View File

@@ -212,6 +212,7 @@
<Compile Include="Access\DAOFactory.cs" /> <Compile Include="Access\DAOFactory.cs" />
<Compile Include="Access\GenericDAO.cs" /> <Compile Include="Access\GenericDAO.cs" />
<Compile Include="Access\FinanceDAO.cs" /> <Compile Include="Access\FinanceDAO.cs" />
<Compile Include="Access\LocalFileStorageDAO.cs" />
<Compile Include="Access\OrganisationDAO.cs" /> <Compile Include="Access\OrganisationDAO.cs" />
<Compile Include="Access\ScriptDAO.cs" /> <Compile Include="Access\ScriptDAO.cs" />
<Compile Include="Access\SearchDAO.cs" /> <Compile Include="Access\SearchDAO.cs" />

View File

@@ -0,0 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.Enhanced.AccountingEnhancedServiceImp" %>

View File

@@ -1 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.AiEnhancedServiceImp" %> <%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.Enhanced.AiEnhancedServiceImp" %>

View File

@@ -426,6 +426,7 @@
<Content Include="GkvAbrechnungClient.aspx" /> <Content Include="GkvAbrechnungClient.aspx" />
<Content Include="GkvAbrechnungServer.aspx" /> <Content Include="GkvAbrechnungServer.aspx" />
<Content Include="AiEnhancedService.svc" /> <Content Include="AiEnhancedService.svc" />
<Content Include="AccountingEnhancedService.svc" />
<Content Include="OperationsEnhancedService.svc" /> <Content Include="OperationsEnhancedService.svc" />
<Content Include="ReportService.svc" /> <Content Include="ReportService.svc" />
<Content Include="EmployeeService.svc" /> <Content Include="EmployeeService.svc" />

View File

@@ -1,6 +1,5 @@
using BeWo.Data; using BeWo.Data;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Service.ServiceImplementations;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;

View File

@@ -1 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.OperationsEnhancedServiceImp" %> <%@ ServiceHost Language="C#" Debug="true" Service="BeWo.Service.ServiceImplementations.Enhanced.OperationsEnhancedServiceImp" %>

View File

@@ -13,7 +13,6 @@ using BeWo.Data;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceImplementations;
using BS.Shared; using BS.Shared;
using BS.Shared.Extensions; using BS.Shared.Extensions;

View File

@@ -184,11 +184,14 @@
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.ApiStreamServiceImp"> <service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.ApiStreamServiceImp">
<endpoint behaviorConfiguration="webHttpBehaviorConfig" binding="webHttpBinding" bindingConfiguration="webHttpStreamBindingConfig" name="ApiStreamServiceEndpoint" contract="BeWo.Service.ServiceContracts.IApiStreamService" /> <endpoint behaviorConfiguration="webHttpBehaviorConfig" binding="webHttpBinding" bindingConfiguration="webHttpStreamBindingConfig" name="ApiStreamServiceEndpoint" contract="BeWo.Service.ServiceContracts.IApiStreamService" />
</service> </service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.OperationsEnhancedServiceImp"> <service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.Enhanced.OperationsEnhancedServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionAndWCFErrorBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="OperationsEnhancedServiceEndpoint" contract="BeWo.Service.ServiceContracts.IOperationsEnhancedService" /> <endpoint behaviorConfiguration="SecurityAndSessionAndWCFErrorBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="OperationsEnhancedServiceEndpoint" contract="BeWo.Service.ServiceContracts.Enhanced.IOperationsEnhancedService" />
</service> </service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.AiEnhancedServiceImp"> <service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.Enhanced.AccountingEnhancedServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionAndWCFErrorBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="AiEnhancedServiceEndpoint" contract="BeWo.Service.ServiceContracts.IAiEnhancedService" /> <endpoint behaviorConfiguration="SecurityAndSessionAndWCFErrorBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="AccountingEnhancedServiceEndpoint" contract="BeWo.Service.ServiceContracts.Enhanced.IAccountingEnhancedService" />
</service>
<service behaviorConfiguration="returnFaults" name="BeWo.Service.ServiceImplementations.Enhanced.AiEnhancedServiceImp">
<endpoint behaviorConfiguration="SecurityAndSessionAndWCFErrorBehavior" binding="basicHttpBinding" bindingConfiguration="TransportSecurity" name="AiEnhancedServiceEndpoint" contract="BeWo.Service.ServiceContracts.Enhanced.IAiEnhancedService" />
</service> </service>
</services> </services>
<bindings> <bindings>

View File

@@ -6,7 +6,6 @@ using BeWo.Data.Entities;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins; using BeWo.Service.Plugins;
using BeWo.Service.ServiceImplementations;
using BS.Shared.Core; using BS.Shared.Core;
using BS.Shared; using BS.Shared;
using BS.Shared.Extensions; using BS.Shared.Extensions;

View File

@@ -6,7 +6,6 @@ using BeWo.Report;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Service.Configuration; using BeWo.Service.Configuration;
using BeWo.Service.ServiceImplementations;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;
using BS.Shared.Extensions; using BS.Shared.Extensions;

View File

@@ -6,7 +6,6 @@ using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.Plugins; using BeWo.Service.Plugins;
using BS.Shared.DataContracts; using BS.Shared.DataContracts;
using BeWo.Service.ServiceImplementations;
namespace BeWo.Service.DCEntityMapper namespace BeWo.Service.DCEntityMapper
{ {

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.ServiceImplementations;
using BS.Shared; using BS.Shared;
using BS.Shared.DataContracts; using BS.Shared.DataContracts;
using BS.Shared.Extensions; using BS.Shared.Extensions;

View File

@@ -7,7 +7,6 @@ using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins; using BeWo.Service.Plugins;
using BeWo.Service.ServiceImplementations;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;

View File

@@ -7,7 +7,6 @@ using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Plugins; using BeWo.Service.Plugins;
using BeWo.Service.ServiceImplementations;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;

View File

@@ -10,7 +10,6 @@ using BeWo.Service.Configuration;
using BeWo.Service.Core; using BeWo.Service.Core;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Invoicing; using BeWo.Service.Invoicing;
using BeWo.Service.ServiceContracts;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;
using BS.Shared.DataContracts; using BS.Shared.DataContracts;

View File

@@ -10,7 +10,6 @@ using BeWo.Data.Entities;
using BeWo.Service.Core; using BeWo.Service.Core;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.Invoicing; using BeWo.Service.Invoicing;
using BeWo.Service.ServiceContracts;
using BS.Shared; using BS.Shared;
using BS.Shared.Core; using BS.Shared.Core;
using BS.Shared.DataContracts; using BS.Shared.DataContracts;

View File

@@ -12,7 +12,6 @@ using BeWo.Data;
using BeWo.Data.Access; using BeWo.Data.Access;
using BeWo.Data.Entities; using BeWo.Data.Entities;
using BeWo.Service.Core; using BeWo.Service.Core;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceUtils; using BeWo.Service.ServiceUtils;
using BS.Shared.Attributes; using BS.Shared.Attributes;
using BS.Shared.Extensions; using BS.Shared.Extensions;

View File

@@ -520,6 +520,7 @@
<Compile Include="ServiceBehavior\WCFError\WCFErrorBehaviorExtension.cs" /> <Compile Include="ServiceBehavior\WCFError\WCFErrorBehaviorExtension.cs" />
<Compile Include="ServiceBehavior\WCFError\WCFErrorHandler.cs" /> <Compile Include="ServiceBehavior\WCFError\WCFErrorHandler.cs" />
<Compile Include="ServiceContracts\BeWoFault.cs" /> <Compile Include="ServiceContracts\BeWoFault.cs" />
<Compile Include="ServiceContracts\Enhanced\IAccountingEnhancedService.cs" />
<Compile Include="ServiceContracts\IAccountingService.cs" /> <Compile Include="ServiceContracts\IAccountingService.cs" />
<Compile Include="ServiceContracts\IAdminService.cs" /> <Compile Include="ServiceContracts\IAdminService.cs" />
<Compile Include="ServiceContracts\IAnalysisService.cs" /> <Compile Include="ServiceContracts\IAnalysisService.cs" />
@@ -527,8 +528,8 @@
<Compile Include="ServiceContracts\IApiService.cs" /> <Compile Include="ServiceContracts\IApiService.cs" />
<Compile Include="ServiceContracts\IGkvAccountingService.cs" /> <Compile Include="ServiceContracts\IGkvAccountingService.cs" />
<Compile Include="ServiceContracts\IMailService.cs" /> <Compile Include="ServiceContracts\IMailService.cs" />
<Compile Include="ServiceContracts\IAiEnhancedService.cs" /> <Compile Include="ServiceContracts\Enhanced\IAiEnhancedService.cs" />
<Compile Include="ServiceContracts\IOperationsEnhancedService.cs" /> <Compile Include="ServiceContracts\Enhanced\IOperationsEnhancedService.cs" />
<Compile Include="ServiceContracts\IOperationsService.cs" /> <Compile Include="ServiceContracts\IOperationsService.cs" />
<Compile Include="ServiceContracts\IDownloadService.cs" /> <Compile Include="ServiceContracts\IDownloadService.cs" />
<Compile Include="ServiceContracts\IEmployeeService.cs" /> <Compile Include="ServiceContracts\IEmployeeService.cs" />
@@ -543,10 +544,11 @@
<Compile Include="ServiceImplementations\ApiServiceImp.cs" /> <Compile Include="ServiceImplementations\ApiServiceImp.cs" />
<Compile Include="ServiceImplementations\AdminServiceImp.cs" /> <Compile Include="ServiceImplementations\AdminServiceImp.cs" />
<Compile Include="ServiceImplementations\AnalysisServiceImp.cs" /> <Compile Include="ServiceImplementations\AnalysisServiceImp.cs" />
<Compile Include="ServiceImplementations\Enhanced\AccountingEnhancedServiceImp.cs" />
<Compile Include="ServiceImplementations\GkvAccountingServiceImp.cs" /> <Compile Include="ServiceImplementations\GkvAccountingServiceImp.cs" />
<Compile Include="ServiceImplementations\MailServiceImp.cs" /> <Compile Include="ServiceImplementations\MailServiceImp.cs" />
<Compile Include="ServiceImplementations\AiEnhancedServiceImp.cs" /> <Compile Include="ServiceImplementations\Enhanced\AiEnhancedServiceImp.cs" />
<Compile Include="ServiceImplementations\OperationsEnhancedServiceImp.cs" /> <Compile Include="ServiceImplementations\Enhanced\OperationsEnhancedServiceImp.cs" />
<Compile Include="ServiceImplementations\OperationsServiceImp.cs" /> <Compile Include="ServiceImplementations\OperationsServiceImp.cs" />
<Compile Include="ServiceImplementations\QueryServiceImp.cs" /> <Compile Include="ServiceImplementations\QueryServiceImp.cs" />
<Compile Include="ServiceImplementations\SearchServiceImp.cs" /> <Compile Include="ServiceImplementations\SearchServiceImp.cs" />

View File

@@ -0,0 +1,22 @@
using BeWo.Data.Entities;
using BS.Shared;
using BS.Shared.Attributes;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Feature.AI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceContracts.Enhanced
{
[ServiceContract]
public interface IAccountingEnhancedService : IService
{
[FaultContract(typeof(BeWoFault))]
[OperationContract]
byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url);
}
}

View File

@@ -10,7 +10,7 @@ using System.ServiceModel;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace BeWo.Service.ServiceContracts namespace BeWo.Service.ServiceContracts.Enhanced
{ {
[ServiceContract] [ServiceContract]
public interface IAiEnhancedService : IService public interface IAiEnhancedService : IService

View File

@@ -10,17 +10,13 @@ using System.ServiceModel;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace BeWo.Service.ServiceContracts namespace BeWo.Service.ServiceContracts.Enhanced
{ {
[ServiceContract] [ServiceContract]
public interface IOperationsEnhancedService : IService public interface IOperationsEnhancedService : IService
{ {
[FaultContract(typeof(BeWoFault))] [FaultContract(typeof(BeWoFault))]
[OperationContract] [OperationContract]
void HelloWorld(); string HelloWorld();
[FaultContract(typeof(BeWoFault))]
[OperationContract]
object CreateXRechnung(long invoice_base_oid, int report_type, string report_url);
} }
} }

View File

@@ -24,17 +24,5 @@ namespace BeWo.Service.ServiceContracts
[WebInvoke(UriTemplate = "/GetGkvSum", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] [WebInvoke(UriTemplate = "/GetGkvSum", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
[RequireApiKey("GetGkvSumApiKey")] [RequireApiKey("GetGkvSumApiKey")]
ApiResponse<decimal> GetGkvAbrechnungSumme(AdminServiceSumReqDC request); ApiResponse<decimal> GetGkvAbrechnungSumme(AdminServiceSumReqDC request);
[OperationContract]
[WebInvoke(UriTemplate = "/DownloadReport", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
[RequireApiKey("DownloadReportApiKey")]
[RequireNoTenant]
ApiResponse<byte[]> DownloadReport();
[OperationContract]
[WebGet(UriTemplate = "/DownloadReport", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
[RequireApiKey("DownloadReportApiKey")]
[RequireNoTenant]
ApiResponse<byte[]> DownloadReport2();
} }
} }

View File

@@ -16,7 +16,7 @@ namespace BeWo.Service.ServiceContracts
public interface IApiStreamService public interface IApiStreamService
{ {
[OperationContract] [OperationContract]
[WebInvoke(UriTemplate = "/DownloadReport", Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] [WebGet(UriTemplate = "/DownloadReport", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
[RequireApiKey("DownloadReportApiKey")] [RequireApiKey("DownloadReportApiKey")]
[RequireNoTenant] [RequireNoTenant]
Stream DownloadReport(); Stream DownloadReport();

View File

@@ -45,25 +45,5 @@ namespace BeWo.Service.ServiceImplementations
return ApiResponse<decimal>.SuccessResponse(sum ?? 0); return ApiResponse<decimal>.SuccessResponse(sum ?? 0);
} }
public ApiResponse<byte[]> DownloadReport()
{
string filename = "xrechnung.pdf";
string filePath = Path.Combine(@"C:\Users\ownSoft\Desktop\XRechnung\", filename);
if (!File.Exists(filePath))
throw new FileNotFoundException("Datei nicht gefunden");
// Setze die Header
WebOperationContext.Current.OutgoingResponse.ContentType = "application/pdf";
WebOperationContext.Current.OutgoingResponse.Headers.Add(
"Content-Disposition", $"attachment; filename=\"{filename}\"");
var data = File.ReadAllBytes(filePath);
return ApiResponse<byte[]>.SuccessResponse(data);
}
public ApiResponse<byte[]> DownloadReport2() => DownloadReport();
} }
} }

View File

@@ -32,23 +32,18 @@ namespace BeWo.Service.ServiceImplementations
WebOperationContext.Current.OutgoingResponse.Headers.Add( WebOperationContext.Current.OutgoingResponse.Headers.Add(
"Content-Disposition", $"attachment; filename=\"{filename}\""); "Content-Disposition", $"attachment; filename=\"{filename}\"");
return new FileStream(filePath, FileMode.Open, FileAccess.Read); FileStream f = new FileStream(filePath, FileMode.Open);
} int length = (int)f.Length;
WebOperationContext.Current.OutgoingResponse.ContentLength = length;
public Stream DownloadReport2() byte[] buffer = new byte[length];
int sum = 0;
int count;
while ((count = f.Read(buffer, sum, length - sum)) > 0)
{ {
string filename = "xrechnung.pdf"; sum += count;
}
string filePath = Path.Combine(@"C:\Users\ownSoft\Desktop\XRechnung\", filename); f.Close();
if (!File.Exists(filePath)) return new MemoryStream(buffer);
throw new FileNotFoundException("Datei nicht gefunden");
// Setze die Header
WebOperationContext.Current.OutgoingResponse.ContentType = "application/pdf";
WebOperationContext.Current.OutgoingResponse.Headers.Add(
"Content-Disposition", $"attachment; filename=\"{filename}\"");
return new FileStream(filePath, FileMode.Open, FileAccess.Read);
} }
} }
} }

View File

@@ -4,7 +4,7 @@ using BeWo.Data.Entities;
using BeWo.Data.Models.XRechnung; using BeWo.Data.Models.XRechnung;
using BeWo.Data.Security; using BeWo.Data.Security;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts; using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.ServiceProxy; using BeWo.Service.ServiceProxy;
using BeWo.Service.ServiceUtils; using BeWo.Service.ServiceUtils;
using BeWo.Service.ServiceUtils.XRechnung; using BeWo.Service.ServiceUtils.XRechnung;
@@ -24,17 +24,12 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace BeWo.Service.ServiceImplementations namespace BeWo.Service.ServiceImplementations.Enhanced
{ {
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class OperationsEnhancedServiceImp : IOperationsEnhancedService public class AccountingEnhancedServiceImp : IAccountingEnhancedService
{ {
public void HelloWorld() public byte[] CreateXRechnung(long invoice_base_oid, int report_type, string report_url)
{
throw new NotImplementedException();
}
public object CreateXRechnung(long invoice_base_oid, int report_type, string report_url)
{ {
if (string.IsNullOrWhiteSpace(report_url)) if (string.IsNullOrWhiteSpace(report_url))
throw new ArgumentNullException(nameof(report_url)); throw new ArgumentNullException(nameof(report_url));

View File

@@ -4,7 +4,7 @@ using BeWo.Data.Entities;
using BeWo.Data.Security; using BeWo.Data.Security;
using BeWo.Service.AI; using BeWo.Service.AI;
using BeWo.Service.DCEntityMapper; using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts; using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.ServiceProxy; using BeWo.Service.ServiceProxy;
using BeWo.Service.ServiceUtils; using BeWo.Service.ServiceUtils;
using BS.Shared; using BS.Shared;
@@ -27,7 +27,7 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Interop; using System.Windows.Interop;
namespace BeWo.Service.ServiceImplementations namespace BeWo.Service.ServiceImplementations.Enhanced
{ {
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class AiEnhancedServiceImp : IAiEnhancedService public class AiEnhancedServiceImp : IAiEnhancedService

View File

@@ -0,0 +1,37 @@
using BeWo.Data;
using BeWo.Data.Access;
using BeWo.Data.Entities;
using BeWo.Data.Models.XRechnung;
using BeWo.Data.Security;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.ServiceProxy;
using BeWo.Service.ServiceUtils;
using BeWo.Service.ServiceUtils.XRechnung;
using BS.Shared;
using BS.Shared.DataContracts;
using BS.Shared.DataContracts.Feature.AI;
using BS.Shared.DataContracts.Invoicing.XRechnung;
using BS.Shared.DataContracts.MikePHPContracts;
using DevExpress.Entity.Model.Metadata;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.ServiceModel;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BeWo.Service.ServiceImplementations.Enhanced
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
public class OperationsEnhancedServiceImp : IOperationsEnhancedService
{
public string HelloWorld()
{
return "OperationEnhancedService: Hello World!";
}
}
}

View File

@@ -16,7 +16,7 @@ namespace BeWo.Service.ServiceProxy
{ {
public class XRechnungFacade : WebClientFacade public class XRechnungFacade : WebClientFacade
{ {
public string Create(object xrechnung, string url) public byte[] Create(object xrechnung, string url)
{ {
var sub_url = "create"; var sub_url = "create";
@@ -26,7 +26,7 @@ namespace BeWo.Service.ServiceProxy
pdf = url pdf = url
}; };
var test = SendPostUploadValues<object, string>(sub_url, payload); var test = SendPostUploadValues<object, byte[]>(sub_url, payload);
return test; return test;
} }

View File

@@ -42,7 +42,7 @@ namespace BeWo.Service.ServiceUtils.DistanceCalculator
} }
private string Key { get; set; } private string Key { get; set; }
private string GeoKey { get; set; } private string GeoUrl { get; set; }
private string Url { get; set; } private string Url { get; set; }
private AddressRouteMatrix Matrix { get; set; } private AddressRouteMatrix Matrix { get; set; }
@@ -63,11 +63,11 @@ namespace BeWo.Service.ServiceUtils.DistanceCalculator
Key = MergedConfig.GetSecretSetting("OpenrouteServiceApiKey"); Key = MergedConfig.GetSecretSetting("OpenrouteServiceApiKey");
if (string.IsNullOrEmpty(Key)) if (string.IsNullOrEmpty(Key))
{ {
throw new Exception("OpenrouteServiceApiKey is not set in AppSettings."); throw new Exception("OpenrouteServiceApiKey is not set.");
} }
GeoKey = appSettings["OpenrouteServiceApiUrlGeocode"]; GeoUrl = appSettings["OpenrouteServiceApiUrlGeocode"];
if (string.IsNullOrEmpty(GeoKey)) if (string.IsNullOrEmpty(GeoUrl))
{ {
throw new Exception("OpenrouteServiceApiUrlGeocode is not set in AppSettings."); throw new Exception("OpenrouteServiceApiUrlGeocode is not set in AppSettings.");
} }
@@ -208,7 +208,7 @@ namespace BeWo.Service.ServiceUtils.DistanceCalculator
private string GetGeocodeUrl(Address address) private string GetGeocodeUrl(Address address)
{ {
var html = HttpUtility.UrlEncode(AddressRouteManager.AddressToString(address)); var html = HttpUtility.UrlEncode(AddressRouteManager.AddressToString(address));
return $"{GeoKey}?api_key={Key}&text={html}&sources=openstreetmap&size=1"; return $"{GeoUrl}?api_key={Key}&text={html}&sources=openstreetmap&size=1";
} }
private string GetMatrixBodyContentString() private string GetMatrixBodyContentString()

View File

@@ -9,7 +9,6 @@ using System.ServiceModel.Channels;
using System.ServiceModel.Dispatcher; using System.ServiceModel.Dispatcher;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using BeWo.Service.ServiceContracts;
using BS.Shared.Attributes; using BS.Shared.Attributes;
using BS.Shared.Extensions; using BS.Shared.Extensions;
using NHibernate.Hql.Ast.ANTLR.Tree; using NHibernate.Hql.Ast.ANTLR.Tree;

View File

@@ -1365,4 +1365,11 @@ namespace BS.Shared
Assistent, Assistent,
User User
} }
public enum BWPFeature
{
XRechnung = 10,
GkvAbrechnung = 11,
AiConversation = 12,
}
} }

View File

@@ -26,6 +26,11 @@ namespace BS.Shared.Core
InnerErrors = innerErrors; InnerErrors = innerErrors;
} }
public AppError()
{
}
//public static readonly AppError Example = new AppError("Code", "Message"); //public static readonly AppError Example = new AppError("Code", "Message");
public static readonly Func<OrganisationDC, AppError> GkvDatenannahmestelleAdresseNotFound = (dc) => new AppError("GKV.70001", $"Unbekannte Datenannahmestelle. Bitte neu in der Organisation {dc.Name} ermitteln"); public static readonly Func<OrganisationDC, AppError> GkvDatenannahmestelleAdresseNotFound = (dc) => new AppError("GKV.70001", $"Unbekannte Datenannahmestelle. Bitte neu in der Organisation {dc.Name} ermitteln");

View File

@@ -154,11 +154,14 @@ namespace BS.Shared.Core
private T deserialize<T>(string input) private T deserialize<T>(string input)
{ {
if (string.IsNullOrEmpty(input)) if (string.IsNullOrEmpty(input))
return default(T); return default;
if (typeof(T) == typeof(String)) if (typeof(T) == typeof(string))
return (T)(object)input; return (T)(object)input;
if (typeof(T) == typeof(byte[]))
return (T)(object)Encoding.UTF8.GetBytes(input);
var t = JsonConvert.DeserializeObject<T>(input); var t = JsonConvert.DeserializeObject<T>(input);
return t; return t;

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace BS.Shared.Interface
{
public interface IFileStorageDAO
{
Task SaveFileAsync(string tenant, BWPFeature feature, string fileName, Stream content, CancellationToken cancellationToken = default);
Task<Stream> GetFileAsync(string tenant, BWPFeature feature, string fileName, CancellationToken cancellationToken = default);
Task<bool> DeleteFileAsync(string tenant, BWPFeature feature, string fileName, CancellationToken cancellationToken = default);
Task<bool> FileExistsAsync(string tenant, BWPFeature feature, string fileName, CancellationToken cancellationToken = default);
}
}

View File

@@ -401,6 +401,7 @@
<Compile Include="Extensions\ICollectionExtensions.cs" /> <Compile Include="Extensions\ICollectionExtensions.cs" />
<Compile Include="Extensions\IDictionaryTExtensions.cs" /> <Compile Include="Extensions\IDictionaryTExtensions.cs" />
<Compile Include="Extensions\TimeIntervalExtensions.cs" /> <Compile Include="Extensions\TimeIntervalExtensions.cs" />
<Compile Include="Interface\IFileStorageDAO.cs" />
<Compile Include="Interface\IGkvAbrechnung.cs" /> <Compile Include="Interface\IGkvAbrechnung.cs" />
<Compile Include="Interface\IGkvTransferProtokoll.cs" /> <Compile Include="Interface\IGkvTransferProtokoll.cs" />
<Compile Include="Interface\IInvoiceBase.cs" /> <Compile Include="Interface\IInvoiceBase.cs" />

View File

@@ -29,6 +29,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
@@ -67,7 +68,7 @@
<Name>Data</Name> <Name>Data</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Service\Service.csproj"> <ProjectReference Include="..\Service\Service.csproj">
<Project>{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}</Project> <Project>{094331c3-ecee-4c89-bbfd-4c9ded89f0ef}</Project>
<Name>Service</Name> <Name>Service</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\Shared\Shared.csproj"> <ProjectReference Include="..\Shared\Shared.csproj">