Windows: Remove SeasonFinishWindow and TestWindow

This commit is contained in:
2024-03-31 17:11:10 +02:00
parent cbc0d0ebff
commit a9f38a3ccb
11 changed files with 205 additions and 294 deletions

View File

@ -273,10 +273,6 @@ namespace Elwig {
return w;
}
public static SeasonFinishWindow FocusSeasonFinish() {
return FocusWindow<SeasonFinishWindow>(() => new());
}
public static OriginHierarchyWindow FocusOriginHierarchy() {
return FocusWindow<OriginHierarchyWindow>(() => new());
}

View File

@ -505,7 +505,22 @@
</Grid>
</TabItem>
<TabItem Header="Parameter">
<Grid>
<GroupBox x:Name="ParameterAreaComGroup" Header="Berechnung Flächenbindungen (aktuelle Saison)" Margin="10,10,10,10" VerticalAlignment="Top">
<Grid>
<CheckBox x:Name="ParameterAllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) &quot;schlechtere&quot; Flächenbindungen aufzuteilen"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,10,10,10"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<CheckBox x:Name="ParameterAvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei &quot;besseren&quot; Flächenbindungen vermeiden"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,30,10,10"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed"/>
<CheckBox x:Name="ParameterHonorGebundenInput" Margin="10,50,10,10" VerticalAlignment="Top"
Checked="CheckBox_Changed" Unchecked="CheckBox_Changed">
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
</CheckBox>
</Grid>
</GroupBox>
</Grid>
</TabItem>
<TabItem Header="Textelemente">
<ScrollViewer VerticalScrollBarVisibility="Visible">

View File

@ -35,6 +35,7 @@ namespace Elwig.Windows {
];
WineAttributeFillLowerInput.Visibility = Visibility.Hidden;
WineAttributeFillLowerLabel.Visibility = Visibility.Hidden;
ParameterAreaComGroup.Header = ParameterAreaComGroup.Header.ToString()!.Split('(')[0] + $"({Utils.CurrentLastSeason})";
}
protected override void ShortcutNew() { }
@ -85,6 +86,10 @@ namespace Elwig.Windows {
SeasonModifierNameInput.IsReadOnly = true;
SeasonModifierRelInput.TextBox.IsReadOnly = true;
SeasonModifierAbsInput.TextBox.IsReadOnly = true;
ParameterAllowAttrIntoLowerInput.IsEnabled = false;
ParameterAvoidUnderDeliveriesInput.IsEnabled = false;
ParameterHonorGebundenInput.IsEnabled = false;
}
new protected void UnlockInputs() {
@ -131,6 +136,10 @@ namespace Elwig.Windows {
SeasonModifierNameInput.IsReadOnly = false;
SeasonModifierRelInput.TextBox.IsReadOnly = false;
SeasonModifierAbsInput.TextBox.IsReadOnly = false;
ParameterAllowAttrIntoLowerInput.IsEnabled = true;
ParameterAvoidUnderDeliveriesInput.IsEnabled = true;
ParameterHonorGebundenInput.IsEnabled = true;
}
private void Window_Loaded(object sender, RoutedEventArgs evt) {
@ -211,6 +220,7 @@ namespace Elwig.Windows {
private async Task Save() {
await UpdateClientParameters(App.Client);
await UpdateParameters(Utils.CurrentLastSeason);
using var tx = await EditContext!.Database.BeginTransactionAsync();
await BranchesSave(EditContext!);
await WineAttributesSave(EditContext!);
@ -383,5 +393,19 @@ namespace Elwig.Windows {
ClientNameFull.Text = $"{ClientNameInput.Text}{(suffix != null ? $", {suffix}," : "")} {ClientNameTypeInput.Text}";
TextBox_TextChanged(sender, evt);
}
private async Task UpdateParameters(int year) {
try {
using var ctx = new AppDbContext();
if (await ctx.Seasons.FindAsync(year) is not Season s)
return;
s.Billing_AllowAttrsIntoLower = ParameterAllowAttrIntoLowerInput.IsChecked ?? false;
s.Billing_AvoidUnderDeliveries = ParameterAvoidUnderDeliveriesInput.IsChecked ?? false;
s.Billing_HonorGebunden = ParameterHonorGebundenInput.IsChecked ?? false;
ctx.Update(s);
await ctx.SaveChangesAsync();
} catch { }
}
}
}

View File

@ -449,7 +449,20 @@ namespace Elwig.Windows {
if (doc.Type == DocType.DeliveryConfirmation) {
var details = ((int, bool))doc.Details!;
var year = details.Item1;
try {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
dcData[year] = await DeliveryConfirmationDeliveryData.ForSeason(ctx.DeliveryParts, year);
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
GenerateButton.IsEnabled = true;
Mouse.OverrideCursor = null;
return;
}
} else if (doc.Type == DocType.CreditNote) {
var details = ((int, int))doc.Details!;
var year = details.Item1;

View File

@ -1,6 +1,9 @@
<Window x:Class="Elwig.Windows.MainWindow"
<local:ContextWindow
x:Class="Elwig.Windows.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Elwig" Height="390" Width="520" ResizeMode="CanMinimize"
Loaded="Window_Loaded" Closing="Window_Closing">
<Window.Resources>
@ -17,13 +20,13 @@
<Menu BorderThickness="0,0,0,1" VerticalAlignment="Top" Height="19" BorderBrush="LightGray" Background="White">
<MenuItem Header="Datenbank">
<MenuItem Header="Abfragen stellen" Click="Menu_Database_Query_Click"/>
<!--MenuItem Header="Backup erstellen"/-->
<MenuItem Header="Speicherort öffnen..." Click="Menu_Database_Open_Click"/>
</MenuItem>
<MenuItem x:Name="HelpMenu" Header="Hilfe">
<MenuItem Header="Über"/>
<MenuItem x:Name="Menu_Help_Update" Header="Nach Updates suchen" Click="Menu_Help_Update_Click"/>
<MenuItem x:Name="Menu_Help_Smtp" Header="E-Mail-Einstellungen testen" Click="Menu_Help_Smtp_Click"/>
<MenuItem x:Name="Menu_Help_TestWindow" Header="Test-Fenster" Click="Menu_Help_TestWindow_Click"/>
<MenuItem x:Name="Menu_Help_Config" Header="Konfigurationsspeicherort öffnen..." Click="Menu_Help_Config_Click"/>
</MenuItem>
</Menu>
@ -56,7 +59,34 @@
Margin="210,220,0,0"/>
<Button x:Name="BaseDataButton" Content="Stammdaten" Click="BaseDataButton_Click"
Margin="0,260,210,0"/>
<Button x:Name="SeasonFinishButton" Content="Leseabschluss" Click="SeasonFinishButton_Click"
<Button x:Name="RegistrationButton" Content="Anmeldungen" IsEnabled="False"
Margin="210,260,0,0"/>
<Expander x:Name="SeasonFinish" Header="Leseabschluss" Expanded="SeasonFinish_Expanded" Collapsed="SeasonFinish_Collapsed"
HorizontalAlignment="Center" Width="410" Margin="0,300,0,0" VerticalAlignment="Top">
<Grid>
<Border BorderBrush="LightGray" BorderThickness="1"/>
<Label Content="Saison:" Margin="0,10,100,0" VerticalAlignment="Top" HorizontalAlignment="Center" Padding="2,4,2,4" Height="25"/>
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
Margin="0,10,0,0" VerticalAlignment="Top" HorizontalAlignment="Center"
ValueChanged="SeasonInput_ValueChanged"/>
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigung"
Click="DeliveryConfirmationButton_Click"
Margin="0,50,200,10" Width="190"/>
<Button x:Name="PaymentButton" Content="Auszahlung"
Click="PaymentButton_Click"
Margin="200,50,0,10" Width="190"/>
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
Click="OverUnderDeliveryButton_Click"
Margin="0,90,200,10" Width="190"/>
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
Click="AutoBusinessSharesButton_Click" IsEnabled="False"
Margin="200,90,0,10" Width="190"/>
</Grid>
</Window>
</Expander>
</Grid>
</local:ContextWindow>

View File

@ -1,27 +1,32 @@
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Helpers.Export;
using Elwig.Models.Dtos;
using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Elwig.Windows {
public partial class MainWindow : Window {
public partial class MainWindow : ContextWindow {
public MainWindow() {
InitializeComponent();
var v = Assembly.GetExecutingAssembly().GetName().Version;
VersionField.Text = "Version: " + (v == null ? "?" : $"{v.Major}.{v.Minor}.{v.Build}") + $" {App.BranchName}";
if (App.Client.Client == null) VersionField.Text += " (Unbekannt)";
if (!App.Config.Debug) {
HelpMenu.Items.Remove(Menu_Help_TestWindow);
//QueryWindowButton.Visibility = Visibility.Hidden;
}
if (App.Config.UpdateUrl == null) Menu_Help_Update.IsEnabled = false;
if (App.Config.Smtp == null) Menu_Help_Smtp.IsEnabled = false;
}
private void Window_Loaded(object sender, RoutedEventArgs evt) { }
private void Window_Loaded(object sender, RoutedEventArgs evt) {
SeasonInput.Value = Utils.CurrentLastSeason;
}
private void Window_Closing(object sender, CancelEventArgs evt) {
if (App.NumWindows > 1 && !App.ForceShutdown) {
@ -35,11 +40,6 @@ namespace Elwig.Windows {
}
}
private void Menu_Help_TestWindow_Click(object sender, RoutedEventArgs evt) {
var w = new TestWindow();
w.Show();
}
private async void Menu_Help_Update_Click(object sender, RoutedEventArgs evt) {
await App.CheckForUpdates();
}
@ -56,11 +56,20 @@ namespace Elwig.Windows {
Mouse.OverrideCursor = null;
}
private void Menu_Help_Config_Click(object sender, RoutedEventArgs evt) {
Process.Start("explorer.exe", App.DataPath);
}
private void Menu_Database_Query_Click(object sender, RoutedEventArgs evt) {
var w = new QueryWindow();
w.Show();
}
private void Menu_Database_Open_Click(object sender, RoutedEventArgs evt) {
if (Path.GetDirectoryName(App.Config.DatabaseFile) is string path)
Process.Start("explorer.exe", path);
}
private void MemberAdminButton_Click(object sender, RoutedEventArgs evt) {
var w = new MemberAdminWindow();
w.Show();
@ -79,12 +88,98 @@ namespace Elwig.Windows {
App.FocusBaseData();
}
private void SeasonFinishButton_Click(object sender, RoutedEventArgs evt) {
App.FocusSeasonFinish();
}
private void MailButton_Click(object sender, RoutedEventArgs evt) {
App.FocusMailWindow();
}
protected override Task OnRenewContext(AppDbContext ctx) {
SeasonInput_ValueChanged(null, null);
return Task.CompletedTask;
}
private void SeasonFinish_Expanded(object sender, RoutedEventArgs evt) {
Height = 530;
}
private void SeasonFinish_Collapsed(object sender, RoutedEventArgs evt) {
Height = 390;
}
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
using var ctx = new AppDbContext();
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
var valid = (s0 != null);
DeliveryConfirmationButton.IsEnabled = valid;
OverUnderDeliveryButton.IsEnabled = valid;
AutoBusinessSharesButton.IsEnabled = valid && false;
PaymentButton.IsEnabled = valid;
}
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
var w = App.FocusMailWindow(year);
w.AddDeliveryConfirmation();
}
private async void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
var d = new SaveFileDialog() {
FileName = $"Über-Unterlieferungen-{year}.ods",
DefaultExt = "ods",
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
Title = $"Über-/Unterlieferungen {year} speichern unter - Elwig"
};
if (d.ShowDialog() == false)
return;
Mouse.OverrideCursor = Cursors.AppStarting;
try {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
using var ctx = new AppDbContext();
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
var tbl3 = await MemberDeliveryPerVariantData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
using var ods = new OdsFile(d.FileName);
await ods.AddTable(tbl1);
await ods.AddTable(tbl2);
await ods.AddTable(tbl3);
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
Mouse.OverrideCursor = null;
}
private async void AutoBusinessSharesButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
if (false && App.Client.IsMatzen) {
AutoBusinessSharesButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new Billing(year);
await b.AutoAdjustBusinessShare();
Mouse.OverrideCursor = null;
AutoBusinessSharesButton.IsEnabled = true;
} else {
MessageBox.Show(
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
"für diese Genossenschaft eingestellt!\n" +
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
MessageBoxButton.OK, MessageBoxImage.Information);
}
}
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
App.FocusPaymentVariants(year);
}
}
}

View File

@ -14,6 +14,7 @@ using System.Diagnostics;
using Elwig.Models.Dtos;
using Elwig.Helpers.Export;
using Microsoft.Win32;
using Elwig.Helpers.Billing;
namespace Elwig.Windows {
public partial class MemberAdminWindow : AdministrationWindow {
@ -637,6 +638,11 @@ namespace Elwig.Windows {
private static async Task GenerateDeliveryConfirmation(Member m, int year, ExportMode mode) {
Mouse.OverrideCursor = Cursors.AppStarting;
try {
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
using var ctx = new AppDbContext();
var data = await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, year, m);
using var doc = new DeliveryConfirmation(ctx, year, m, data);

View File

@ -1,54 +0,0 @@
<local:ContextWindow x:Class="Elwig.Windows.SeasonFinishWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
Loaded="Window_Loaded"
Title="Leseabschluss - Elwig" Height="450" Width="800">
<Window.Resources>
<Style TargetType="Button">
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Padding" Value="9,3"/>
<Setter Property="Height" Value="32"/>
<Setter Property="Width" Value="200"/>
</Style>
</Window.Resources>
<Grid>
<Label Content="Saison:" Margin="50,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Padding="2,4,2,4" Height="25"/>
<xctk:IntegerUpDown Name="SeasonInput" Height="25" Width="56" FontSize="14" Minimum="1000" Maximum="9999"
Margin="110,40,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"
ValueChanged="SeasonInput_ValueChanged"/>
<Button x:Name="CalculateBucketsButton" Content="Aufteilung Berechnen"
Click="CalculateBucketsButton_Click"
Margin="50,80,0,0"/>
<CheckBox x:Name="AllowAttrIntoLowerInput" Content="Erlauben Lieferungen auch auf (konfigurierte) &quot;schlechtere&quot; Flächenbindungen aufzuteilen"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,68,0,0"/>
<CheckBox x:Name="AvoidUnderDeliveriesInput" Content="Unterlieferungen durch Abzug bei &quot;besseren&quot; Flächenbindungen vermeiden"
VerticalAlignment="Top" HorizontalAlignment="Left" Margin="255,88,0,0"/>
<CheckBox x:Name="HonorGebundenInput" Margin="255,108,0,0" VerticalAlignment="Top">
<TextBlock>Bei Lieferungen das Feld <Italic>Gebunden</Italic> berücksichtigen</TextBlock>
</CheckBox>
<Button x:Name="DeliveryConfirmationButton" Content="Anlieferungsbestätigungen"
Click="DeliveryConfirmationButton_Click"
Margin="50,120,0,0"/>
<Button x:Name="OverUnderDeliveryButton" Content="Über-/Unterlieferungen"
Click="OverUnderDeliveryButton_Click"
Margin="50,160,0,0"/>
<Button x:Name="AutoBusinessSharesButton" Content="Autom. GA nachzeichnen"
Click="AutoBusinessSharesButton_Click"
Margin="50,200,0,0"/>
<Button x:Name="PaymentButton" Content="Auszahlung"
Click="PaymentButton_Click"
Margin="50,240,0,0"/>
</Grid>
</local:ContextWindow>

View File

@ -1,135 +0,0 @@
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Helpers.Export;
using Elwig.Models.Dtos;
using Elwig.Models.Entities;
using Microsoft.Win32;
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
namespace Elwig.Windows {
public partial class SeasonFinishWindow : ContextWindow {
public SeasonFinishWindow() {
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs evt) {
SeasonInput.Value = Utils.CurrentLastSeason;
}
protected override Task OnRenewContext(AppDbContext ctx) {
SeasonInput_ValueChanged(null, null);
return Task.CompletedTask;
}
private async void SeasonInput_ValueChanged(object? sender, RoutedEventArgs? evt) {
using var ctx = new AppDbContext();
var s0 = await ctx.Seasons.FindAsync(SeasonInput.Value);
var s1 = await ctx.Seasons.FindAsync(SeasonInput.Value + 1);
var valid = (s0 != null);
var last = (s1 == null);
CalculateBucketsButton.IsEnabled = valid && last;
DeliveryConfirmationButton.IsEnabled = valid;
OverUnderDeliveryButton.IsEnabled = valid;
AutoBusinessSharesButton.IsEnabled = valid;
PaymentButton.IsEnabled = valid;
AllowAttrIntoLowerInput.IsEnabled = valid && last;
AvoidUnderDeliveriesInput.IsEnabled = valid && last;
HonorGebundenInput.IsEnabled = valid && last;
AllowAttrIntoLowerInput.IsChecked = s0?.Billing_AllowAttrsIntoLower;
AvoidUnderDeliveriesInput.IsChecked = s0?.Billing_AvoidUnderDeliveries;
HonorGebundenInput.IsChecked = s0?.Billing_HonorGebunden;
}
private async void CalculateBucketsButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
CalculateBucketsButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
try {
using var ctx = new AppDbContext();
if (await ctx.Seasons.FindAsync(year) is not Season s)
return;
s.Billing_AllowAttrsIntoLower = AllowAttrIntoLowerInput.IsChecked ?? false;
s.Billing_AvoidUnderDeliveries = AvoidUnderDeliveriesInput.IsChecked ?? false;
s.Billing_HonorGebunden = HonorGebundenInput.IsChecked ?? false;
ctx.Update(s);
await ctx.SaveChangesAsync();
} catch { }
var b = new Billing(year);
await b.FinishSeason();
await b.CalculateBuckets();
await App.HintContextChange();
Mouse.OverrideCursor = null;
CalculateBucketsButton.IsEnabled = true;
}
private void DeliveryConfirmationButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
var w = App.FocusMailWindow(year);
w.AddDeliveryConfirmation();
}
private async void OverUnderDeliveryButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
var d = new SaveFileDialog() {
FileName = $"Über-Unterlieferungen-{year}.ods",
DefaultExt = "ods",
Filter = "OpenDocument Format Spreadsheet (*.ods)|*.ods",
Title = $"Über-/Unterlieferungen {year} speichern unter - Elwig"
};
if (d.ShowDialog() == false)
return;
Mouse.OverrideCursor = Cursors.AppStarting;
try {
using var ctx = new AppDbContext();
var tbl1 = await OverUnderDeliveryData.ForSeason(ctx.OverUnderDeliveryRows, year);
var tbl2 = await AreaComUnderDeliveryData.ForSeason(ctx.AreaComUnderDeliveryRows, year);
var tbl3 = await MemberDeliveryPerVariantData.ForSeason(ctx.MemberDeliveryPerVariantRows, year);
using var ods = new OdsFile(d.FileName);
await ods.AddTable(tbl1);
await ods.AddTable(tbl2);
await ods.AddTable(tbl3);
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
Mouse.OverrideCursor = null;
}
private async void AutoBusinessSharesButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
if (false && App.Client.IsMatzen) {
AutoBusinessSharesButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new Billing(year);
await b.AutoAdjustBusinessShare();
Mouse.OverrideCursor = null;
AutoBusinessSharesButton.IsEnabled = true;
} else {
MessageBox.Show(
"Es ist kein automatisches Nachzeichnen der Geschäftsanteile\n" +
"für diese Genossenschaft eingestellt!\n" +
"Bitte wenden Sie sich an die Programmierer!", "Fehler",
MessageBoxButton.OK, MessageBoxImage.Information);
}
}
private void PaymentButton_Click(object sender, RoutedEventArgs evt) {
if (SeasonInput.Value is not int year)
return;
App.FocusPaymentVariants(year);
}
}
}

View File

@ -1,22 +0,0 @@
<Window x:Class="Elwig.Windows.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Elwig.Windows"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Test Fenster - Elwig" MinHeight="400" MinWidth="325" Height="450" Width="800" ResizeMode="CanResize">
<Grid>
<xctk:CheckComboBox x:Name="MyComboBox" HorizontalAlignment="Left" Margin="216,186,0,0" VerticalAlignment="Top" Delimiter=", "
SelectedValue="{Binding SelectedValue}"
SelectedItemsOverride="{Binding SelectedItems}"
ItemSelectionChanged="OnItemSelectionChanged"/>
<TextBlock x:Name="MyText" HorizontalAlignment="Left" Margin="318,246,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
<ListBox x:Name="MyListBox" HorizontalAlignment="Left" Margin="492,125,0,0" VerticalAlignment="Top"/>
<Button x:Name="WeighingButton1" Click="WeighingButton1_Click" Height="30" Content="Aktuelles Gewicht" Width="110" Margin="515,246,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Button x:Name="WeighingButton2" Click="WeighingButton2_Click" Height="30" Content="Wiegen" Width="110" Margin="515,285,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock x:Name="Output" Height="20" Width="200" Margin="470,329,0,0" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Button x:Name="ZipButton" Content="ZIP-File" Click="ZipButton_Click"
Margin="50,270,0,0" VerticalAlignment="Top" HorizontalAlignment="Left"/>
</Grid>
</Window>

View File

@ -1,57 +0,0 @@
using Elwig.Documents;
using Elwig.Helpers;
using Elwig.Helpers.Billing;
using Elwig.Helpers.Export;
using Elwig.Helpers.Weighing;
using Elwig.Models.Dtos;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using Xceed.Wpf.Toolkit.Primitives;
namespace Elwig.Windows {
public partial class TestWindow : Window {
public TestWindow() {
InitializeComponent();
MyComboBox.ItemsSource = new string[] { "Klasse A" , "Klasse B", "Klasse C", "Klasse D", "Klasse E", "Klasse F" };
MyListBox.ItemsSource = new string[] { "Test 1", "Test 2", "Test 3", "Test 4" };
}
private void OnItemSelectionChanged(object sender, ItemSelectionChangedEventArgs e) {
MyText.Text = string.Join(", ", MyComboBox.SelectedItems.Cast<string>());
}
private async void WeighingButton1_Click(object sender, RoutedEventArgs evt) {
try {
if (App.Scales[0] is not ICommandScale cs) return;
var res = await cs.GetCurrentWeight();
Output.Text = res.ToString();
} catch (Exception e) {
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private async void WeighingButton2_Click(object sender, RoutedEventArgs evt) {
try {
if (App.Scales[0] is not ICommandScale cs) return;
var res = await cs.Weigh();
Output.Text = res.ToString();
} catch (Exception e) {
MessageBox.Show($"Beim Wiegen ist ein Fehler aufgetreten:\n\n{e.Message}", "Waagenfehler",
MessageBoxButton.OK, MessageBoxImage.Error);
}
}
private async void ZipButton_Click(object sender, RoutedEventArgs evt) {
using var ctx = new AppDbContext();
using var ods = new OdsFile(@"C:\Users\Lorenz\Desktop\test.ods");
await ods.AddTable(await DeliveryConfirmationDeliveryData.ForMember(ctx.DeliveryParts, 2023, ctx.Members.Find(2948)));
}
}
}