diff --git a/Elwig/Dialogs/AreaComModifyDialog.xaml b/Elwig/Dialogs/AreaComModifyDialog.xaml
new file mode 100644
index 0000000..31dd20d
--- /dev/null
+++ b/Elwig/Dialogs/AreaComModifyDialog.xaml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+ Soll die Flächenbindung ( m², –) rückwirkend bearbeitet werden,
+ oder erst ab der angegebenen Saison?
+
+
+ Soll die Flächenbindung ( m², –) rückwirkend gelöscht werden,
+ oder erst ab der angegebenen Saison?
+
+
+
+
+
+
+
+ Die Flächenbindung bleibt bis inkl. Saison unverändert,
+ und wird ab inkl. Saison in geänderter Form übernommen.
+
+
+ Die Flächenbindung bleibt bis inklusive Saison gültig.
+
+
+
+
+
+
diff --git a/Elwig/Dialogs/AreaComModifyDialog.xaml.cs b/Elwig/Dialogs/AreaComModifyDialog.xaml.cs
new file mode 100644
index 0000000..0c2da99
--- /dev/null
+++ b/Elwig/Dialogs/AreaComModifyDialog.xaml.cs
@@ -0,0 +1,62 @@
+using Elwig.Helpers;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace Elwig.Dialogs {
+ public partial class AreaComModifyDialog : Window {
+
+ public int? YearTo { get; set; }
+ public bool ModifyRetroactively { get; set; }
+
+ public string OrigYearFrom { get; set; }
+ public string OrigYearTo { get; set; }
+ public string Area { get; set; }
+
+ public AreaComModifyDialog(int? yearFrom, int? yearTo, int area, bool delete) {
+ Area = $"{area:N0}";
+ OrigYearFrom = $"{yearFrom}";
+ OrigYearTo = $"{yearTo}";
+ InitializeComponent();
+ Title = delete ? "Flächenbindung löschen" : "Flächenbindung bearbeiten";
+ RetroactiveInput.Content = delete ? "Rückwirkend löschen" : "Rückwirkend bearbeiten";
+ if (delete) {
+ QuestionBlock1.Visibility = Visibility.Hidden;
+ QuestionBlock2.Visibility = Visibility.Visible;
+ DescBlock1.Visibility = Visibility.Hidden;
+ DescBlock2.Visibility = Visibility.Visible;
+ }
+ if ((yearTo.HasValue && yearTo < Utils.CurrentNextSeason) || (yearFrom.HasValue && yearFrom >= Utils.CurrentNextSeason)) {
+ RetroactiveInput.IsChecked = true;
+ } else {
+ SeasonInput.Text = $"{Utils.CurrentNextSeason}";
+ }
+ }
+
+ private void SeasonInput_TextChanged(object sender, TextChangedEventArgs evt) {
+ YearTo = SeasonInput.Value! - 1;
+ CancelSeason1.Text = $"{YearTo}";
+ CancelSeason2.Text = $"{YearTo}";
+ NewSeason1.Text = $"{YearTo + 1}";
+ }
+
+ private void RetroactiveInput_Changed(object sender, RoutedEventArgs evt) {
+ if (ModifyRetroactively) {
+ SeasonInput.IsEnabled = false;
+ SeasonInput.Text = "";
+ YearTo = null;
+ DescBlock1.Visibility = Visibility.Hidden;
+ DescBlock2.Visibility = Visibility.Hidden;
+ } else {
+ SeasonInput.IsEnabled = true;
+ SeasonInput.Text = $"{Utils.CurrentNextSeason}";
+ DescBlock1.Visibility = QuestionBlock1.Visibility;
+ DescBlock2.Visibility = QuestionBlock2.Visibility;
+ }
+ }
+
+ private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
+ DialogResult = true;
+ Close();
+ }
+ }
+}
diff --git a/Elwig/Services/AreaComService.cs b/Elwig/Services/AreaComService.cs
index 403c2d6..1e32b44 100644
--- a/Elwig/Services/AreaComService.cs
+++ b/Elwig/Services/AreaComService.cs
@@ -106,13 +106,13 @@ namespace Elwig.Services {
}
public static async Task UpdateAreaCommitment(this AreaComAdminViewModel vm, int? oldFbNr) {
- int newFbNr = (int)vm.FbNr!;
+ int newFbNr = vm.FbNr!.Value;
return await Task.Run(async () => {
using var ctx = new AppDbContext();
var a = new AreaCom {
FbNr = oldFbNr ?? newFbNr,
- MgNr = (int)vm.MgNr!,
+ MgNr = vm.MgNr!.Value,
YearFrom = vm.YearFrom,
YearTo = vm.YearTo,
VtrgId = vm.AreaComType!.VtrgId,
@@ -120,8 +120,8 @@ namespace Elwig.Services {
Comment = string.IsNullOrEmpty(vm.Comment) ? null : vm.Comment,
KgNr = vm.Kg!.KgNr,
RdNr = vm.Rd?.RdNr,
- GstNr = vm.GstNr!.Trim(),
- Area = (int)vm.Area!,
+ GstNr = vm.GstNr?.Trim() ?? "-",
+ Area = vm.Area!.Value,
};
if (vm.Rd?.RdNr == 0) {
diff --git a/Elwig/Windows/AreaComAdminWindow.xaml b/Elwig/Windows/AreaComAdminWindow.xaml
index 5de24c5..ca57ce7 100644
--- a/Elwig/Windows/AreaComAdminWindow.xaml
+++ b/Elwig/Windows/AreaComAdminWindow.xaml
@@ -153,19 +153,19 @@
-
-
-