Compare commits

..

3 Commits

Author SHA1 Message Date
lorenz.stechauner 74200083ab DeliveryAncmtAdminWindow: Mark cancelled schedules with Strikethrough
Test / Run tests (push) Successful in 1m38s
2024-09-17 23:08:22 +02:00
lorenz.stechauner 871bc299bd Utils: Fix SplitName() for double names
Test / Run tests (push) Successful in 1m46s
2024-09-17 19:18:43 +02:00
lorenz.stechauner a18b58f438 DeliveryAncmtAdminWindow: Make delivery schedule list bigger
Test / Run tests (push) Successful in 2m10s
2024-09-17 19:07:59 +02:00
3 changed files with 10 additions and 5 deletions
+4 -2
View File
@@ -348,7 +348,7 @@ namespace Elwig.Helpers {
} }
public static (string, string?) SplitName(string fullName, string? familyName) { public static (string, string?) SplitName(string fullName, string? familyName) {
if (familyName == null || familyName == "") return (fullName, null); if (string.IsNullOrWhiteSpace(familyName)) return (fullName, null);
var p0 = fullName.IndexOf(familyName, StringComparison.CurrentCultureIgnoreCase); var p0 = fullName.IndexOf(familyName, StringComparison.CurrentCultureIgnoreCase);
if (p0 == -1) return (fullName, null); if (p0 == -1) return (fullName, null);
var p1 = fullName.IndexOf(" und "); var p1 = fullName.IndexOf(" und ");
@@ -362,8 +362,10 @@ namespace Elwig.Helpers {
var p3 = fullName.LastIndexOf(' ', p2 - 1); var p3 = fullName.LastIndexOf(' ', p2 - 1);
return (fullName[0..p3], fullName[(p3 + 1)..^0]); return (fullName[0..p3], fullName[(p3 + 1)..^0]);
} }
} else { } else if (p0 + familyName.Length >= fullName.Length || fullName[p0 + familyName.Length] == ' ') {
return (familyName, fullName.Replace(familyName, "").Replace(" ", " ").Trim()); return (familyName, fullName.Replace(familyName, "").Replace(" ", " ").Trim());
} else {
return (fullName, null);
} }
} }
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Windows;
namespace Elwig.Models.Entities { namespace Elwig.Models.Entities {
[Table("delivery_schedule"), PrimaryKey("Year", "DsNr")] [Table("delivery_schedule"), PrimaryKey("Year", "DsNr")]
@@ -47,6 +48,8 @@ namespace Elwig.Models.Entities {
[Column("cancelled")] [Column("cancelled")]
public bool IsCancelled { get; set; } public bool IsCancelled { get; set; }
[NotMapped]
public TextDecorationCollection? TextDecoration => IsCancelled ? TextDecorations.Strikethrough : null;
[Column("ancmt_from")] [Column("ancmt_from")]
public long? AncmtFromUnix { get; set; } public long? AncmtFromUnix { get; set; }
+3 -3
View File
@@ -84,7 +84,7 @@
<RowDefinition Height="42"/> <RowDefinition Height="42"/>
<RowDefinition Height="1*" MinHeight="100"/> <RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="5"/> <RowDefinition Height="5"/>
<RowDefinition Height="2*" MinHeight="100"/> <RowDefinition Height="1*" MinHeight="100"/>
<RowDefinition Height="42"/> <RowDefinition Height="42"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@@ -129,7 +129,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="24"/> <TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="24"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="32"/> <TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="32"/>
<TextBlock Text="{Binding ZwstId}" Width="25" TextAlignment="Center"/> <TextBlock Text="{Binding ZwstId}" Width="25" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}" Width="200"/> <TextBlock Text="{Binding Description}" Width="200" TextDecorations="{Binding TextDecoration}"/>
<TextBlock TextAlignment="Right"> <TextBlock TextAlignment="Right">
<TextBlock Text="{Binding AnnouncedWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg <TextBlock Text="{Binding AnnouncedWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
/ <TextBlock Text="{Binding MaxWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg / <TextBlock Text="{Binding MaxWeight, StringFormat='{}{0:N0}'}" Width="42" TextAlignment="Right"/> kg
@@ -288,7 +288,7 @@
<TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="28"/> <TextBlock Text="{Binding Date, StringFormat='ddd.'}" Width="28"/>
<TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="35"/> <TextBlock Text="{Binding Date, StringFormat='dd.MM.'}" Width="35"/>
<TextBlock Text="{Binding ZwstId}" Width="30" TextAlignment="Center"/> <TextBlock Text="{Binding ZwstId}" Width="30" TextAlignment="Center"/>
<TextBlock Text="{Binding Description}"/> <TextBlock Text="{Binding Description}" TextDecorations="{Binding TextDecoration}"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</ComboBox.ItemTemplate> </ComboBox.ItemTemplate>