Compare commits

...

7 Commits

16 changed files with 56 additions and 35 deletions
+11 -6
View File
@@ -65,22 +65,27 @@ namespace Elwig {
MainDispatcher = Dispatcher;
Scales = Array.Empty<IScale>();
CurrentApp = this;
OverrideCulture();
}
protected override async void OnStartup(StartupEventArgs evt) {
var locale = new CultureInfo("de-AT");
locale.NumberFormat.CurrencyGroupSeparator = "\u202f";
locale.NumberFormat.NumberGroupSeparator = "\u202f";
locale.NumberFormat.PercentGroupSeparator = "\u202f";
private static void OverrideCulture() {
var locale = new CultureInfo("de-AT", false);
locale.NumberFormat.CurrencyGroupSeparator = Utils.GroupSeparator;
locale.NumberFormat.NumberGroupSeparator = Utils.GroupSeparator;
locale.NumberFormat.PercentGroupSeparator = Utils.GroupSeparator;
CultureInfo.CurrentCulture = locale;
CultureInfo.CurrentUICulture = locale;
Thread.CurrentThread.CurrentCulture = locale;
Thread.CurrentThread.CurrentUICulture = locale;
CultureInfo.DefaultThreadCurrentCulture = locale;
CultureInfo.DefaultThreadCurrentUICulture = locale;
FrameworkElement.LanguageProperty.OverrideMetadata(
typeof(FrameworkElement),
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))
new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.Name))
);
}
protected override async void OnStartup(StartupEventArgs evt) {
Version = typeof(App).GetTypeInfo().Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion.Split("+")[0] ?? "0.0.0";
try {
+1 -1
View File
@@ -12,7 +12,7 @@ namespace Elwig.Dialogs {
InitializeComponent();
TextLsNr.Text = lsnr;
TextMember.Text = name;
TextWeight.Text = $"{weight:N0}\u202fkg";
TextWeight.Text = $"{weight:N0}{Utils.UnitSeparator}kg";
}
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
@@ -1,5 +1,4 @@
using Elwig.Helpers;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls;
@@ -14,7 +13,7 @@ namespace Elwig.Dialogs {
private void ConfirmButton_Click(object sender, RoutedEventArgs evt) {
DialogResult = true;
Price = double.Parse(PriceInput.Text.Replace("\u202f", ""));
Price = double.Parse(PriceInput.Text.Replace(Utils.GroupSeparator, ""));
Close();
}
+3 -3
View File
@@ -24,9 +24,9 @@ namespace Elwig.Helpers {
public void Read() {
var config = new ConfigurationBuilder().AddIniFile(FileName).Build();
DatabaseFile = Utils.GetAbsolutePath(config["database:file"] ?? "database.sqlite3", App.DataPath);
DatabaseFile = Path.Combine(App.DataPath, config["database:file"] ?? "database.sqlite3");
var log = config["database:log"];
DatabaseLog = log != null ? Utils.GetAbsolutePath(log, App.DataPath) : null;
DatabaseLog = log != null ? Path.Combine(App.DataPath, log) : null;
Branch = config["general:branch"];
Debug = trueValues.Contains(config["general:debug"]?.ToLower());
@@ -35,7 +35,7 @@ namespace Elwig.Helpers {
Scales = ScaleList;
foreach (var s in scales) {
string? scaleLog = config[$"scale.{s}:log"];
if (scaleLog != null) scaleLog = Utils.GetAbsolutePath(scaleLog, App.DataPath);
if (scaleLog != null) scaleLog = Path.Combine(App.DataPath, scaleLog);
ScaleList.Add([
s, config[$"scale.{s}:type"], config[$"scale.{s}:model"], config[$"scale.{s}:connection"],
config[$"scale.{s}:empty"], config[$"scale.{s}:filling"], config[$"scale.{s}:limit"], scaleLog
+3 -4
View File
@@ -48,6 +48,9 @@ namespace Elwig.Helpers {
[GeneratedRegex(@"^(.*?) +([0-9].*)$", RegexOptions.Compiled)]
private static partial Regex GeneratedAddressRegex();
public static readonly string GroupSeparator = "\u202F";
public static readonly string UnitSeparator = "\u00A0";
public static readonly KeyValuePair<string, string>[] PhoneNrTypes = [
new("landline", "Tel.-Nr. (Festnetz)"),
new("mobile", "Tel.-Nr. (mobil)"),
@@ -356,9 +359,5 @@ namespace Elwig.Helpers {
}
return output.OrderByDescending(l => l.Count());
}
public static string GetAbsolutePath(string path, string basePath) {
return (path.Length > 1 && (path[1] == ':' || path[0] == '/' || path[0] == '\\')) ? Path.Combine(basePath, path) : path;
}
}
}
@@ -26,6 +26,10 @@ namespace Elwig.Models.Dtos {
MgNr = m.MgNr;
}
public static DeliveryConfirmationData CreateEmpty(int year, Member m) {
return new([], year, m);
}
public static async Task<IDictionary<int, DeliveryConfirmationData>> ForSeason(DbSet<DeliveryPart> table, int year) {
return (await FromDbSet(table, year))
.GroupBy(
@@ -9,7 +9,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<PublishDir>bin\Publish</PublishDir>
<PublishProtocol>FileSystem</PublishProtocol>
<_TargetId>Folder</_TargetId>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net8.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<SelfContained>true</SelfContained>
<PublishSingleFile>false</PublishSingleFile>
@@ -125,6 +125,7 @@ namespace Elwig.Windows {
if (old != null) _branches[old] = id;
branch.ZwstId = id;
branch.Name = BranchNameInput.Text;
branch.CountryNum = 40;
branch.PostalDestId = (BranchOrtInput.SelectedItem as AT_PlzDest)?.Id;
branch.Address = BranchAddressInput.Text;
branch.PhoneNr = BranchPhoneNrInput.Text;
+5 -4
View File
@@ -52,13 +52,13 @@ namespace Elwig.Windows {
var year = (SeasonList.SelectedItem as Season)?.Year;
foreach (var (modid, _) in _mods.Where(m => m.Value == null)) {
Context.Remove(Context.Modifiers.Find(new object?[] { year, modid }));
Context.Remove(Context.Modifiers.Find(year, modid));
}
foreach (var (mod, old) in _modIds) {
mod.ModId = old;
}
foreach (var (old, modid) in _mods.Where(m => m.Value != null)) {
Context.Update(Context.Modifiers.Find(new object?[] { year, old }));
Context.Update(Context.Modifiers.Find(year, old));
}
await Context.SaveChangesAsync();
@@ -102,8 +102,9 @@ namespace Elwig.Windows {
if (_modList == null || SeasonList.SelectedItem is not Season s) return;
_modChanged = true;
var idx = (SeasonModifierList.SelectedIndex != -1) ? SeasonModifierList.SelectedIndex + 1 : _modList.Count;
var item = Context.CreateProxy<Modifier>();
item.Year = s.Year;
var item = new Modifier {
Year = s.Year
};
_modList.Insert(idx, item);
SeasonModifierList.SelectedIndex = idx;
UpdateButtons();
+2
View File
@@ -264,6 +264,8 @@ namespace Elwig.Windows {
ClearInputStates();
FillInputs(App.Client);
LockInputs();
await HintContextChange();
}
private void FillInputs(ClientParameters p) {
+1 -1
View File
@@ -889,7 +889,7 @@ namespace Elwig.Windows {
p.Acid = (AcidInput.Text == "") ? null : double.Parse(AcidInput.Text);
p.Comment = (PartCommentInput.Text == "") ? null : PartCommentInput.Text;
p.Weight = int.Parse(WeightInput.Text.Replace("\u202f", ""));
p.Weight = int.Parse(WeightInput.Text.Replace(Utils.GroupSeparator, ""));
p.ManualWeighing = ManualWeighingInput.IsChecked ?? false;
p.ScaleId = ScaleId;
p.WeighingId = WeighingId;
@@ -76,7 +76,7 @@ namespace Elwig.Dialogs {
IEnumerable<Member> list = await members.ToListAsync();
var data = await DeliveryConfirmationData.ForSeason(Context.DeliveryParts, Year);
using var doc = Document.Merge(list.Select(m =>
new DeliveryConfirmation(Context, Year, m, data[m.MgNr]) {
new DeliveryConfirmation(Context, Year, m, data.TryGetValue(m.MgNr, out var d) ? d : DeliveryConfirmationData.CreateEmpty(Year, m)) {
//DoubleSided = true
}
));
+6 -2
View File
@@ -259,8 +259,12 @@ namespace Elwig.Windows {
return;
CommitButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
var b = new BillingVariant(v.Year, v.AvNr);
await b.Commit();
try {
var b = new BillingVariant(v.Year, v.AvNr);
await b.Commit();
} catch (Exception exc) {
MessageBox.Show(exc.Message, "Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
}
Mouse.OverrideCursor = null;
RevertButton.IsEnabled = true;
await App.HintContextChange();
+2 -2
View File
@@ -60,6 +60,6 @@
<None Include="Files\config.ini" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Heat" Version="4.0.1" />
<PackageReference Include="WixToolset.Heat" Version="4.0.3" />
</ItemGroup>
</Project>
</Project>
+3 -3
View File
@@ -13,7 +13,7 @@
</Target>
<ItemGroup>
<ProjectReference Include="..\Installer\Installer.wixproj" />
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.1" />
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.3" />
<PackageReference Include="WixToolset.Util.wixext" Version="4.0.3" />
</ItemGroup>
</Project>
</Project>
+11 -5
View File
@@ -18,11 +18,17 @@
</Target>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.5.0" />
<PackageReference Include="coverlet.collector" Version="3.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NUnit" Version="4.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageReference Include="NUnit.Analyzers" Version="3.10.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>