Compare commits

..

5 Commits

5 changed files with 15 additions and 7 deletions

View File

@@ -82,7 +82,7 @@ namespace Elwig {
Dictionary<string, (string, string, int?, string?, string?, string?, string?, string?)> branches = new(); Dictionary<string, (string, string, int?, string?, string?, string?, string?, string?)> branches = new();
using (var ctx = new AppDbContext()) { using (var ctx = new AppDbContext()) {
branches = ctx.Branches.ToDictionary(b => b.Name.ToLower(), b => (b.ZwstId, b.Name, b.PostalDest?.AtPlz?.Plz, b.PostalDest?.AtPlz?.Dest, b.Address, b.PhoneNr, b.FaxNr, b.MobileNr)); branches = ctx.Branches.ToDictionary(b => b.Name.ToLower(), b => (b.ZwstId, b.Name, b.PostalDest?.AtPlz?.Plz, b.PostalDest?.AtPlz?.Ort.Name, b.Address, b.PhoneNr, b.FaxNr, b.MobileNr));
try { try {
Client = new(ctx); Client = new(ctx);
} catch (Exception e) { } catch (Exception e) {

View File

@@ -7,7 +7,7 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<PreserveCompilationContext>true</PreserveCompilationContext> <PreserveCompilationContext>true</PreserveCompilationContext>
<ApplicationIcon>elwig.ico</ApplicationIcon> <ApplicationIcon>elwig.ico</ApplicationIcon>
<Version>0.3.0</Version> <Version>0.3.1</Version>
<SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages> <SatelliteResourceLanguages>de-AT</SatelliteResourceLanguages>
</PropertyGroup> </PropertyGroup>

View File

@@ -70,9 +70,9 @@ namespace Elwig.Helpers {
for (int i = 0; i < input.Text.Length; i++) { for (int i = 0; i < input.Text.Length; i++) {
char ch = input.Text[i]; char ch = input.Text[i];
if (char.IsAsciiDigit(ch)) { if (char.IsAsciiDigit(ch)) {
if (v2 == -1 && v1 < maxLen) { if (v2 == -1 && (maxLen == -1 || v1 < maxLen)) {
text += ch; v1++; text += ch; v1++;
} else if (v2 != -1 && v2 < maxDecimal) { } else if (v2 != -1 && (maxDecimal == -1 || v2 < maxDecimal)) {
text += ch; v2++; text += ch; v2++;
} }
} else if (v2 == 0-1 && ch == ',' || ch == '.') { } else if (v2 == 0-1 && ch == ',' || ch == '.') {

View File

@@ -462,6 +462,10 @@ namespace Elwig.Windows {
InputTextChanged((TextBox)sender, Validator.CheckInteger); InputTextChanged((TextBox)sender, Validator.CheckInteger);
} }
protected void DecimalInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckDecimal);
}
protected void PartialDateInput_TextChanged(object sender, RoutedEventArgs evt) { protected void PartialDateInput_TextChanged(object sender, RoutedEventArgs evt) {
InputTextChanged((TextBox)sender, Validator.CheckPartialDate); InputTextChanged((TextBox)sender, Validator.CheckPartialDate);
} }

View File

@@ -117,6 +117,7 @@ namespace Elwig.Windows {
await Context.SaveChangesAsync(); await Context.SaveChangesAsync();
foreach (var mod in ModifierList.Where(m => !ModifierIds.ContainsKey(m))) { foreach (var mod in ModifierList.Where(m => !ModifierIds.ContainsKey(m))) {
if (mod.ModId == null) continue;
await Context.AddAsync(mod); await Context.AddAsync(mod);
} }
await Context.SaveChangesAsync(); await Context.SaveChangesAsync();
@@ -321,6 +322,7 @@ namespace Elwig.Windows {
} }
private void SeasonModifierRelInput_TextChanged(object sender, TextChangedEventArgs evt) { private void SeasonModifierRelInput_TextChanged(object sender, TextChangedEventArgs evt) {
// DecimalInput_TextChanged(sender, evt); FIXME '-' is ignored
if ((!IsEditing && !IsCreating) || SeasonModifierList.SelectedItem is not Modifier mod) return; if ((!IsEditing && !IsCreating) || SeasonModifierList.SelectedItem is not Modifier mod) return;
ModifiersChanged = ModifiersChanged || (SeasonModifierRelInput.Text ?? "") != ((SeasonModifierList.SelectedItem as Modifier)?.Rel?.ToString() ?? ""); ModifiersChanged = ModifiersChanged || (SeasonModifierRelInput.Text ?? "") != ((SeasonModifierList.SelectedItem as Modifier)?.Rel?.ToString() ?? "");
if (ModifierUpdate) return; if (ModifierUpdate) return;
@@ -331,11 +333,13 @@ namespace Elwig.Windows {
} }
private void SeasonModifierAbsInput_TextChanged(object sender, TextChangedEventArgs evt) { private void SeasonModifierAbsInput_TextChanged(object sender, TextChangedEventArgs evt) {
if ((!IsEditing && !IsCreating) || SeasonModifierList.SelectedItem is not Modifier mod) return; // DecimalInput_TextChanged(sender, evt); FIXME '-' is ignored
if ((!IsEditing && !IsCreating) || SeasonModifierList.SelectedItem is not Modifier mod || SeasonList.SelectedItem is not Season s) return;
ModifiersChanged = ModifiersChanged || (SeasonModifierAbsInput.Text ?? "") != ((SeasonModifierList.SelectedItem as Modifier)?.Abs?.ToString() ?? ""); ModifiersChanged = ModifiersChanged || (SeasonModifierAbsInput.Text ?? "") != ((SeasonModifierList.SelectedItem as Modifier)?.Abs?.ToString() ?? "");
if (ModifierUpdate) return; if (ModifierUpdate) return;
mod.Abs = decimal.TryParse(SeasonModifierAbsInput.Text, out var v) ? v : null; // FIXME ValueStr does not work in ModifierList when modifier is newly created
if (mod.Abs != null) SeasonModifierRelInput.Text = ""; mod.AbsValue = decimal.TryParse(SeasonModifierAbsInput.Text, out var v) ? Utils.DecToDb(v, s.Precision) : null;
if (mod.AbsValue != null) SeasonModifierRelInput.Text = "";
CollectionViewSource.GetDefaultView(ModifierList).Refresh(); CollectionViewSource.GetDefaultView(ModifierList).Refresh();
UpdateButtons(); UpdateButtons();
} }