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

@@ -45,25 +45,5 @@ namespace BeWo.Service.ServiceImplementations
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(
"Content-Disposition", $"attachment; filename=\"{filename}\"");
return new FileStream(filePath, FileMode.Open, FileAccess.Read);
}
public Stream DownloadReport2()
{
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}\"");
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;
byte[] buffer = new byte[length];
int sum = 0;
int count;
while ((count = f.Read(buffer, sum, length - sum)) > 0)
{
sum += count;
}
f.Close();
return new MemoryStream(buffer);
}
}
}

View File

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

View File

@@ -4,7 +4,7 @@ using BeWo.Data.Entities;
using BeWo.Data.Security;
using BeWo.Service.AI;
using BeWo.Service.DCEntityMapper;
using BeWo.Service.ServiceContracts;
using BeWo.Service.ServiceContracts.Enhanced;
using BeWo.Service.ServiceProxy;
using BeWo.Service.ServiceUtils;
using BS.Shared;
@@ -27,7 +27,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows.Interop;
namespace BeWo.Service.ServiceImplementations
namespace BeWo.Service.ServiceImplementations.Enhanced
{
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Single)]
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!";
}
}
}