Compare commits
18
Commits
b3e7b64baf
..
db
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cd5d4aeed | ||
|
|
decc46d84a | ||
|
|
6ed8c0e231 | ||
|
|
59ea707007 | ||
|
|
0cce15a8f6 | ||
|
|
5f200fbeef | ||
|
|
d4f6b5beb9 | ||
|
|
7119e515e2 | ||
|
|
7ad0612170 | ||
|
|
9aa467d9f0 | ||
|
|
522970f341 | ||
|
|
74208a4f04 | ||
|
|
9cd6500da9 | ||
|
|
c223ca222d | ||
|
|
d53dc968de | ||
|
|
c966604b07 | ||
|
|
c0d7053847 | ||
|
|
612a55a070 |
@@ -0,0 +1,166 @@
|
|||||||
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
|
namespace Logof_Client;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Zentrale Datenbankverwaltung für Logof Client.
|
||||||
|
///
|
||||||
|
/// Zuständig für:
|
||||||
|
/// - PostgreSQL-Verbindung
|
||||||
|
/// - EF Core DbContext
|
||||||
|
/// - Datenbankmodelle
|
||||||
|
/// - Migrationen
|
||||||
|
/// - Verbindungstest
|
||||||
|
/// </summary>
|
||||||
|
public static class DatabseService
|
||||||
|
{
|
||||||
|
private static DbContextOptions<LogofDbContext>? _options;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialisiert die Datenbankverbindung.
|
||||||
|
/// Sollte einmal beim Programmstart aufgerufen werden.
|
||||||
|
/// </summary>
|
||||||
|
public static void Initialize(string connectionString)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(connectionString))
|
||||||
|
throw new ArgumentException(
|
||||||
|
"Kein Datenbank-Connection-String angegeben.",
|
||||||
|
nameof(connectionString));
|
||||||
|
|
||||||
|
var builder = new DbContextOptionsBuilder<LogofDbContext>();
|
||||||
|
|
||||||
|
builder.UseNpgsql(connectionString);
|
||||||
|
|
||||||
|
_options = builder.Options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erstellt einen neuen DbContext.
|
||||||
|
/// </summary>
|
||||||
|
public static LogofDbContext GetContext()
|
||||||
|
{
|
||||||
|
if (_options == null)
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
"DB wurde noch nicht initialisiert. " +
|
||||||
|
"Rufen Sie DB.Initialize(...) auf.");
|
||||||
|
|
||||||
|
return new LogofDbContext(_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Testet die Verbindung zum Datenbankserver.
|
||||||
|
/// </summary>
|
||||||
|
public static async Task<bool> TestConnectionAsync()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await using var db = GetContext();
|
||||||
|
return await db.Database.CanConnectAsync();
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Erstellt bzw. aktualisiert das Datenbankschema
|
||||||
|
/// anhand der vorhandenen EF-Core-Migrationen.
|
||||||
|
/// </summary>
|
||||||
|
public static async Task MigrateAsync()
|
||||||
|
{
|
||||||
|
await using var db = GetContext();
|
||||||
|
|
||||||
|
await db.Database.MigrateAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// DATABASE CONTEXT
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
public class LogofDbContext : DbContext
|
||||||
|
{
|
||||||
|
public DbSet<CustomerEx> Customers => Set<CustomerEx>();
|
||||||
|
|
||||||
|
public LogofDbContext(
|
||||||
|
DbContextOptions<LogofDbContext> options)
|
||||||
|
: base(options)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
// Customer
|
||||||
|
// --------------------------------------------------------------------
|
||||||
|
|
||||||
|
modelBuilder.Entity<CustomerEx>(entity =>
|
||||||
|
{
|
||||||
|
entity.ToTable("customers");
|
||||||
|
|
||||||
|
entity.HasKey(x => x.Id);
|
||||||
|
|
||||||
|
entity.Property(x => x.Id)
|
||||||
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
|
entity.Property(x => x.Name)
|
||||||
|
.HasMaxLength(255)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
entity.Property(x => x.Description)
|
||||||
|
.HasMaxLength(4000);
|
||||||
|
|
||||||
|
entity.Property(x => x.SenderAddress)
|
||||||
|
.HasMaxLength(4000);
|
||||||
|
|
||||||
|
entity.Property(x => x.Separator)
|
||||||
|
.HasMaxLength(1)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
// Optimistic Concurrency
|
||||||
|
entity.Property(x => x.Version)
|
||||||
|
.IsConcurrencyToken();
|
||||||
|
|
||||||
|
entity.Property(x => x.CreatedAt)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
entity.Property(x => x.UpdatedAt)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// DATABASE MODELS
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
public class CustomerEx
|
||||||
|
{
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; } = "";
|
||||||
|
|
||||||
|
public string Description { get; set; } = "";
|
||||||
|
|
||||||
|
public string SenderAddress { get; set; } = "";
|
||||||
|
|
||||||
|
public char Separator { get; set; } = ',';
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wird bei jeder Änderung erhöht.
|
||||||
|
/// Verhindert, dass zwei Benutzer sich gegenseitig
|
||||||
|
/// Änderungen überschreiben.
|
||||||
|
/// </summary>
|
||||||
|
public long Version { get; set; } = 1;
|
||||||
|
|
||||||
|
public DateTime CreatedAt { get; set; }
|
||||||
|
|
||||||
|
public DateTime UpdatedAt { get; set; }
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
|
||||||
@@ -12,7 +13,7 @@ namespace Logof_Client;
|
|||||||
public static class SchemaMigration
|
public static class SchemaMigration
|
||||||
{
|
{
|
||||||
// Current schema version - increment when you make breaking changes
|
// Current schema version - increment when you make breaking changes
|
||||||
public const int CURRENT_SCHEMA_VERSION = 3;
|
public const int CURRENT_SCHEMA_VERSION = 4;
|
||||||
|
|
||||||
// Dictionary of migration functions, keyed by the version they migrate TO
|
// Dictionary of migration functions, keyed by the version they migrate TO
|
||||||
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
private static readonly Dictionary<int, Func<JObject, JObject>> Migrations = new()
|
||||||
@@ -22,7 +23,7 @@ public static class SchemaMigration
|
|||||||
// { 2, MigrateV1ToV2 },
|
// { 2, MigrateV1ToV2 },
|
||||||
|
|
||||||
// Example: Migration from v2 to v3
|
// Example: Migration from v2 to v3
|
||||||
// { 3, MigrateV2ToV3 },
|
{ 4, MigrateV3ToV4 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -93,12 +94,12 @@ public static class SchemaMigration
|
|||||||
/// Example migration function: from v2 to v3.
|
/// Example migration function: from v2 to v3.
|
||||||
/// Add a new required field with a default value.
|
/// Add a new required field with a default value.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static JObject MigrateV2ToV3(JObject obj)
|
private static JObject MigrateV3ToV4(JObject obj)
|
||||||
{
|
{
|
||||||
// Example: Add a new field that didn't exist before
|
// Example: Add a new field that didn't exist before
|
||||||
if (!obj.ContainsKey("new_required_field"))
|
if (!obj.ContainsKey("moduleConfig"))
|
||||||
{
|
{
|
||||||
obj["new_required_field"] = "default_value";
|
obj["moduleConfig"] = JToken.FromObject(new ModuleConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Reflection;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
@@ -19,6 +20,8 @@ public class Settings
|
|||||||
public Customers customers = new();
|
public Customers customers = new();
|
||||||
public PdfExportSettings pdfExport { get; set; } = new();
|
public PdfExportSettings pdfExport { get; set; } = new();
|
||||||
|
|
||||||
|
public ModuleConfig moduleConfig { get; set; } = new ModuleConfig();
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
_instance = this;
|
_instance = this;
|
||||||
@@ -70,6 +73,29 @@ public class Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ModuleConfig
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Contains enabled modules and whether it's password-protected or not (non-existing-feature but soon)
|
||||||
|
/// </summary>
|
||||||
|
public List<(LCModule, bool)> EnabledModules = new();
|
||||||
|
public ModuleConfig()
|
||||||
|
{
|
||||||
|
EnabledModules = new List<(LCModule,bool)>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum LCModule
|
||||||
|
{
|
||||||
|
Addressmanagement,
|
||||||
|
Pricemanagement,
|
||||||
|
Wiki,
|
||||||
|
Staffmanagement,
|
||||||
|
UnifiedEndpointManagement,
|
||||||
|
Financemanagement
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public class PdfExportSettings
|
public class PdfExportSettings
|
||||||
{
|
{
|
||||||
public double cellPaddingTopMm { get; set; } = 4;
|
public double cellPaddingTopMm { get; set; } = 4;
|
||||||
|
|||||||
+11
-1
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
<PackageReference Include="Markdown.Avalonia" Version="11.0.3" />
|
<PackageReference Include="Markdown.Avalonia" Version="11.0.3" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageReference Include="PdfSharp" Version="6.1.1" />
|
<PackageReference Include="PdfSharp" Version="6.1.1" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.12" />
|
||||||
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.12" />
|
||||||
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -71,4 +74,11 @@
|
|||||||
|
|
||||||
<Folder Include="assets\fonts\" />
|
<Folder Include="assets\fonts\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="PreviewWindow.axaml.cs">
|
||||||
|
<DependentUpon>PreviewWindow.axaml</DependentUpon>
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+34
-7
@@ -6,7 +6,7 @@
|
|||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
MinWidth="1000" MinHeight="600" IsVisible="False"
|
MinWidth="1000" MinHeight="600" IsVisible="False"
|
||||||
x:Class="Logof_Client.MainWindow" WindowState="Maximized" Icon="assets/icon.ico"
|
x:Class="Logof_Client.MainWindow" WindowState="Maximized" Icon="assets/icon.ico"
|
||||||
Title="Logof Client">
|
Title="Logofclient">
|
||||||
<Border>
|
<Border>
|
||||||
<Grid RowDefinitions="30,*">
|
<Grid RowDefinitions="30,*">
|
||||||
<Menu Background="#50888888">
|
<Menu Background="#50888888">
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<TabControl Grid.Row="1">
|
<TabControl Grid.Row="1">
|
||||||
<TabItem>
|
<TabItem IsVisible="False" x:Name="Addressmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="MapPinHouse" Width="32" Height="32" Size="32" />
|
||||||
@@ -79,6 +79,14 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</MenuItem.Header>
|
</MenuItem.Header>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem x:Name="MnIAdSetView" Click="MnIAdSetView_OnClick">
|
||||||
|
<MenuItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Eye" Width="12" Height="12" Size="12" />
|
||||||
|
<Label Content="Anzeigen" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</MenuItem.Header>
|
||||||
|
</MenuItem>
|
||||||
<MenuItem x:Name="MnIAdSetDelete" Click="MnIAdSetDelete_OnClick" IsEnabled="True">
|
<MenuItem x:Name="MnIAdSetDelete" Click="MnIAdSetDelete_OnClick" IsEnabled="True">
|
||||||
<MenuItem.Header>
|
<MenuItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
@@ -288,7 +296,7 @@
|
|||||||
<Label Grid.Column="0" Content="Zellenrand rechts (mm)"></Label>
|
<Label Grid.Column="0" Content="Zellenrand rechts (mm)"></Label>
|
||||||
<NumericUpDown Grid.Column="1" x:Name="NudExpMargCellPaddingRight" Minimum="0" Maximum="20" Value="5"></NumericUpDown>
|
<NumericUpDown Grid.Column="1" x:Name="NudExpMargCellPaddingRight" Minimum="0" Maximum="20" Value="5"></NumericUpDown>
|
||||||
</Grid>
|
</Grid>
|
||||||
<CheckBox Content="Laufzettel erstellen" x:Name="CbExpRnsEnable"></CheckBox>
|
<CheckBox Content="Bundleitzettel erstellen" x:Name="CbExpRnsEnable"></CheckBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
<StackPanel Grid.Column="1" Orientation="Vertical" Spacing="10">
|
||||||
@@ -388,7 +396,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Staffmanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="Users" Width="32" Height="32" Size="32" />
|
||||||
@@ -396,7 +404,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Financemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="BadgeEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -404,7 +412,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="False">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="Pricemanagement">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="ReceiptEuro" Width="32" Height="32" Size="32" />
|
||||||
@@ -412,7 +420,15 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem IsEnabled="True">
|
<TabItem IsEnabled="False" IsVisible="False" x:Name="UnifiedEndpointManagement">
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="MonitorCog" Width="32" Height="32" Size="32" />
|
||||||
|
<Label FontSize="20" Content="UEM" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
</TabItem>
|
||||||
|
<TabItem IsEnabled="True" IsVisible="False" x:Name="Wiki">
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
<LucideIcon Kind="LibraryBig" Width="32" Height="32" Size="32" />
|
||||||
@@ -532,6 +548,17 @@
|
|||||||
<!-- </Grid> -->
|
<!-- </Grid> -->
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem>
|
||||||
|
<TabItem.Header>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Puzzle" Width="16" Height="16" Size="16" />
|
||||||
|
<Label FontSize="16" Content="Module" VerticalContentAlignment="Center" />
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem.Header>
|
||||||
|
<StackPanel Orientation="Vertical" Spacing="10" x:Name="StpSettingsModules">
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
</TabItem>
|
||||||
<TabItem>
|
<TabItem>
|
||||||
<TabItem.Header>
|
<TabItem.Header>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
|
|||||||
@@ -85,8 +85,92 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
Logger.Log($"Error while doing wiki stuff: {ex.Message}", Logger.LogType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
foreach(var module in Enum.GetValues<LCModule>())
|
||||||
|
{
|
||||||
|
CheckBox b = new CheckBox
|
||||||
|
{
|
||||||
|
IsChecked = false
|
||||||
|
};
|
||||||
|
b.Click += (object sender, RoutedEventArgs e) => {
|
||||||
|
RenewModuleSettings(module, b.IsChecked);
|
||||||
|
};
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == module)
|
||||||
|
{
|
||||||
|
b.IsChecked = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label l = new Label()
|
||||||
|
{
|
||||||
|
Content = module.ToString(),
|
||||||
|
};
|
||||||
|
StpSettingsModules.Children.Add(new StackPanel()
|
||||||
|
{
|
||||||
|
Orientation = Avalonia.Layout.Orientation.Horizontal,
|
||||||
|
Children = {b,l}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
Logger.Log($"Enabling module: {conf.Item1}");
|
||||||
|
switch (conf.Item1)
|
||||||
|
{
|
||||||
|
case LCModule.Addressmanagement:
|
||||||
|
Addressmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Pricemanagement:
|
||||||
|
Pricemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Staffmanagement:
|
||||||
|
Staffmanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Financemanagement:
|
||||||
|
Financemanagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.Wiki:
|
||||||
|
Wiki.IsVisible = true;
|
||||||
|
break;
|
||||||
|
case LCModule.UnifiedEndpointManagement:
|
||||||
|
UnifiedEndpointManagement.IsVisible = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logger.Log($"Error while applying module configuration: {ex.Message}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void RenewModuleSettings(LCModule value, bool? enabled = true)
|
||||||
|
{
|
||||||
|
if (enabled == true)
|
||||||
|
{
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.Add((value,false));
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
int index = -1;
|
||||||
|
foreach(var conf in Settings._instance.moduleConfig.EnabledModules)
|
||||||
|
{
|
||||||
|
if(conf.Item1 == value)
|
||||||
|
{
|
||||||
|
index = Settings._instance.moduleConfig.EnabledModules.IndexOf(conf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(index != -1)
|
||||||
|
Settings._instance.moduleConfig.EnabledModules.RemoveAt(index);
|
||||||
|
}
|
||||||
|
Settings.Save();
|
||||||
|
}
|
||||||
private async void StartAddressCheck(int addresSetID)
|
private async void StartAddressCheck(int addresSetID)
|
||||||
{
|
{
|
||||||
var progressWindow = new ProgressWindow();
|
var progressWindow = new ProgressWindow();
|
||||||
@@ -98,6 +182,8 @@ public partial class MainWindow : Window
|
|||||||
progressWindow.Close();
|
progressWindow.Close();
|
||||||
new ResultWindow(result, addresSetID).Show();
|
new ResultWindow(result, addresSetID).Show();
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
|
|
||||||
|
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void StartAddressShortener(KasAddressList set)
|
private async void StartAddressShortener(KasAddressList set)
|
||||||
@@ -110,6 +196,8 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
progressWindow.Close();
|
progressWindow.Close();
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
|
|
||||||
|
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void StartAddressRepairer(KasAddressList set)
|
private async void StartAddressRepairer(KasAddressList set)
|
||||||
@@ -122,6 +210,8 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
progressWindow.Close();
|
progressWindow.Close();
|
||||||
Settings.Save();
|
Settings.Save();
|
||||||
|
|
||||||
|
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -858,6 +948,8 @@ public partial class MainWindow : Window
|
|||||||
|
|
||||||
Logger.Log("PDF seems OK");
|
Logger.Log("PDF seems OK");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RefreshAddressSetListItems((LstCustomers.SelectedItem as Customer).ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -1369,4 +1461,14 @@ public partial class MainWindow : Window
|
|||||||
BtnCombineAddressSetSortUp.IsEnabled = true;
|
BtnCombineAddressSetSortUp.IsEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void MnIAdSetView_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (LstCustomerAdressSets.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
var preview = new PreviewWindow((LstCustomerAdressSets.SelectedItems[0] as KasAddressList).KasPersons);
|
||||||
|
preview.Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,289 @@
|
|||||||
|
<Window xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Icon="assets/icon.ico"
|
||||||
|
xmlns:local="using:Logof_Client" Closing="Window_OnClosing"
|
||||||
|
x:Class="Logof_Client.PreviewWindow"
|
||||||
|
Title="Datensätze bearbeiten" x:DataType="local:PreviewWindow">
|
||||||
|
<Grid ColumnDefinitions="*,400"
|
||||||
|
Margin="10">
|
||||||
|
|
||||||
|
<!-- Adressliste -->
|
||||||
|
<ListBox Grid.Column="0"
|
||||||
|
x:Name="AddressList"
|
||||||
|
ItemsSource="{Binding Addresses}"
|
||||||
|
SelectedItem="{Binding SelectedAddress}"
|
||||||
|
SelectionMode="Single">
|
||||||
|
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<VirtualizingStackPanel />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="70,150,180,250,80,180,150"
|
||||||
|
Height="32">
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="{Binding id}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding vorname}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Text="{Binding name}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="3"
|
||||||
|
Text="{Binding strasse}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="4"
|
||||||
|
Text="{Binding plz}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="5"
|
||||||
|
Text="{Binding ort}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="6"
|
||||||
|
Text="{Binding land}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
|
||||||
|
</ListBox>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Editor -->
|
||||||
|
<ScrollViewer Grid.Column="1"
|
||||||
|
Margin="15,0,0,0">
|
||||||
|
|
||||||
|
<StackPanel Spacing="6">
|
||||||
|
|
||||||
|
<TextBlock Text="Adresse bearbeiten"
|
||||||
|
FontSize="20"
|
||||||
|
FontWeight="Bold"
|
||||||
|
Margin="0,0,0,10"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="120,*"
|
||||||
|
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto" RowSpacing="4">
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="0"
|
||||||
|
Text="ID"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.id}"
|
||||||
|
IsReadOnly="True" IsEnabled="False"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="1"
|
||||||
|
Text="RefSID"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.refsid}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="2"
|
||||||
|
Text="Anrede"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.anrede}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="3"
|
||||||
|
Text="Titel"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.titel}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="4"
|
||||||
|
Text="Vorname"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="4"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.vorname}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="5"
|
||||||
|
Text="Adel"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.adel}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="6"
|
||||||
|
Text="Name"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="6"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="7"
|
||||||
|
Text="Namenszusatz"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="7"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.namezus}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="8"
|
||||||
|
Text="Anredzusatz"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="8"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.anredzus}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="9"
|
||||||
|
Text="Straße"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="9"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.strasse}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="10"
|
||||||
|
Text="Straße 2"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="10"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.strasse2}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="11"
|
||||||
|
Text="PLZ"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="11"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.plz}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="12"
|
||||||
|
Text="Ort"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="12"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.ort}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="13"
|
||||||
|
Text="Land"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="13"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.land}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="14"
|
||||||
|
Text="PPLZ"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="14"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.pplz}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="15"
|
||||||
|
Text="Postfach"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="15"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.postfach}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="16"
|
||||||
|
Text="Name 1"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="16"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name1}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="17"
|
||||||
|
Text="Name 2"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="17"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name2}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="18"
|
||||||
|
Text="Name 3"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="18"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name3}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="19"
|
||||||
|
Text="Name 4"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="19"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name4}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="20"
|
||||||
|
Text="Name 5"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="20"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.name5}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="21"
|
||||||
|
Text="Funktion"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="21"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.funktion}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="22"
|
||||||
|
Text="Funktion 2"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="22"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.funktion2}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="23"
|
||||||
|
Text="Abteilung"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="23"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.abteilung}"/>
|
||||||
|
|
||||||
|
|
||||||
|
<TextBlock Grid.Row="24"
|
||||||
|
Text="Funktion AD"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
<TextBox Grid.Row="24"
|
||||||
|
Grid.Column="1"
|
||||||
|
Text="{Binding SelectedAddress.funktionad}"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</ScrollViewer>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using Avalonia;
|
||||||
|
using Avalonia.Controls;
|
||||||
|
using Avalonia.Interactivity;
|
||||||
|
using Avalonia.Layout;
|
||||||
|
using Avalonia.Media;
|
||||||
|
|
||||||
|
namespace Logof_Client;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
public partial class PreviewWindow : Window, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public ObservableCollection<KasPerson> Addresses { get; }
|
||||||
|
|
||||||
|
private KasPerson? _selectedAddress;
|
||||||
|
|
||||||
|
public KasPerson? SelectedAddress
|
||||||
|
{
|
||||||
|
get => _selectedAddress;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_selectedAddress = value;
|
||||||
|
PropertyChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new PropertyChangedEventArgs(nameof(SelectedAddress)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
public PreviewWindow(IEnumerable<KasPerson> addresses)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Addresses = new ObservableCollection<KasPerson>(addresses);
|
||||||
|
|
||||||
|
DataContext = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_OnClosing(object? sender, WindowClosingEventArgs e)
|
||||||
|
{
|
||||||
|
Settings.Save();
|
||||||
|
Global.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
+61
-2
@@ -3,8 +3,9 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Icon="assets/icon.ico"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" Icon="assets/icon.ico"
|
||||||
|
xmlns:local="using:Logof_Client"
|
||||||
x:Class="Logof_Client.ResultWindow"
|
x:Class="Logof_Client.ResultWindow"
|
||||||
Title="Ergebnis">
|
Title="Ergebnis" x:DataType="local:ResultWindow">
|
||||||
<Grid Grid.ColumnDefinitions="200,*">
|
<Grid Grid.ColumnDefinitions="200,*">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Label Content="Filter" Margin="10,10,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
|
<Label Content="Filter" Margin="10,10,10,0" HorizontalAlignment="Stretch" VerticalAlignment="Top" />
|
||||||
@@ -21,7 +22,65 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Column="1" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||||
<!-- <TextBlock x:Name="TbResults"></TextBlock> -->
|
<!-- <TextBlock x:Name="TbResults"></TextBlock> -->
|
||||||
<ListBox x:Name="LbResults"></ListBox>
|
<!-- <ListBox x:Name="LbResults"></ListBox> -->
|
||||||
|
<!-- <DataGrid ItemsSource="{Binding Results}" IsReadOnly="True" -->
|
||||||
|
<!-- AutoGenerateColumns="False"> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <DataGrid.Columns> -->
|
||||||
|
<!-- <DataGridTextColumn Header="ID" -->
|
||||||
|
<!-- Binding="{Binding PersonId}" /> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <DataGridTextColumn Header="Name" -->
|
||||||
|
<!-- Binding="{Binding Name}" /> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <DataGridTextColumn Header="Errors" -->
|
||||||
|
<!-- Binding="{Binding Errors}" /> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <DataGridTextColumn Header="Warnings" -->
|
||||||
|
<!-- Binding="{Binding Warnings}" /> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- <DataGridTextColumn Header="Refsid" -->
|
||||||
|
<!-- Binding="{Binding Refsid}" /> -->
|
||||||
|
<!-- </DataGrid.Columns> -->
|
||||||
|
<!-- -->
|
||||||
|
<!-- </DataGrid> -->
|
||||||
|
<ListBox ItemsSource="{Binding Results}" SelectionMode="Multiple" x:Name="LbResults" SelectedItems="{Binding SelectedResults}">
|
||||||
|
<ListBox.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<VirtualizingStackPanel />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ListBox.ItemsPanel>
|
||||||
|
|
||||||
|
<ListBox.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Grid Margin="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
<ColumnDefinition Width="2*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
<ColumnDefinition Width="3*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="0"
|
||||||
|
Text="{Binding PersonId}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="1"
|
||||||
|
Text="{Binding Refsid}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="2"
|
||||||
|
Text="{Binding Name}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="3"
|
||||||
|
Text="{Binding Errors}" />
|
||||||
|
|
||||||
|
<TextBlock Grid.Column="4"
|
||||||
|
Text="{Binding Warnings}" />
|
||||||
|
</Grid>
|
||||||
|
</DataTemplate>
|
||||||
|
</ListBox.ItemTemplate>
|
||||||
|
</ListBox>
|
||||||
<!-- <StackPanel x:Name="StkResults" Orientation="Vertical" Margin="10" /> -->
|
<!-- <StackPanel x:Name="StkResults" Orientation="Vertical" Margin="10" /> -->
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
|
|
||||||
|
|||||||
+77
-11
@@ -1,6 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
@@ -8,37 +11,71 @@ using Avalonia.Layout;
|
|||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
|
||||||
namespace Logof_Client;
|
namespace Logof_Client;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
public partial class ResultWindow : Window
|
public partial class ResultWindow : Window, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
|
public event PropertyChangedEventHandler? PropertyChanged;
|
||||||
|
|
||||||
|
private List<ResultItem> _results = new();
|
||||||
|
|
||||||
|
public List<ResultItem> Results
|
||||||
|
{
|
||||||
|
get => _results;
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
_results = value;
|
||||||
|
PropertyChanged?.Invoke(
|
||||||
|
this,
|
||||||
|
new PropertyChangedEventArgs(nameof(Results))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<CheckBox> errortypecheckboxes = new();
|
public List<CheckBox> errortypecheckboxes = new();
|
||||||
public KasAddressList ur_addresses = new("Ergebnis_" + DateTime.Now.ToString("ddMMyy_HHmmss"));
|
public KasAddressList ur_addresses = new("Ergebnis_" + DateTime.Now.ToString("ddMMyy_HHmmss"));
|
||||||
public List<KasPerson> ur_result;
|
public List<KasPerson> ur_result;
|
||||||
public List<CheckBox> warningtypecheckboxes = new();
|
public List<CheckBox> warningtypecheckboxes = new();
|
||||||
|
public List<ResultItem>? SelectedResults { get; set; }
|
||||||
|
|
||||||
public ResultWindow(List<KasPerson> result,
|
public ResultWindow(List<KasPerson> result, int addressSetID)
|
||||||
int addressSetID)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
DataContext = this;
|
||||||
|
|
||||||
ur_result = result;
|
ur_result = result;
|
||||||
|
|
||||||
Load(result);
|
Load(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GenerateView(List<KasPerson> result)
|
//public List<ResultItem> Results { get; private set; } = new();
|
||||||
{
|
private void GenerateView(List<KasPerson> result) {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Filter to only show persons with errors
|
// Filter to only show persons with errors
|
||||||
var result_with_errors = result.Where(p => p.PersonError != null).ToList();
|
var result_with_errors = result.Where(p => p.PersonError != null).ToList();
|
||||||
LblResultCount.Content = $"{result_with_errors.Count}/{ur_result.Count} Ergebnisse";
|
LblResultCount.Content = $"{result_with_errors.Count}/{ur_result.Count} Ergebnisse";
|
||||||
|
//LbResults.Items.Clear();
|
||||||
LbResults.Items.Clear();
|
// foreach (var person in result_with_errors)
|
||||||
foreach (var person in result_with_errors) LbResults.Items.Add(person.PersonError.ToString(person));
|
// LbResults.Items.Add(person.PersonError.ToString(person));
|
||||||
|
Results = result_with_errors
|
||||||
|
.Select(person => new ResultItem
|
||||||
|
{
|
||||||
|
Person = person,
|
||||||
|
PersonId = person.id,
|
||||||
|
Name = $"{person.vorname} {person.name}".Trim(),
|
||||||
|
Errors = string.Join(", ", person.PersonError.errors),
|
||||||
|
Warnings = string.Join(", ", person.PersonError.warnings),
|
||||||
|
Refsid = person.refsid.ToString() ?? ""
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Log("Error while generating result view: " + ex.Message, Logger.LogType.Warning);
|
Logger.Log("Error while generating result view: " + ex.Message, Logger.LogType.Warning);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,8 +216,9 @@ public partial class ResultWindow : Window
|
|||||||
|
|
||||||
LblResultCount.Content = $"{temp_result.Count}/{ur_result.Count} Ergebnisse";
|
LblResultCount.Content = $"{temp_result.Count}/{ur_result.Count} Ergebnisse";
|
||||||
|
|
||||||
LbResults.Items.Clear();
|
//LbResults.Items.Clear();
|
||||||
foreach (var person in temp_result) LbResults.Items.Add(person.PersonError.ToString(person));
|
GenerateView(temp_result);
|
||||||
|
//foreach (var person in temp_result) LbResults.Items.Add(person.PersonError.ToString(person));
|
||||||
|
|
||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -192,7 +230,20 @@ public partial class ResultWindow : Window
|
|||||||
|
|
||||||
private void BtnShowSelected_OnClick(object? sender, RoutedEventArgs e)
|
private void BtnShowSelected_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// once upon a time, there was a feature like this
|
if (LbResults.SelectedItems.Count > 0)
|
||||||
|
{
|
||||||
|
var selectedPersons = LbResults.SelectedItems
|
||||||
|
.Cast<ResultItem>()
|
||||||
|
.Select(x => x.Person)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (selectedPersons.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var preview = new PreviewWindow(selectedPersons);
|
||||||
|
preview.Show();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnExecuteFilter_OnClick(object? sender, RoutedEventArgs e)
|
private void BtnExecuteFilter_OnClick(object? sender, RoutedEventArgs e)
|
||||||
@@ -200,4 +251,19 @@ public partial class ResultWindow : Window
|
|||||||
Console.WriteLine("Updating filter...");
|
Console.WriteLine("Updating filter...");
|
||||||
UpdateFilter();
|
UpdateFilter();
|
||||||
}
|
}
|
||||||
|
//public ObservableCollection<ResultItem> Results { get; } = new();
|
||||||
|
}
|
||||||
|
public class ResultItem
|
||||||
|
{
|
||||||
|
public int PersonId { get; init; }
|
||||||
|
|
||||||
|
public string Name { get; init; } = "";
|
||||||
|
|
||||||
|
public string Errors { get; init; } = "";
|
||||||
|
|
||||||
|
public string Warnings { get; init; } = "";
|
||||||
|
|
||||||
|
public string Refsid { get; init; } = "";
|
||||||
|
|
||||||
|
public KasPerson Person { get; init; } = null!;
|
||||||
}
|
}
|
||||||
+71
-46
@@ -58,6 +58,33 @@ public class AddressCheck
|
|||||||
|
|
||||||
await Task.Run(async () =>
|
await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Refsids, die mehrfach vorkommen
|
||||||
|
var doubledRefsids = adset.KasPersons
|
||||||
|
.Where(p => p.refsid > 0)
|
||||||
|
.GroupBy(p => p.refsid)
|
||||||
|
.Where(g => g.Count() > 1)
|
||||||
|
.ToDictionary(g => g.Key, g => true);
|
||||||
|
|
||||||
|
// Adressen, die mehrfach vorkommen
|
||||||
|
var doubledAddresses = adset.KasPersons
|
||||||
|
.GroupBy(p => (
|
||||||
|
p.name,
|
||||||
|
p.strasse,
|
||||||
|
p.vorname,
|
||||||
|
p.ort,
|
||||||
|
p.funktion,
|
||||||
|
p.funktion2,
|
||||||
|
p.funktionad,
|
||||||
|
p.abteilung,
|
||||||
|
p.name1,
|
||||||
|
p.name2,
|
||||||
|
p.name3,
|
||||||
|
p.name4,
|
||||||
|
p.name5))
|
||||||
|
.Where(g => g.Count() > 1)
|
||||||
|
.ToDictionary(g => g.Key, g => true);
|
||||||
|
|
||||||
foreach (var person in adset.KasPersons)
|
foreach (var person in adset.KasPersons)
|
||||||
{
|
{
|
||||||
var errors = new List<ErrorTypes>();
|
var errors = new List<ErrorTypes>();
|
||||||
@@ -155,46 +182,34 @@ public class AddressCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Address-Component-Count
|
// Address-Component-Count
|
||||||
if (!string.IsNullOrWhiteSpace(person.strasse2)) address_component_count++;
|
// Double-Refsid
|
||||||
if (!string.IsNullOrWhiteSpace(person.land)) address_component_count++;
|
if (person.refsid > 0 &&
|
||||||
if (!string.IsNullOrWhiteSpace(person.name1)) address_component_count++;
|
doubledRefsids.ContainsKey(person.refsid))
|
||||||
if (!string.IsNullOrWhiteSpace(person.name2)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.name3)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.name4)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.name5)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.funktion)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.funktion2)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.funktionad)) address_component_count++;
|
|
||||||
if (!string.IsNullOrWhiteSpace(person.abteilung)) address_component_count++;
|
|
||||||
|
|
||||||
// Double-Refsid or DoubleAddresses
|
|
||||||
foreach (var person2 in adset.KasPersons)
|
|
||||||
{
|
{
|
||||||
if (adset.KasPersons.IndexOf(person) == adset.KasPersons.IndexOf(person2)) continue;
|
hasFaults = true;
|
||||||
|
warnings.Add(WarningTypes.DoubledRefsid);
|
||||||
|
}
|
||||||
|
|
||||||
if (person.refsid == person2.refsid) // trifft auf Patch-Addressen nicht zu
|
// Double-Address
|
||||||
{
|
var addressKey = (
|
||||||
hasFaults = true;
|
person.name,
|
||||||
warnings.Add(WarningTypes.DoubledRefsid);
|
person.strasse,
|
||||||
}
|
person.vorname,
|
||||||
|
person.ort,
|
||||||
|
person.funktion,
|
||||||
|
person.funktion2,
|
||||||
|
person.funktionad,
|
||||||
|
person.abteilung,
|
||||||
|
person.name1,
|
||||||
|
person.name2,
|
||||||
|
person.name3,
|
||||||
|
person.name4,
|
||||||
|
person.name5);
|
||||||
|
|
||||||
if (person.name == person2.name &&
|
if (doubledAddresses.ContainsKey(addressKey))
|
||||||
person.strasse == person2.strasse &&
|
{
|
||||||
person.vorname == person2.vorname &&
|
hasFaults = true;
|
||||||
person.ort == person2.ort &&
|
errors.Add(ErrorTypes.MayBeSameAddress);
|
||||||
person.funktion == person2.funktion &&
|
|
||||||
person.funktion2 == person2.funktion2 &&
|
|
||||||
person.funktionad == person2.funktionad &&
|
|
||||||
person.abteilung == person2.abteilung &&
|
|
||||||
person.name1 == person2.name1 &&
|
|
||||||
person.name2 == person2.name2 &&
|
|
||||||
person.name3 == person2.name3 &&
|
|
||||||
person.name4 == person2.name4 &&
|
|
||||||
person.name5 == person2.name5)
|
|
||||||
{
|
|
||||||
hasFaults = true;
|
|
||||||
errors.Add(ErrorTypes.MayBeSameAddress);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adressen-Länge
|
// Adressen-Länge
|
||||||
@@ -216,16 +231,26 @@ public class AddressCheck
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fortschritt aktualisieren
|
// Fortschritt aktualisieren
|
||||||
Interlocked.Increment(ref current);
|
// Interlocked.Increment(ref current);
|
||||||
var percent = current / (double)total * 100;
|
// var percent = current / (double)total * 100;
|
||||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
// await Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
{
|
// {
|
||||||
if (hasFaults)
|
// if (hasFaults)
|
||||||
_progress.AddToLog($"Person mit id {person.id} ist fehlerhaft",
|
// _progress.AddToLog($"Person mit id {person.id} ist fehlerhaft",
|
||||||
Convert.ToInt32(percent).ToString());
|
// Convert.ToInt32(percent).ToString());
|
||||||
|
//
|
||||||
|
// _progress.ChangePercentage(percent);
|
||||||
|
// });
|
||||||
|
|
||||||
_progress.ChangePercentage(percent);
|
var cd = Interlocked.Increment(ref current);
|
||||||
});
|
|
||||||
|
if (cd % 10 == 0)
|
||||||
|
{
|
||||||
|
var percent = cd / (double)total * 100;
|
||||||
|
|
||||||
|
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||||
|
_progress.ChangePercentage(percent));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -656,13 +656,13 @@ public class PdfBuilder
|
|||||||
{
|
{
|
||||||
path = path.Substring(0, path.Length - 4);
|
path = path.Substring(0, path.Length - 4);
|
||||||
international_path = path;
|
international_path = path;
|
||||||
path = path + "-Laufzettel.pdf";
|
path = path + "-Leitzettel.pdf";
|
||||||
international_path = international_path + "-Laufzettel-International.pdf";
|
international_path = international_path + "-Leitzettel-International.pdf";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = path + "-Laufzettel.pdf";
|
path = path + "-Leitzettel.pdf";
|
||||||
international_path = international_path + "-Laufzettel-International.pdf";
|
international_path = international_path + "-Leitzettel-International.pdf";
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateGermanyRunningSheets(setID, path);
|
CreateGermanyRunningSheets(setID, path);
|
||||||
@@ -674,7 +674,7 @@ public class PdfBuilder
|
|||||||
{
|
{
|
||||||
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
KasAddressList list = Settings._instance.addressSets.GetAddressSetByID(setID);
|
||||||
var document = new PdfDocument();
|
var document = new PdfDocument();
|
||||||
document.Info.Title = $"Laufzettel für {list.Name}";
|
document.Info.Title = $"Leitzettel für {list.Name}";
|
||||||
document.Info.Subject = "powered by logofclient";
|
document.Info.Subject = "powered by logofclient";
|
||||||
document.Info.Author = "logofclient";
|
document.Info.Author = "logofclient";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user