BaseDataWindow: implement area commitment type list
This commit is contained in:
@ -308,8 +308,71 @@
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="Flächenbindungsverträge">
|
||||
|
||||
<TabItem Header="Flächenbindungsverträge">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="260"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox x:Name="AreaCommitmentTypeList" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="10,10,35,10"
|
||||
SelectionChanged="AreaCommitmentTypeList_SelectionChanged">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding SortId}" Width="30"/>
|
||||
<TextBlock Text="{Binding WineAttr.Name}" Width="70"/>
|
||||
<TextBlock Text="{Binding Discriminator}"/>
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Button x:Name="AreaCommitmentTypeAddButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="11" Padding="0,1.5,0,0" IsEnabled="False"
|
||||
Click="AreaCommitmentTypeAddButton_Click"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,0,5,30"/>
|
||||
<Button x:Name="AreaCommitmentTypeDeleteButton" Content="" FontFamily="Segoe MDL2 Assets" FontSize="11" Padding="0,1.5,0,0" IsEnabled="False"
|
||||
Click="AreaCommitmentTypeDeleteButton_Click"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Right" Width="25" Height="25" Margin="5,30,5,0"/>
|
||||
|
||||
<Grid Grid.Column="1" Margin="0,10,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="100"/>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Content="Identifikator:" Margin="10,10,0,10"/>
|
||||
<TextBox x:Name="AreaCommitmentTypeIdInput" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,10,10,10" Width="50" HorizontalAlignment="Left" IsEnabled="False"/>
|
||||
|
||||
<Label Content="Sorte:" Margin="10,40,0,10"/>
|
||||
<ComboBox x:Name="AreaCommitmentTypeWineVariantInput" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,40,10,10" Width="250" HorizontalAlignment="Left"
|
||||
ItemTemplate="{StaticResource WineVarietyTemplate}" TextSearch.TextPath="Name"
|
||||
SelectionChanged="AreaCommitmentType_Changed"/>
|
||||
|
||||
<Label Content="Attribut:" Margin="10,70,0,10"/>
|
||||
<ComboBox x:Name="AreaCommitmentTypeWineAttributeInput" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,70,10,10" Width="250" HorizontalAlignment="Left"
|
||||
SelectionChanged="AreaCommitmentType_Changed"/>
|
||||
|
||||
<Label Content="Lieferpflicht:" Margin="10,100,0,10" Grid.ColumnSpan="2"/>
|
||||
<ctrl:UnitTextBox x:Name="AreaCommitmentTypeMinKgPerHaInput" Unit="kg/ha" Grid.Column="2" Margin="0,100,10,10" Width="80" HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
TextChanged="AreaCommitmentTypeMinKgPerHa_TextChanged"/>
|
||||
|
||||
<Label Content="Strafe (pro unterl. kg):" Margin="10,130,0,10" Grid.ColumnSpan="2"/>
|
||||
<ctrl:UnitTextBox x:Name="AreaCommitmentTypePenaltyPerKgInput" Unit="€/kg" Grid.Column="2" Margin="0,130,10,10" Width="80"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
TextChanged="AreaCommitmentTypePenaltyPerKgInput_TextChanged"/>
|
||||
|
||||
<Label Content="Strafe (bei Unterlieferung):" Margin="10,160,0,10" Grid.ColumnSpan="2"/>
|
||||
<ctrl:UnitTextBox x:Name="AreaCommitmentTypePenaltyInput" Unit="€" Grid.Column="2" Margin="0,160,10,10" Width="68"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
TextChanged="AreaCommitmentTypePenaltyInput_TextChanged"/>
|
||||
|
||||
<Label Content="Strafe (bei Nicht-Lieferung):" Margin="10,190,0,10" Grid.ColumnSpan="2"/>
|
||||
<ctrl:UnitTextBox x:Name="AreaCommitmentTypePenaltyNoneInput" Unit="€" Grid.Column="2" Margin="0,190,10,10" Width="68"
|
||||
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||
TextChanged="AreaCommitmentTypePenaltyInput_TextChanged"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Saisons">
|
||||
@ -377,11 +440,11 @@
|
||||
Grid.Column="3" Width="80" Margin="0,70,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
|
||||
<Label Content="Strafe (Unterlieferung):" Margin="10,100,0,10" Grid.Column="2"/>
|
||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonMoneyInput_TextChanged"
|
||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
||||
Grid.Column="3" Width="68" Margin="0,100,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
|
||||
<Label Content="Strafe (Nicht-Lieferung):" Margin="10,130,0,10" Grid.Column="2"/>
|
||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonMoneyInput_TextChanged"
|
||||
<ctrl:UnitTextBox x:Name="SeasonPenaltyNoneInput" Unit="€" TextChanged="SeasonPenaltyInput_TextChanged"
|
||||
Grid.Column="3" Width="68" Margin="0,130,10,10" HorizontalAlignment="Left" VerticalAlignment="Top"/>
|
||||
</Grid>
|
||||
|
||||
|
154
Elwig/Windows/BaseDataWindow.xaml.AreaCom.cs
Normal file
154
Elwig/Windows/BaseDataWindow.xaml.AreaCom.cs
Normal file
@ -0,0 +1,154 @@
|
||||
using Elwig.Helpers;
|
||||
using Elwig.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows;
|
||||
|
||||
namespace Elwig.Windows {
|
||||
public partial class BaseDataWindow {
|
||||
|
||||
private Dictionary<string, string?>? _acts = null;
|
||||
private Dictionary<AreaComType, string>? _actIds = null;
|
||||
private ObservableCollection<AreaComType>? _actList = null;
|
||||
private bool _actChanged = false;
|
||||
private bool _actUpdate = false;
|
||||
|
||||
private void AreaCommitmentTypesInitEditing() {
|
||||
_actList = new(Context.AreaCommitmentTypes.OrderBy(v => v.VtrgId).ToList());
|
||||
_acts = _actList.ToDictionary(v => v.VtrgId, v => (string?)v.VtrgId);
|
||||
_actIds = _actList.ToDictionary(v => v, v => v.VtrgId);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, _actList, a => (a as AreaComType)?.VtrgId);
|
||||
AreaCommitmentTypeList_SelectionChanged(null, null);
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypesFinishEditing() {
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, Context.AreaCommitmentTypes.OrderBy(v => v.SortId).ToList(), v => (v as AreaComType)?.VtrgId);
|
||||
_actList = null;
|
||||
_acts = null;
|
||||
_actIds = null;
|
||||
_actChanged = false;
|
||||
|
||||
AreaCommitmentTypeAddButton.IsEnabled = false;
|
||||
AreaCommitmentTypeDeleteButton.IsEnabled = false;
|
||||
}
|
||||
|
||||
private async Task AreaCommitmentTypesSave() {
|
||||
if (!_actChanged || _actList == null || _acts == null || _actIds == null)
|
||||
return;
|
||||
|
||||
foreach (var (vtrgid, _) in _acts.Where(a => a.Value == null)) {
|
||||
Context.Remove(Context.AreaCommitmentTypes.Find(vtrgid));
|
||||
}
|
||||
foreach (var (attr, old) in _actIds) {
|
||||
attr.VtrgId = old;
|
||||
}
|
||||
foreach (var (old, vtrgid) in _acts.Where(a => a.Value != null)) {
|
||||
Context.Update(Context.AreaCommitmentTypes.Find(old));
|
||||
}
|
||||
await Context.SaveChangesAsync();
|
||||
|
||||
foreach (var (old, vtrgid) in _acts.Where(a => a.Value != null)) {
|
||||
await Context.Database.ExecuteSqlAsync($"UPDATE area_commitment_type SET vtrgid = {vtrgid} WHERE vtrgid = {old}");
|
||||
}
|
||||
await Context.SaveChangesAsync();
|
||||
|
||||
foreach (var type in _actList.Where(a => !_actIds.ContainsKey(a))) {
|
||||
if (type.VtrgId == null) continue;
|
||||
await Context.AddAsync(type);
|
||||
}
|
||||
await Context.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypeList_SelectionChanged(object? sender, SelectionChangedEventArgs? evt) {
|
||||
UpdateButtons();
|
||||
_actUpdate = true;
|
||||
if (AreaCommitmentTypeList.SelectedItem is AreaComType type) {
|
||||
AreaCommitmentTypeIdInput.Text = $"{type.SortId}{type.AttrId}";
|
||||
ControlUtils.SelectComboBoxItem(AreaCommitmentTypeWineVariantInput, s => (s as WineVar)?.SortId, type.SortId);
|
||||
ControlUtils.SelectComboBoxItem(AreaCommitmentTypeWineAttributeInput, a => (a as WineAttr)?.AttrId, type.AttrId);
|
||||
AreaCommitmentTypeMinKgPerHaInput.Text = $"{type.MinKgPerHa}";
|
||||
AreaCommitmentTypePenaltyPerKgInput.Text = $"{type.PenaltyPerKg}";
|
||||
AreaCommitmentTypePenaltyInput.Text = $"{type.PenaltyAmount}";
|
||||
AreaCommitmentTypePenaltyNoneInput.Text = $"{type.PenaltyNone}";
|
||||
} else {
|
||||
AreaCommitmentTypeIdInput.Text = "";
|
||||
AreaCommitmentTypeWineVariantInput.SelectedItem = null;
|
||||
AreaCommitmentTypeWineAttributeInput.SelectedItem = null;
|
||||
AreaCommitmentTypeMinKgPerHaInput.Text = "";
|
||||
AreaCommitmentTypePenaltyPerKgInput.Text = "";
|
||||
AreaCommitmentTypePenaltyInput.Text = "";
|
||||
AreaCommitmentTypePenaltyNoneInput.Text = "";
|
||||
}
|
||||
_actUpdate = false;
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypeAddButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (_actList == null) return;
|
||||
_actChanged = true;
|
||||
var item = Context.CreateProxy<AreaComType>();
|
||||
_actList.Add(item);
|
||||
AreaCommitmentTypeList.SelectedItem = item;
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypeDeleteButton_Click(object sender, RoutedEventArgs evt) {
|
||||
if (_actList == null || _acts == null) return;
|
||||
_actChanged = true;
|
||||
var idx = AreaCommitmentTypeList.SelectedIndex;
|
||||
var item = _actList[idx];
|
||||
_acts[item.VtrgId] = null;
|
||||
_actList.RemoveAt(idx);
|
||||
AreaCommitmentTypeList.SelectedIndex = idx < _actList.Count ? idx : idx - 1;
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void AreaCommitmentType_Changed(object? sender, RoutedEventArgs? evt) {
|
||||
if (_actUpdate || (!IsEditing && !IsCreating) || AreaCommitmentTypeList.SelectedItem is not AreaComType attr || _acts == null || _actIds == null) return;
|
||||
_actChanged = true;
|
||||
|
||||
var v = AreaCommitmentTypeWineVariantInput.SelectedItem as WineVar;
|
||||
var a = AreaCommitmentTypeWineAttributeInput.SelectedItem as WineAttr;
|
||||
AreaCommitmentTypeIdInput.Text = $"{v?.SortId}{a?.AttrId}";
|
||||
|
||||
var old = _actIds.GetValueOrDefault(attr);
|
||||
var id = AreaCommitmentTypeIdInput.Text;
|
||||
if (old != null) _acts[old] = id;
|
||||
attr.VtrgId = id;
|
||||
attr.SortId = v?.SortId;
|
||||
attr.AttrId = a?.AttrId;
|
||||
attr.MinKgPerHa = AreaCommitmentTypeMinKgPerHaInput.Text.Length > 0 ? int.Parse(AreaCommitmentTypeMinKgPerHaInput.Text) : null;
|
||||
attr.PenaltyPerKg = AreaCommitmentTypePenaltyPerKgInput.Text.Length > 0 ? decimal.Parse(AreaCommitmentTypePenaltyPerKgInput.Text) : null;
|
||||
attr.PenaltyAmount = AreaCommitmentTypePenaltyInput.Text.Length > 0 ? decimal.Parse(AreaCommitmentTypePenaltyInput.Text) : null;
|
||||
attr.PenaltyNone = AreaCommitmentTypePenaltyNoneInput.Text.Length > 0 ? decimal.Parse(AreaCommitmentTypePenaltyNoneInput.Text) : null;
|
||||
|
||||
CollectionViewSource.GetDefaultView(_actList).Refresh();
|
||||
UpdateButtons();
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypeIdInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
UpperCaseInput_TextChanged(sender, evt);
|
||||
AreaCommitmentType_Changed(sender, evt);
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypeMinKgPerHa_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
InputTextChanged((TextBox)sender, Validator.CheckInteger((TextBox)sender, false, 5));
|
||||
AreaCommitmentType_Changed(sender, evt);
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypePenaltyPerKgInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
if (SeasonList.SelectedItem is not Season s) return;
|
||||
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 2, s.Precision));
|
||||
AreaCommitmentType_Changed(sender, evt);
|
||||
}
|
||||
|
||||
private void AreaCommitmentTypePenaltyInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
||||
AreaCommitmentType_Changed(sender, evt);
|
||||
}
|
||||
}
|
||||
}
|
@ -49,6 +49,9 @@ namespace Elwig.Windows {
|
||||
SeasonPenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||
SeasonPenaltyInput.Unit = sym;
|
||||
SeasonPenaltyNoneInput.Unit = sym;
|
||||
AreaCommitmentTypePenaltyPerKgInput.Unit = $"{sym}/kg";
|
||||
AreaCommitmentTypePenaltyInput.Unit = sym;
|
||||
AreaCommitmentTypePenaltyNoneInput.Unit = sym;
|
||||
} else {
|
||||
SeasonModifierList.ItemsSource = null;
|
||||
SeasonMaxKgPerHaInput.Text = "";
|
||||
@ -102,10 +105,9 @@ namespace Elwig.Windows {
|
||||
Season_Changed(sender, evt);
|
||||
}
|
||||
|
||||
private void SeasonMoneyInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
private void SeasonPenaltyInput_TextChanged(object sender, TextChangedEventArgs evt) {
|
||||
InputTextChanged((TextBox)sender, Validator.CheckDecimal((TextBox)sender, false, 4, 2));
|
||||
Season_Changed(sender, evt);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ namespace Elwig.Windows {
|
||||
WineAttributeIdInput, WineAttributeNameInput, WineAttributeActiveInput,
|
||||
WineAttributeMaxKgPerHaInput.TextBox, WineAttributeStrictInput, WineAttributeFillLowerInput,
|
||||
WineCultivationIdInput, WineCultivationNameInput, WineCultivationDescriptionInput,
|
||||
AreaCommitmentTypeIdInput, AreaCommitmentTypeWineVariantInput, AreaCommitmentTypeWineAttributeInput,
|
||||
AreaCommitmentTypeMinKgPerHaInput.TextBox, AreaCommitmentTypePenaltyPerKgInput.TextBox,
|
||||
AreaCommitmentTypePenaltyInput.TextBox, AreaCommitmentTypePenaltyNoneInput.TextBox,
|
||||
SeasonMaxKgPerHaInput.TextBox, SeasonVatNormalInput.TextBox, SeasonVatFlatrateInput.TextBox, SeasonStartInput, SeasonEndInput,
|
||||
SeasonMinKgPerBsInput.TextBox, SeasonMaxKgPerBsInput.TextBox, SeasonPenaltyPerKgInput.TextBox, SeasonPenaltyInput.TextBox, SeasonPenaltyNoneInput.TextBox,
|
||||
SeasonModifierIdInput, SeasonModifierNameInput, SeasonModifierRelInput.TextBox, SeasonModifierAbsInput.TextBox,
|
||||
@ -54,6 +57,22 @@ namespace Elwig.Windows {
|
||||
WineCultivationNameInput.IsReadOnly = true;
|
||||
WineCultivationDescriptionInput.IsReadOnly = true;
|
||||
|
||||
AreaCommitmentTypeWineVariantInput.IsEnabled = false;
|
||||
AreaCommitmentTypeWineAttributeInput.IsEnabled = false;
|
||||
AreaCommitmentTypeMinKgPerHaInput.TextBox.IsReadOnly = true;
|
||||
AreaCommitmentTypePenaltyPerKgInput.TextBox.IsReadOnly = true;
|
||||
AreaCommitmentTypePenaltyInput.TextBox.IsReadOnly = true;
|
||||
AreaCommitmentTypePenaltyNoneInput.TextBox.IsReadOnly = true;
|
||||
|
||||
SeasonMaxKgPerHaInput.TextBox.IsReadOnly = true;
|
||||
SeasonVatNormalInput.TextBox.IsReadOnly = true;
|
||||
SeasonVatFlatrateInput.TextBox.IsReadOnly = true;
|
||||
SeasonMinKgPerBsInput.TextBox.IsReadOnly = true;
|
||||
SeasonMaxKgPerBsInput.TextBox.IsReadOnly = true;
|
||||
SeasonPenaltyPerKgInput.TextBox.IsReadOnly = true;
|
||||
SeasonPenaltyInput.TextBox.IsReadOnly = true;
|
||||
SeasonPenaltyNoneInput.TextBox.IsReadOnly = true;
|
||||
|
||||
SeasonModifierIdInput.IsReadOnly = true;
|
||||
SeasonModifierNameInput.IsReadOnly = true;
|
||||
SeasonModifierRelInput.TextBox.IsReadOnly = true;
|
||||
@ -83,6 +102,22 @@ namespace Elwig.Windows {
|
||||
WineCultivationNameInput.IsReadOnly = false;
|
||||
WineCultivationDescriptionInput.IsReadOnly = false;
|
||||
|
||||
AreaCommitmentTypeWineVariantInput.IsEnabled = true;
|
||||
AreaCommitmentTypeWineAttributeInput.IsEnabled = true;
|
||||
AreaCommitmentTypeMinKgPerHaInput.TextBox.IsReadOnly = false;
|
||||
AreaCommitmentTypePenaltyPerKgInput.TextBox.IsReadOnly = false;
|
||||
AreaCommitmentTypePenaltyInput.TextBox.IsReadOnly = false;
|
||||
AreaCommitmentTypePenaltyNoneInput.TextBox.IsReadOnly = false;
|
||||
|
||||
SeasonMaxKgPerHaInput.TextBox.IsReadOnly = false;
|
||||
SeasonVatNormalInput.TextBox.IsReadOnly = false;
|
||||
SeasonVatFlatrateInput.TextBox.IsReadOnly = false;
|
||||
SeasonMinKgPerBsInput.TextBox.IsReadOnly = false;
|
||||
SeasonMaxKgPerBsInput.TextBox.IsReadOnly = false;
|
||||
SeasonPenaltyPerKgInput.TextBox.IsReadOnly = false;
|
||||
SeasonPenaltyInput.TextBox.IsReadOnly = false;
|
||||
SeasonPenaltyNoneInput.TextBox.IsReadOnly = false;
|
||||
|
||||
SeasonModifierIdInput.IsReadOnly = false;
|
||||
SeasonModifierNameInput.IsReadOnly = false;
|
||||
SeasonModifierRelInput.TextBox.IsReadOnly = false;
|
||||
@ -100,13 +135,19 @@ namespace Elwig.Windows {
|
||||
var year = (SeasonList.SelectedItem as Season)?.Year;
|
||||
ControlUtils.RenewItemsSource(BranchList, await Context.Branches.OrderBy(b => b.Name).ToListAsync(), b => (b as Branch)?.ZwstId, null, ControlUtils.RenewSourceDefault.First);
|
||||
ControlUtils.RenewItemsSource(WineAttributeList, await Context.WineAttributes.OrderBy(a => a.Name).ToListAsync(), a => (a as WineAttr)?.AttrId, null, ControlUtils.RenewSourceDefault.First);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeWineVariantInput, await Context.WineVarieties.OrderBy(s => s.Name).ToListAsync(), s => (s as WineVar)?.SortId);
|
||||
var attrList = await Context.WineAttributes.OrderBy(a => a.Name).Cast<object>().ToListAsync();
|
||||
attrList.Insert(0, new NullItem(""));
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeWineAttributeInput, attrList, a => (a as WineAttr)?.AttrId);
|
||||
ControlUtils.RenewItemsSource(AreaCommitmentTypeList, await Context.AreaCommitmentTypes.OrderBy(v => v.VtrgId).ToListAsync(), v => (v as AreaComType)?.VtrgId, null, ControlUtils.RenewSourceDefault.First);
|
||||
ControlUtils.RenewItemsSource(WineCultivationList, await Context.WineCultivations.OrderBy(c => c.Name).ToListAsync(), c=> (c as WineCult)?.CultId, null, ControlUtils.RenewSourceDefault.First);
|
||||
ControlUtils.RenewItemsSource(SeasonModifierList, await Context.Modifiers.Where(m => m.Year == year).OrderBy(m => m.Ordering).ToListAsync(), m => (m as Modifier)?.ModId, null, ControlUtils.RenewSourceDefault.First);
|
||||
}
|
||||
|
||||
protected override void UpdateButtons() {
|
||||
if (!IsEditing && !IsCreating) return;
|
||||
bool ch = _branchChanged || _attrChanged || _cultChanged || _seasonChanged || _modChanged || HasChanged,
|
||||
bool ch = _branchChanged || _attrChanged || _cultChanged || _actChanged ||
|
||||
_seasonChanged || _modChanged || HasChanged,
|
||||
v = IsValid;
|
||||
CancelButton.IsEnabled = true;
|
||||
ResetButton.IsEnabled = ch;
|
||||
@ -118,7 +159,8 @@ namespace Elwig.Windows {
|
||||
WineAttributeDeleteButton.IsEnabled = WineAttributeList.SelectedIndex != -1;
|
||||
WineCultivationAddButton.IsEnabled = true;
|
||||
WineCultivationDeleteButton.IsEnabled = WineCultivationList.SelectedIndex != -1;
|
||||
|
||||
AreaCommitmentTypeAddButton.IsEnabled = true;
|
||||
AreaCommitmentTypeDeleteButton.IsEnabled = AreaCommitmentTypeList.SelectedIndex != -1;
|
||||
SeasonModifierUpButton.IsEnabled = SeasonModifierList.SelectedIndex >= 1;
|
||||
SeasonModifierDownButton.IsEnabled = SeasonModifierList.SelectedIndex != -1 && SeasonModifierList.SelectedIndex < (_modList?.Count - 1 ?? 0);
|
||||
SeasonModifierAddButton.IsEnabled = true;
|
||||
@ -133,8 +175,10 @@ namespace Elwig.Windows {
|
||||
BranchesInitEditing();
|
||||
WineAttributesInitEditing();
|
||||
WineCultivationsInitEditing();
|
||||
AreaCommitmentTypesInitEditing();
|
||||
SeasonsInitEditing();
|
||||
ModifiersInitEditing();
|
||||
|
||||
UnlockInputs();
|
||||
UpdateButtons();
|
||||
}
|
||||
@ -152,6 +196,7 @@ namespace Elwig.Windows {
|
||||
BranchesFinishEditing();
|
||||
WineCultivationsFinishEditing();
|
||||
WineAttributesFinishEditing();
|
||||
AreaCommitmentTypesFinishEditing();
|
||||
SeasonsFinishEditing();
|
||||
ModifiersFinishEditing();
|
||||
|
||||
@ -170,6 +215,7 @@ namespace Elwig.Windows {
|
||||
BranchesInitEditing();
|
||||
WineAttributesInitEditing();
|
||||
WineCultivationsInitEditing();
|
||||
AreaCommitmentTypesInitEditing();
|
||||
SeasonsInitEditing();
|
||||
ModifiersInitEditing();
|
||||
|
||||
@ -184,6 +230,7 @@ namespace Elwig.Windows {
|
||||
await BranchesSave();
|
||||
await WineAttributesSave();
|
||||
await WineCultivationsSave();
|
||||
await AreaCommitmentTypesSave();
|
||||
await SeasonsSave();
|
||||
await ModifiersSave();
|
||||
} catch (Exception exc) {
|
||||
@ -203,6 +250,7 @@ namespace Elwig.Windows {
|
||||
BranchesFinishEditing();
|
||||
WineAttributesFinishEditing();
|
||||
WineCultivationsFinishEditing();
|
||||
AreaCommitmentTypesFinishEditing();
|
||||
SeasonsFinishEditing();
|
||||
ModifiersFinishEditing();
|
||||
|
||||
|
Reference in New Issue
Block a user