Files
BeWoPlaner/Tools/KTDReaderGUI/KTDReaderGUI/MainWindow.xaml.cs

96 lines
2.0 KiB
C#

using Dakota.Logic;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace KTDReaderGUI
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
private string KostentragerdateiFolderPath { get; set; } = ConfigurationManager.AppSettings.Get("GkvKostentragerdateiFolderPath");
private DakotaKTDReader Reader;
public MainWindow()
{
InitializeComponent();
try
{
load();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void load()
{
var path = KostentragerdateiFolderPath;
if (string.IsNullOrEmpty(path))
{
var root = Directory.GetCurrentDirectory();
path = System.IO.Path.Combine(root, "KTDatei");
}
input_file.Text = path;
Reader = new DakotaKTDReader(path);
}
private void Button_Click(object sender, RoutedEventArgs e)
{
try
{
calc();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void calc()
{
var ikkrankenkasse = input_krankenkasse.Text;
var leistungsgruppe = input_leistungsgruppe.Text;
if (ikkrankenkasse.Length != 9 || leistungsgruppe.Length != 7)
return;
var rtn = Reader.Resolve(ikkrankenkasse, leistungsgruppe.Substring(0, 2), leistungsgruppe.Substring(2, 5));
if (rtn is null)
{
MessageBox.Show("Eingabe konnte nicht gefunden werden.");
}
else
{
out_ikkrankenkasse.Text = rtn.Item3;
out_ikkostentrager.Text = rtn.Item2;
out_ikdatenannahmestelle.Text = rtn.Item1;
out_bezdatenannahmestelle.Text = rtn.Item4;
}
}
}
}