Merge branch 'feature_rene_13_dakota' of ssh://float.ownsoft.de/git/beyondSoft/BeWo

This commit is contained in:
2024-07-03 17:33:10 +02:00
20 changed files with 998 additions and 177 deletions

2
.gitignore vendored
View File

@@ -622,6 +622,8 @@ obj
/CustomerDlls
/Dakota/bin
/Dakota/obj
/DakotaSender/bin
/DakotaSender/obj
/BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Debug
/BeWoDatabaseTerminator/BeWoDatabaseTerminator/bin/Release
/ReportImp/TestLWV

View File

@@ -855,9 +855,6 @@ namespace BeWo
{
if (MainControl != null)
{
MainControl.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action) (() =>
{
UserControl exControl = null;
@@ -924,7 +921,7 @@ namespace BeWo
base.OnStartup(e);
//AppDomain.CurrentDomain.UnhandledException += (s, ex) => ShowError(null, ex.ExceptionObject as Exception, true);
Dispatcher.UnhandledException += (s, ex)
=>
{
@@ -1158,7 +1155,11 @@ namespace BeWo
{
abc.Close();
}
}
else if (abc.Title.IndexOf("Popup") >= 0)
{
abc.Close();
}
}
MainControl.HideCurrentModalViewWindows();

View File

@@ -72,6 +72,7 @@ namespace BeWo.View
beWoWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
beWoWindow.Owner = BeWoApp.CurrentBeWo.MainWindow;
beWoWindow.Title = "Popup";
beWoWindow.rootGroupBox.Header = title;
return beWoWindow;

View File

@@ -106,6 +106,8 @@ namespace BeWo.View.Detail.Accounting
CriteriaOperator.FromLambda<GkvAbrechnungDC>(gkv => gkv.AbrechnungsZeitraumStart <= filter_start && filter_ende <= gkv.AbrechnungsZeitraumEnde));
}
}
gridView.BestFitColumns();
}
private void UpdateGkvAbrechnungList(IList<GkvAbrechnungDC> dcList)
@@ -120,8 +122,6 @@ namespace BeWo.View.Detail.Accounting
datagrid_gkvAbrechnungen.Visibility = Visibility.Visible;
UpdateDataGridFilter();
gridView.BestFitColumns();
});
@@ -206,6 +206,11 @@ namespace BeWo.View.Detail.Accounting
private void btn_force_send_Click(object sender, RoutedEventArgs e)
{
#if DEBUG
#else
return;
#endif
var vm = datagrid_gkvAbrechnungen.GetCurrentValue<GkvAbrechnungVM>();
@@ -228,7 +233,13 @@ namespace BeWo.View.Detail.Accounting
var state = dc.GetState();
var can_send = state == GkvState.NoSend || state == GkvState.Error;
var can_send = false;
can_send |= state == GkvState.NoSend;
can_send |= state == GkvState.Error;
#if DEBUG
can_send |= state == GkvState.ErrorFatal;
#endif
if (!can_send)
{
@@ -321,7 +332,7 @@ namespace BeWo.View.Detail.Accounting
if (gkvAbrechnungVM is null)
return;
if (!gkvAbrechnungVM.Bezahlt && DateTime.Now - gkvAbrechnungVM.ErstelltAm > TimeSpan.FromDays(28))
if (GkvAbrechnungVM.GetState(gkvAbrechnungVM) == GkvState.OldAndNoFeedback)
{
e.Result = Brushes.Orange;
e.Handled = true;

View File

@@ -361,33 +361,36 @@ namespace BeWo.ViewModel
req.GkvAbrechnungOid = GkvAbrechnungOid.Value;
ServiceFacade.DoAccountingServiceAsync(s => s.SendNewGkvAbrechnung(req),
cb => Application.Current.Dispatch(delegate
{
if (cb.GkvAbrechnungDC is GkvAbrechnungDC dc)
{
GkvAbrechnungVersion = dc.GkvAbrechnungVersion;
TransferProtokolle = dc.TransferProtokolle.ToList();
cb => Application.Current.Dispatch(() => Update(cb)), true);
}
var protokoll = cb.TransferProtokoll;
public void Update(GkvAbrechnungSendResponseDC cb)
{
var dc = cb.GkvAbrechnungDC;
if (cb.TransferProtokoll.Fehlerlevel == GkvTransferFehlerlevel.Soft)
{
MessageBox.Show(Application.Current.MainWindow, cb.TransferProtokoll.Fehlernachricht, cb.TransferProtokoll.Fehlertitel);
}
else if (cb.TransferProtokoll.Fehlerlevel == GkvTransferFehlerlevel.Fatal)
{
BeWoApp.ShowError(cb.TransferProtokoll.Fehlertitel + ": " + cb.TransferProtokoll.Fehlernachricht, null, false);
}
else
{
MessageBox.Show(Application.Current.MainWindow, "Ihre Sendung wurde korrekt übertragen");
}
}
else
{
MessageBox.Show(Application.Current.MainWindow, "Unerwarteter Übertragungsfehler");
}
}), true);
if(dc is null)
{
MessageBox.Show(Application.Current.MainWindow, "Unerwarteter Übertragungsfehler");
return;
}
GkvAbrechnungVersion = dc.GkvAbrechnungVersion;
TransferProtokolle = dc.TransferProtokolle.ToList();
var protokoll = cb.TransferProtokoll;
if (protokoll.Fehlerlevel == GkvTransferFehlerlevel.Soft)
{
MessageBox.Show(Application.Current.MainWindow, protokoll.Fehlernachricht, protokoll.Fehlertitel);
}
else if (protokoll.Fehlerlevel == GkvTransferFehlerlevel.Fatal)
{
BeWoApp.ShowError(protokoll.Fehlertitel + ": " + protokoll.Fehlernachricht, null, false);
}
else
{
MessageBox.Show(Application.Current.MainWindow, "Ihre Sendung wurde korrekt übertragen");
}
}
}
}

191
BeWoDakota.sln Normal file
View File

@@ -0,0 +1,191 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33927.289
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Client", "Client", "{E7543C39-A44C-40C9-82C9-E7FAA2D9A852}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{FEB0336B-F053-40B6-92DD-7DE56AB9408A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BeWo", "BeWo\BeWo.csproj", "{3FEBB560-9275-413A-9767-BB68C44EEBC3}"
ProjectSection(ProjectDependencies) = postProject
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3} = {E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF} = {094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Service", "Service\Service.csproj", "{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Data", "Data\Data.csproj", "{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shared", "Shared\Shared.csproj", "{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Controls\Controls.csproj", "{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Report", "Report\Report.csproj", "{40D8B312-EA64-49E3-A31A-5E57ED4D5654}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Host", "Host\Host.csproj", "{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReportingService", "ReportService\ReportingService.csproj", "{663EFCB5-9E3E-4C76-97EE-3188E072634C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChatController", "..\Chat\ChatController\ChatController.csproj", "{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dakota", "Dakota\Dakota.csproj", "{47331732-DD96-4075-869F-83AA9F3F9937}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B6039E62-D43E-477A-BE82-EADB1057A3A2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DakotaSender", "DakotaSender\DakotaSender.csproj", "{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Release|.NET = Release|.NET
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|.NET.ActiveCfg = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|.NET.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|.NET.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Any CPU.Build.0 = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{3FEBB560-9275-413A-9767-BB68C44EEBC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|.NET.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|.NET.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|.NET.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Any CPU.Build.0 = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|.NET.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|.NET.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|.NET.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Any CPU.Build.0 = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|.NET.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|.NET.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|.NET.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Any CPU.Build.0 = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2F50B83D-A3F0-4EC4-979A-3F9B7E3D8ED4}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|.NET.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|.NET.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|.NET.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Any CPU.Build.0 = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|.NET.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|.NET.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|.NET.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Any CPU.Build.0 = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{40D8B312-EA64-49E3-A31A-5E57ED4D5654}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|.NET.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|.NET.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|.NET.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Any CPU.Build.0 = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|.NET.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|.NET.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|.NET.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Any CPU.Build.0 = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{663EFCB5-9E3E-4C76-97EE-3188E072634C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|.NET.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|.NET.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Any CPU.Build.0 = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|.NET.ActiveCfg = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|.NET.Build.0 = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|.NET.ActiveCfg = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|.NET.Build.0 = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|Any CPU.Build.0 = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{47331732-DD96-4075-869F-83AA9F3F9937}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|.NET.ActiveCfg = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|.NET.Build.0 = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|.NET.ActiveCfg = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|.NET.Build.0 = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|Any CPU.Build.0 = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}.Release|Mixed Platforms.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{3FEBB560-9275-413A-9767-BB68C44EEBC3} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852}
{094331C3-ECEE-4C89-BBFD-4C9DED89F0EF} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{B0D73E3D-4AE7-4024-93A6-DB1F46D7CCEE} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{D5E53B0F-BF5A-41E8-93E2-0F32845FC729} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852}
{40D8B312-EA64-49E3-A31A-5E57ED4D5654} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{E1154C7B-BB77-4155-9854-DAD8FC5A8BC3} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{663EFCB5-9E3E-4C76-97EE-3188E072634C} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{8A83C4DC-A0B1-4A51-AE1D-366D7A05B298} = {E7543C39-A44C-40C9-82C9-E7FAA2D9A852}
{47331732-DD96-4075-869F-83AA9F3F9937} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A} = {FEB0336B-F053-40B6-92DD-7DE56AB9408A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5352BE53-F2FD-442F-85A8-4157599AA153}
EndGlobalSection
EndGlobal

View File

@@ -266,8 +266,7 @@ namespace Dakota.Logic
throw new ArgumentOutOfRangeException(nameof(infoParameter.Organisation.Leistungserbringergruppe), infoParameter.Organisation.Leistungserbringergruppe.Length, "Leistungserbringergruppe 7 Stellen oder 5 Stelle ohne Abrechnungscode");
}
info.AbrechnungspositionString = infoParameter.InvoiceItem.UnitDescription.Substring(6);
info.AbrechnungspositionString = infoParameter.Abrechnungsposition;
info.AnzahlMenge = infoParameter.InvoiceItem.UnitCount.Value;
info.EinzelbetragAbrechnungsposition = infoParameter.InvoiceItem.AmountPerUnit.Value;
info.DatumDerLeistungserbringung = infoParameter.InvoiceItem.ItemPeriodStart.Value;

View File

@@ -17,7 +17,8 @@ namespace Dakota.Models.Infos
public OrganisationDC Organisation { get; set; }
public MandatorDC Mandator { get; set; }
public string IKDatenannahmestelle => Organisation.IKDatenannahmestelle;
public string Abrechnungsposition { get; set; }
public string IKKostentrager => Organisation.IKKostentrager;
public string IKKrankenkasse => Organisation.IKKrankenkasse;
public string IKLeistungserbringer => Mandator.IKLeistungserbringer;
@@ -30,6 +31,9 @@ namespace Dakota.Models.Infos
Customer = customer;
Organisation = organisation;
Mandator = mandator;
// Todo: Valid prüfen
Abrechnungsposition = invoiceItem.UnitDescription?.Substring(6) ?? "TODO";
}
}
}

15
DakotaSender/App.config Normal file
View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
<add key="GkvAbrechnungResultFolderPath" value="C:\GkvAbrechnung\Results\" />
<add key="GkvAbrechnungQueueFolderPath" value="C:\GkvAbrechnung\Queue\" />
<add key="GkvAbrechnungFailedFolderPath" value="C:\GkvAbrechnung\Failed\" />
<add key="DakotaExePath" value="C:\Program Files (x86)\ITSG\dakotale\dakota30.exe" />
<add key="DakotaFolder" value="C:\dakotale\" />
<add key="ProcessWaitForExitMs" value="10000" />
<add key="LogPath" value="C:\GkvAbrechnung\Sender\log.txt" />
</appSettings>
</configuration>

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A959FE9A-1647-4C02-B2EE-6A95EBF6DC9A}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>DakotaSender</RootNamespace>
<AssemblyName>DakotaSender</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DakotaSystemFile.cs" />
<Compile Include="FehlerXml.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="XmlFileConverter.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DakotaSender
{
internal class DakotaSystemFile
{
public string Tenant { get; set; }
public long ProtokollOid { get; set; }
public string Datenannahmestelle { get; set; }
public string Transfername { get; set; }
public string TransfernameAuf => Transfername + ".auf";
public FileInfo SourceAuftragsdatei { get; set; }
public FileInfo SourceNutzdatendatei { get; set; }
}
}

30
DakotaSender/FehlerXml.cs Normal file
View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using System.Xml.Serialization;
namespace DakotaSender
{
[Serializable()]
[XmlRoot("Fehler")]
public class FehlerXml
{
[XmlAttribute("Oid")]
public long Oid { get; set; }
[XmlElement("Titel")]
public string Titel { get; set; }
[XmlElement("Datum")]
public DateTime? Datum { get; set; }
[XmlElement("Nachricht")]
public string Nachricht { get; set; }
[XmlElement("Level")]
public int Level { get; set; }
}
}

378
DakotaSender/Program.cs Normal file
View File

@@ -0,0 +1,378 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace DakotaSender
{
class Program
{
const int RC_DAKOTA_ALREADY_LOADED = 18;
static readonly string TEST_TENANT = "7375324044";
static int[] AcceptStatusCodes = new int[] { 0 };
static int[] AcceptSendCodes = new int[] { 0 };
static bool time_in_line = false;
static void Main(string[] args)
{
FileStream filestream = new FileStream(GetLogPath(), FileMode.Append);
var streamwriter = new StreamWriter(filestream);
streamwriter.AutoFlush = true;
Console.SetOut(streamwriter);
Console.SetError(streamwriter);
try
{
PrintTitle();
CheckDakotaStatus();
ProcessFiles();
}
catch (Exception e)
{
PrintLine(e.ToString());
}
PrintEnd();
}
static void PrintTitle()
{
PrintWithTime("\n", false);
PrintLine("-------------------");
PrintLine("Dakota Sender Modul");
PrintLine("-------------------");
}
static void PrintEnd()
{
PrintLine("Ende");
PrintLine("-------------------");
}
static void PrintLine(string line = null)
{
PrintWithTime(line + "\n", !time_in_line);
time_in_line = false;
}
static void Print(string line)
{
PrintWithTime(line, !time_in_line);
time_in_line = true;
}
static void PrintWithTime(string line, bool showTime)
{
if (showTime)
Console.Write($"[{DateTime.Now:dd.MM.yy HH:mm:ss.fff}] {line}");
else
Console.Write(line);
}
static void CheckDakotaStatus()
{
PrintLine("Überprüfe Dakota Status");
var code = ExecuteDakota("-s");
if (AcceptStatusCodes.Contains(code))
{
PrintLine("Ok");
}
else
{
throw new Exception($"Statuscode {code} wird nicht akzeptiert");
}
}
static void ProcessFiles()
{
PrintLine("Scanne Dakota Dateien");
var toCheck = ScanQueueFolder();
if (toCheck is null)
{
PrintLine("Keine Dakota Dateien gefunden.");
return;
}
var testCheck = toCheck.TryGetValue(TEST_TENANT, out var files);
if (!testCheck)
{
PrintLine($"Keine Dakota Dateien für {TEST_TENANT} gefunden.");
return;
}
foreach (var file in files)
{
TryProcessFile(file);
CheckDakotaStatus();
}
}
static Dictionary<string, List<DakotaSystemFile>> ScanQueueFolder()
{
var queue = GetQueueFolder();
var files = queue.GetFiles("*.auf", SearchOption.TopDirectoryOnly);
var toCheck = new Dictionary<string, List<DakotaSystemFile>>();
foreach (var auft in files)
{
var nutz_fullname = auft.FullName.Substring(0, auft.FullName.Length - 4);
var nutz = new FileInfo(nutz_fullname);
if (!nutz.Exists)
{
PrintLine($"{auft.FullName} wird ignoriert. {nutz.FullName} nicht vorhanden");
continue;
}
PrintLine($"{auft.FullName} gefunden.");
var split = nutz.Name.Split('_');
var tenant = split[0];
var p_oid = long.Parse(split[1]);
var datenannahmestelle = split[2];
var transfername = split[3];
if (tenant != TEST_TENANT && tenant != "demo")
{
PrintLine($"{auft.FullName} wird ignoriert. Tenant {tenant} nicht gültig.");
continue;
}
else
{
tenant = TEST_TENANT;
}
var file = new DakotaSystemFile()
{
SourceAuftragsdatei = auft,
SourceNutzdatendatei = nutz,
Tenant = tenant,
ProtokollOid = p_oid,
Datenannahmestelle = datenannahmestelle,
Transfername = transfername,
};
if (!toCheck.ContainsKey(tenant))
toCheck.Add(tenant, new List<DakotaSystemFile>());
toCheck[tenant].Add(file);
}
return toCheck.Any() ? toCheck : null;
}
static void TryProcessFile(DakotaSystemFile file)
{
bool copied = false;
try
{
var protokoll_oid = file.ProtokollOid;
PrintLine($"Verarbeite Datei: {file.SourceNutzdatendatei.Name}");
PrintLine($"- Tenant: {file.Tenant}");
PrintLine($"- Protokoll Oid: {protokoll_oid}");
PrintLine($"- Datenannahmestelle: {file.Datenannahmestelle}");
copied = true;
CopyFileToDestination(file);
Print("Sende via Dakota. ");
var code = ExecuteDakota("-x");
if (AcceptSendCodes.Contains(code))
{
PrintLine($"Ok.");
DeleteQueueFile(file);
}
else
{
if(code == RC_DAKOTA_ALREADY_LOADED)
{
PrintLine($"Verarbeitung fehlgeschlagen. Dakota läuft bereits.");
PrintLine("Ignoriere Verarbeitung aktuell. Versuche im nächsten Programm Aufruf erneut.");
DeleteDakotaFile(file);
}
else
{
var error = $"Verarbeitung fehlgeschlagen. Statuscode {code} wird nicht akzeptiert.";
PrintLine(error);
MoveQueueToFailed(file);
DeleteDakotaFile(file);
CreateResultXmlFile(file, error);
}
}
}
catch (Exception e)
{
PrintLine($"Verarbeitung fehlgeschlagen. Exception: {e}");
if (copied)
DeleteDakotaFile(file);
}
}
static void CreateResultXmlFile(DakotaSystemFile file, string error)
{
Print("Speichere Fehler als Xml. ");
var fehler = new FehlerXml();
fehler.Datum = DateTime.Now;
fehler.Titel = "Dakota Fehler";
fehler.Nachricht = error;
fehler.Level = 1;
fehler.Oid = file.ProtokollOid;
var folder = GetResultFolderTenant(file.Tenant).FullName;
var path = Path.Combine(folder, $"P{file.ProtokollOid}.xml");
Print($"Path: {path}");
XmlFileConverter.Save(fehler, path);
PrintLine("Ok.");
}
static void MoveQueueToFailed(DakotaSystemFile file)
{
CopyFileToFailed(file);
DeleteQueueFile(file);
}
static void CopyFileToFailed(DakotaSystemFile file)
{
var failed_folder = GetFailedFolder();
CopyFileTo(file.SourceAuftragsdatei, failed_folder.FullName);
CopyFileTo(file.SourceNutzdatendatei, failed_folder.FullName);
}
static void CopyFileToDestination(DakotaSystemFile file)
{
var folder = GetDakotaFolderDatenannahmestelle(file.Datenannahmestelle);
CopyFileTo(file.SourceAuftragsdatei, folder.FullName, file.TransfernameAuf);
CopyFileTo(file.SourceNutzdatendatei, folder.FullName, file.Transfername);
}
static void CopyFileTo(FileSystemInfo file, string destination_folder, string file_name = null)
{
if (file_name is null)
file_name = file.Name;
CopyFile(file.FullName, Path.Combine(destination_folder, file_name));
}
static void CopyFile(string source, string destination)
{
Print($"Kopiere \"{source}\" nach \"{destination}\". ");
File.Copy(source, destination);
PrintLine("Ok.");
}
static void DeleteQueueFile(DakotaSystemFile file)
{
DeleteFile(file.SourceAuftragsdatei.FullName);
DeleteFile(file.SourceNutzdatendatei.FullName);
}
static void DeleteDakotaFile(DakotaSystemFile file)
{
var folder = GetDakotaFolderDatenannahmestelle(file.Datenannahmestelle).FullName;
DeleteFile(Path.Combine(folder, file.TransfernameAuf));
DeleteFile(Path.Combine(folder, file.Transfername));
}
static void DeleteFile(string file)
{
Print($"Lösche {file}. ");
File.Delete(file);
PrintLine("Ok.");
}
static int ExecuteDakota(string arg)
{
var fileinfo = GetDakotaExe();
PrintLine($"{fileinfo.Name} {arg} wird ausgeführt");
var process = Process.Start(GetDakotaExe().FullName, arg);
var success = process.WaitForExit(GetProcessWaitForExitMs());
if (success)
{
var exitcode = process.ExitCode;
PrintLine($"Returncode {exitcode}");
return exitcode;
}
else
{
throw new Exception("Timeout");
}
}
static DirectoryInfo GetDakotaFolderDatenannahmestelle(string datenannahmestelle)
{
var folder = new DirectoryInfo(Path.Combine(GetDakotaFolder().FullName, "TP5Daten", datenannahmestelle));
if (!folder.Exists)
folder = new DirectoryInfo(Path.Combine(GetDakotaFolder().FullName, "TP5Daten", datenannahmestelle.Substring(0, datenannahmestelle.Length - 1)));
if (!folder.Exists)
throw new Exception($"Datenannahmestelle {datenannahmestelle} konnte nicht gefunden werden.");
return folder;
}
static DirectoryInfo GetResultFolderTenant(string tenant)
{
var dirinfo = new DirectoryInfo(Path.Combine(GetResultFolder().FullName, tenant));
if (!dirinfo.Exists)
dirinfo.Create();
return dirinfo;
}
static string GetLogPath()
=> ConfigurationManager.AppSettings.Get("LogPath") ?? @"C:\GkvAbrechnung\Sender\log.txt";
static int GetProcessWaitForExitMs()
=> int.Parse(ConfigurationManager.AppSettings.Get("ProcessWaitForExitMs") ?? "10000");
static FileInfo GetDakotaExe()
=> new FileInfo(ConfigurationManager.AppSettings.Get("DakotaExePath") ?? @"C:\Program Files (x86)\ITSG\dakotale\dakota30.exe");
static DirectoryInfo GetDakotaFolder()
=> new DirectoryInfo(ConfigurationManager.AppSettings.Get("DakotaFolder") ?? @"C:\dakotale\");
static DirectoryInfo GetQueueFolder()
=> new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungQueueFolderPath") ?? @"C:\GkvAbrechnung\Queue\");
static DirectoryInfo GetResultFolder()
=> new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungResultFolderPath") ?? @"C:\GkvAbrechnung\Results\");
static DirectoryInfo GetFailedFolder()
=> new DirectoryInfo(ConfigurationManager.AppSettings.Get("GkvAbrechnungFailedFolderPath") ?? @"C:\GkvAbrechnung\Failed\");
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("DakotaSender")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DakotaSender")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("a959fe9a-1647-4c02-b2ee-6a95ebf6dc9a")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace DakotaSender
{
public static class XmlFileConverter
{
/// <summary>
/// Saves to an xml file
/// </summary>
/// <param name="FileName">File path of the new xml file</param>
public static void Save<T>(T obj, string FileName) where T : class
{
using (var writer = new System.IO.StreamWriter(FileName))
{
var serializer = new XmlSerializer(obj.GetType());
serializer.Serialize(writer, obj);
writer.Flush();
}
}
/// <summary>
/// Load an object from an xml file
/// </summary>
/// <param name="FileName">Xml file name</param>
/// <returns>The object created from the xml file</returns>
public static T Load<T>(string FileName) where T : class
{
using (var stream = System.IO.File.OpenRead(FileName))
{
var serializer = new XmlSerializer(typeof(T));
return serializer.Deserialize(stream) as T;
}
}
}
}

View File

@@ -71,7 +71,16 @@ namespace BeWo.Data
private static bool ShouldConfigureHibernateSession(HttpApplication context)
{
return string.IsNullOrEmpty(context.Request.FilePath) || context.Request.FilePath.IndexOf("Admin.aspx") < 0 || context.Request.FilePath.IndexOf("GkvAbrechnungView.aspx") < 0;
if (string.IsNullOrEmpty(context.Request.FilePath))
return false;
if (context.Request.FilePath.IndexOf("GkvAbrechnungView.aspx") >= 0)
return false;
if (context.Request.FilePath.IndexOf("Admin.aspx") >= 0)
return false;
return true;
}
private static bool ConfigureHibernateSession(HttpApplication context)

View File

@@ -31,18 +31,19 @@ using Dakota.Models;
using System.Xml;
using System.Xml.Linq;
using System.Diagnostics;
using System.Xml.Serialization;
namespace Host
{
public partial class GkvAbrechnungView : Page
{
public const int PROCESS_WAITFOREXIT_MS = 10 * 1000;
private string GETSERVER_URL = "https://support.bewoplaner.de/api/getserver.php?k={0}&t=0";
private string LOGINSERVER_URL = "{0}/Host/Login.aspx";
private string LOGINSERVER_URL = "{0}/Login.aspx";
private string GKVRESULT_FORMAT = "{0}/{1}/result.xml";
private string GkvAbrechnungResultFolderPath { get; set; } = ConfigurationManager.AppSettings.Get("GkvAbrechnungResultFolderPath");
private string DakotaPath { get; set; } = ConfigurationManager.AppSettings.Get("DakotaPath");
private string ResultFolderPath { get; set; } = ConfigurationManager.AppSettings.Get("GkvAbrechnungResultFolderPath");
private string QueueFolderPath { get; set; } = ConfigurationManager.AppSettings.Get("GkvAbrechnungQueueFolderPath");
public GkvApp8Request GkvRequest { get; set; }
@@ -50,7 +51,7 @@ namespace Host
{
try
{
//https://app8.bewoplaner.de/Host/GkvAbrechungview?k=12345&username=meier&password=test
//https://app8.bewoplaner.de/Host/GkvAbrechungview?tenant=12345
var str = new StreamReader(Request.InputStream).ReadToEnd();
@@ -133,25 +134,39 @@ namespace Host
private bool TryLogin() => TryLogin(GkvRequest);
private bool TryLogin(GkvApp8Request gkv_request)
{
if (gkv_request.Tenant == "demo" && gkv_request.Username == "demo" && gkv_request.DebugMode == "fozc4897b6ztvf978AFCRRG244fvFV2532fvf324AF")
{
gkv_request.Tenant = "7375324044";
return true;
}
var server = GetServerFromTenant(gkv_request.Tenant);
var loginurl = string.Format(LOGINSERVER_URL, server);
#if DEBUG
//loginurl = string.Format(LOGINSERVER_URL, "https://app4.bewoplaner.de");
loginurl = string.Format(LOGINSERVER_URL, "http://localhost:3777");
loginurl = string.Format(LOGINSERVER_URL, "http://localhost:3777/Host");
#endif
bool successful = false;
using (WebClient client = new WebClient())
try
{
var nvc = new NameValueCollection();
nvc.Add("password", gkv_request.Password);
nvc.Add("username", gkv_request.Username);
nvc.Add("tenant", gkv_request.Tenant);
using (WebClient client = new WebClient())
{
var nvc = new NameValueCollection();
nvc.Add("password", gkv_request.Password);
nvc.Add("username", gkv_request.Username);
nvc.Add("tenant", gkv_request.Tenant);
var loginresponse = client.UploadValues(loginurl, "POST", nvc);
var loginresponse = client.UploadValues(loginurl, "POST", nvc);
successful = BitConverter.ToBoolean(loginresponse, 0);
}
}
catch (Exception e)
{
successful = BitConverter.ToBoolean(loginresponse, 0);
}
return successful;
@@ -159,34 +174,14 @@ namespace Host
private void SendNew(GkvApp8SendNewRequest req)
{
var debug_mode = false;
#if DEBUG
debug_mode = true;
#endif
// Response
var response = new GkvApp8SendNewResponse(false);
bool saved_in_filesystem = false;
bool send_success = false;
var protokoll = req.GkvTransferProtokoll;
string path = string.Empty;
try
{
// Check Dakota Status
CheckDakotaStatus();
// Save File
path = SaveFileInFileSystem(req, debug_mode);
saved_in_filesystem = true;
if (req.SendDirect)
{
// Dakota Send
SendViaDakota();
}
send_success = true;
SaveFileInFileSystem(req, true);
req.GkvTransferProtokoll.SentSuccess = true;
@@ -194,27 +189,24 @@ namespace Host
}
catch (DakotaException e)
{
req.GkvTransferProtokoll.Fehlerdatum = DateTime.Now;
req.GkvTransferProtokoll.Fehlerlevel = GkvTransferFehlerlevel.Soft;
req.GkvTransferProtokoll.Fehlertitel = "App8";
req.GkvTransferProtokoll.Fehlernachricht = e.Message;
protokoll.Fehlerdatum = DateTime.Now;
protokoll.Fehlerlevel = GkvTransferFehlerlevel.Soft;
protokoll.Fehlertitel = "App8";
protokoll.Fehlernachricht = e.Message;
response.Message = e.Message;
}
catch (Exception e)
{
req.GkvTransferProtokoll.Fehlerdatum = DateTime.Now;
req.GkvTransferProtokoll.Fehlerlevel = GkvTransferFehlerlevel.Fatal;
req.GkvTransferProtokoll.Fehlertitel = "App8";
req.GkvTransferProtokoll.Fehlernachricht = e.Message;
protokoll.Fehlerdatum = DateTime.Now;
protokoll.Fehlerlevel = GkvTransferFehlerlevel.Soft;
protokoll.Fehlertitel = "App8";
protokoll.Fehlernachricht = e.Message;
response.Message = e.Message;
}
if (!send_success && saved_in_filesystem)
DeleteFileInFileSystem(path);
response.GkvTransferProtokollDC = req.GkvTransferProtokoll;
response.GkvTransferProtokollDC = protokoll;
SendResponse(response);
}
@@ -229,17 +221,20 @@ namespace Host
try
{
// Load XML Info
var results = GetResultFile(req.Tenant);
var results = GetResultFile(GkvRequest.Tenant);
for (int i = 0; i < tuple_count; i++)
{
var gkv_transfer_oid = req.Oids[i];
if (results.TryGetValue(gkv_transfer_oid, out var fehlerDC))
if (results is object)
for (int i = 0; i < tuple_count; i++)
{
response.Fehler[i] = fehlerDC;
var gkv_transfer_oid = req.Oids[i];
if (results.TryGetValue(gkv_transfer_oid, out var fehlerDC))
{
response.Fehler[i] = fehlerDC;
}
}
}
ClearResultFolder(GkvRequest.Tenant, req.Oids);
response.Success = true;
}
@@ -270,41 +265,23 @@ namespace Host
SendResponse(response);
}
private void CheckDakotaStatus() => ExecuteDakota("-s", 0);
private void SendViaDakota() => ExecuteDakota("-e", 0, 1);
private int ExecuteDakota(string arg, params int[] accepted_return_codes)
{
var path = DakotaPath;
var process = Process.Start(path, arg);
process.WaitForExit();
var returncode = process.ExitCode;
if (accepted_return_codes is object && accepted_return_codes.Length > 0)
if (accepted_return_codes.All(x => x != returncode))
throw new DakotaException($"Execute {arg} rc: " + returncode);
return returncode;
}
private string SaveFileInFileSystem(GkvApp8SendNewRequest req, bool debug_mode = false)
=> SaveFileInFileSystem(req.Tenant, req.GkvTransferProtokoll.IKDatenannahmestelle, req.GkvTransferProtokoll.Transfername,
=> SaveFileInFileSystem(req.GkvTransferProtokoll.GkvTransferProtokollOid.Value, GkvRequest.Tenant, req.GkvTransferProtokoll.IKDatenannahmestelle, req.GkvTransferProtokoll.Transfername,
req.GkvTransferProtokoll.Nutzdatendatei, req.GkvTransferProtokoll.Auftragsdatei, debug_mode);
private string SaveFileInFileSystem(string tenant, string datenannahmestelle, string transfername, string nutzdaten, string auftragsdatei, bool debug_mode = false)
private string SaveFileInFileSystem(long protokoll_oid, string tenant, string datenannahmestelle, string transfername, string nutzdaten, string auftragsdatei, bool debug_mode = false)
{
string root_path;
string file_path;
if (debug_mode)
{
root_path = $@"C:\GkvAbrechnung\";
file_path = $@"{tenant}-{datenannahmestelle}-{transfername}";
root_path = QueueFolderPath;
file_path = $@"{tenant}_{protokoll_oid}_{datenannahmestelle}_{transfername}";
}
else
{
root_path = $@"C:\GkvAbrechnung\{tenant}\{datenannahmestelle}\";
file_path = $@"{transfername}";
throw new DakotaException("No Debugmode impl");
//root_path = $@"C:\GkvAbrechnung\{tenant}\{datenannahmestelle}\";
//file_path = $@"{transfername}";
}
Directory.CreateDirectory(root_path);
@@ -324,12 +301,6 @@ namespace Host
return finalpath;
}
private void DeleteFileInFileSystem(string finalpath)
{
File.Delete(finalpath);
File.Delete(finalpath + ".auf");
}
private string GetServerFromTenant(string tenant)
{
try
@@ -352,41 +323,77 @@ namespace Host
}
}
private void ClearResultFolder(string tenant, long[] oids)
{
var folder = new DirectoryInfo(Path.Combine(ResultFolderPath, tenant));
if (!folder.Exists)
return;
foreach (var file in folder.GetFiles())
{
var xml_obj = GetFehlerXmlFromFile(file);
if (xml_obj is GkvApp8FehlerXml xml && oids.Contains(xml.Oid))
continue;
file.Delete();
}
}
private Dictionary<long, GkvApp8FehlerDC> GetResultFile(string tenant)
{
try
{
if (string.IsNullOrWhiteSpace(GkvAbrechnungResultFolderPath))
var path = ResultFolderPath;
if (string.IsNullOrWhiteSpace(path))
throw new DakotaException("Config GkvAbrechnungResultFolderPath is empty or whitespace");
if (string.IsNullOrWhiteSpace(tenant))
throw new DakotaException("Tenant is empty or whitespace");
var path = GkvAbrechnungResultFolderPath;
var folder = new DirectoryInfo(Path.Combine(path, tenant));
var folder = Path.Combine(path, tenant);
var location = Path.Combine(folder, "results.xml");
if (!File.Exists(location))
if (!folder.Exists)
{
Directory.CreateDirectory(folder);
using (File.Create(location)) { };
return null;
}
var dict = new Dictionary<long, GkvApp8FehlerDC>();
foreach (var file in folder.GetFiles("*.xml"))
{
var xml = GetFehlerXmlFromFile(file);
var doc = XDocument.Load(location);
if (xml is null)
continue;
var list = doc.Root.Elements("Fehler")
.Select(GkvApp8FehlerXml.Parse)
.Select(GkvApp8FehlerXml.ToDC)
.ToList();
return list.ToDictionary(dc => dc.Oid);
dict.Add(xml.Oid, GkvApp8FehlerXml.ToDC(xml));
}
return dict;
}
catch (DakotaException e)
{
throw e;
}
catch (Exception e)
{
throw new DakotaException("App8 Server Error: " + e.Message);
throw new DakotaException("App8 Server Error: " + e.ToString());
}
}
private GkvApp8FehlerXml GetFehlerXmlFromFile(FileSystemInfo file)
{
try
{
using (var stream = File.OpenRead(file.FullName))
{
var serializer = new XmlSerializer(typeof(GkvApp8FehlerXml));
return serializer.Deserialize(stream) as GkvApp8FehlerXml;
}
}
catch (Exception)
{
return null;
}
}
}

View File

@@ -237,6 +237,7 @@
<add key="OpenrouteServiceApiUrlGeocode" value="https://api.openrouteservice.org/geocode/search" />
<add key="OpenrouteServiceApiKey" value="5b3ce3597851110001cf62484b0917529e9a4008acda819dc06e47e8" />
<add key="GkvAbrechnungResultFolderPath" value="C:\GkvAbrechnung\Results\" />
<add key="GkvAbrechnungQueueFolderPath" value="C:\GkvAbrechnung\Queue\" />
<add key="DakotaPath" value="C:\Program Files (x86)\ITSG\dakotale\dakota30.exe" />
</appSettings>
<devExpress>

View File

@@ -889,23 +889,22 @@ namespace BeWo.Service.ServiceImplementations
{
response.Message = "Validierung fehlgeschlagen";
return response;
}
}
string response_app8_str = SendApp8SendNewRequest(protokoll, user.LoginName, user.RC2EncryptedHash);
if (entity.GkvTransferProtokolle is null)
entity.GkvTransferProtokolle = new List<GkvTransferProtokoll>();
if (string.IsNullOrEmpty(response_app8_str))
throw new DakotaException("Leere Antwort", "App8");
entity.GkvTransferProtokolle.Add(protokoll);
var response_app8 = JsonConvert.DeserializeObject<GkvApp8SendNewResponse>(response_app8_str);
DAOFactory.GenericDAO.Update(entity);
if (!response_app8.Success)
throw new DakotaException(response_app8.Message, "App8 Error");
var app8_response = SendApp8SendNewRequest(protokoll, user.LoginName, user.RC2EncryptedHash);
var app8_protokoll = response_app8.GkvTransferProtokollDC;
var app8_protokoll = app8_response.GkvTransferProtokollDC;
MapperFactory.GkvTransferProtokollDC_GkvTransferprotokoll.MergeWithEntity(app8_protokoll, protokoll);
response.Successful = true;
response.Successful = app8_response.Success;
}
catch (DakotaException de)
{
@@ -922,11 +921,6 @@ namespace BeWo.Service.ServiceImplementations
protokoll.Fehlertitel = "Erstellung (kritisch)";
}
if (entity.GkvTransferProtokolle is null)
entity.GkvTransferProtokolle = new List<GkvTransferProtokoll>();
entity.GkvTransferProtokolle.Add(protokoll);
DAOFactory.GenericDAO.Update(entity);
response.TransferProtokoll = MapperFactory.GkvTransferProtokollDC_GkvTransferprotokoll.MapToNewDC(protokoll);
@@ -944,7 +938,7 @@ namespace BeWo.Service.ServiceImplementations
var state = GkvAbrechnung.GetState(gkvAbrechnung);
if (state == GkvState.Waiting || state == GkvState.OldAndNoFeedback || state == GkvState.Paid || state == GkvState.ErrorFatal)
if (state == GkvState.Waiting || state == GkvState.OldAndNoFeedback || state == GkvState.Paid)
{
return false;
}
@@ -1042,7 +1036,7 @@ namespace BeWo.Service.ServiceImplementations
{
transfernummer = DAOFactory.SearchDAO.GetNextTransfernummer(datenannahmestelle);
}
else if (state == GkvState.Error)
else if (state == GkvState.Error || state == GkvState.ErrorFatal)
{
transfernummer = gkvAbrechnung.GkvTransferProtokolle.Last().Transfernummer;
}
@@ -1067,14 +1061,14 @@ namespace BeWo.Service.ServiceImplementations
return new Tuple<int, int>(d, t);
}
private string SendApp8SendNewRequest(GkvTransferProtokoll protokoll, string loginName, string hashed_password)
private GkvApp8SendNewResponse SendApp8SendNewRequest(GkvTransferProtokoll protokoll, string loginName, string hashed_password)
{
var gkv_transfer_dc = MapperFactory.GkvTransferProtokollDC_GkvTransferprotokoll.MapToNewDC(protokoll);
var url = "https://app8.bewoplaner.de/service/GkvAbrechnungView.aspx";
#if DEBUG
url = "http://localhost:3777/Host/GkvAbrechnungView.aspx";
//url = "http://localhost:3777/Host/GkvAbrechnungView.aspx";
#endif
var request_app8 = new GkvApp8SendNewRequest
@@ -1083,14 +1077,19 @@ namespace BeWo.Service.ServiceImplementations
GkvTransferProtokoll = gkv_transfer_dc,
Username = loginName,
Password = hashed_password,
Tenant = MultitenancyOperationContextExt.Current.Tenant
Tenant = MultitenancyOperationContextExt.Current.Tenant,
DebugMode = "fozc4897b6ztvf978AFCRRG244fvFV2532fvf324AF"
};
#if DEBUG
request_app8.SendDirect = false;
#endif
return SendApp8Request(url, request_app8);
var response_app8_str = SendApp8Request(url, request_app8);
var response_app8 = JsonConvert.DeserializeObject<GkvApp8SendNewResponse>(response_app8_str);
return response_app8;
}
/// <summary>
///
@@ -1105,16 +1104,13 @@ namespace BeWo.Service.ServiceImplementations
var url = "https://app8.bewoplaner.de/service/GkvAbrechnungView.aspx";
#if DEBUG
url = "http://localhost:3777/Host/GkvAbrechnungView.aspx";
#endif
var request = new GkvApp8GetStatusRequest
{
Username = loginName,
Password = hashed_password,
Tenant = MultitenancyOperationContextExt.Current.Tenant,
Oids = new long[updateables_len]
Oids = new long[updateables_len],
DebugMode = "fozc4897b6ztvf978AFCRRG244fvFV2532fvf324AF",
};
for (int id = 0; id < updateables_len; id++)
@@ -1125,16 +1121,21 @@ namespace BeWo.Service.ServiceImplementations
request.Oids[id] = gkv_transfer.GkvTransferProtokollOid.Value;
}
var response_app8_str = SendApp8Request(url, JsonConvert.SerializeObject(request));
GkvApp8GetStatusResponse response_app8;
try
{
var response_app8_str = SendApp8Request(url, JsonConvert.SerializeObject(request));
var response_app8 = JsonConvert.DeserializeObject<GkvApp8GetStatusResponse>(response_app8_str);
if (!response_app8.Success)
response_app8 = JsonConvert.DeserializeObject<GkvApp8GetStatusResponse>(response_app8_str);
}
catch(Exception e)
{
return true;
throw new NotImplementedException("App 8 Anfrage nicht erfolgreich");
}
if (!response_app8.Success)
throw new DakotaException(response_app8.Message);
bool allAreUpToDate = true;
for (int id = 0; id < updateables_len; id++)
{
@@ -1164,15 +1165,26 @@ namespace BeWo.Service.ServiceImplementations
private string SendApp8Request(string url, object request) => SendApp8Request(url, JsonConvert.SerializeObject(request));
private string SendApp8Request(string url, string dataString)
{
url += "?tenant=" + MultitenancyOperationContextExt.Current.Tenant;
string response_app8_str;
using (WebClient client = new WebClient())
{
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
response_app8_str = client.UploadString(url, "POST", dataString);
try
{
url += "?tenant=" + MultitenancyOperationContextExt.Current.Tenant;
using (WebClient client = new WebClient())
{
client.Headers.Add(HttpRequestHeader.ContentType, "application/json");
response_app8_str = client.UploadString(url, "POST", dataString);
}
}
catch(Exception e)
{
throw new DakotaException(e.Message, "App8");
}
if (string.IsNullOrEmpty(response_app8_str))
throw new DakotaException("Leere Antwort", "App8");
return response_app8_str;
}

View File

@@ -19,6 +19,9 @@ namespace BS.Shared.DataContracts.GkvAbrechnung
[DataMember]
public string Tenant { get; set; }
[DataMember]
public string DebugMode { get; set; }
[DataMember]
public GkvAbrechnungApp8RequestTypeDC Type { get; set; }
}