Projekte können erstellt und geladen werden

This commit is contained in:
2023-03-30 20:56:21 +02:00
parent e5214e44c3
commit 70bba66df3
32 changed files with 1050 additions and 93 deletions

1
.gitignore vendored
View File

@@ -3,3 +3,4 @@
*/bin/Debug/* */bin/Debug/*
/SewerStammGen/bin/Release/* /SewerStammGen/bin/Release/*
/Shared/bin/Release/* /Shared/bin/Release/*
*/bin/*

View File

@@ -0,0 +1,220 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using SewerStammGen.EntityFramework;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
[DbContext(typeof(SewerStammGenDbContext))]
[Migration("20230330100444_AddedNullValue")]
partial class AddedNullValue
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Shared.Domain.Auftraggeber", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Ansprechpartner")
.HasColumnType("text");
b.Property<string>("Name")
.HasColumnType("text");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Postleitzahl")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.Property<string>("Telefonnummer")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Auftraggebers");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("DN")
.HasColumnType("integer");
b.Property<int?>("EndSchachtId")
.HasColumnType("integer");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("Haltungslaenge")
.HasColumnType("numeric");
b.Property<string>("Material")
.HasColumnType("text");
b.Property<string>("Objektbezeichnung")
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<int?>("StartSchachtId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("EndSchachtId");
b.HasIndex("ProjektId");
b.HasIndex("StartSchachtId");
b.ToTable("Kanaele");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("AuftraggeberId")
.HasColumnType("integer");
b.Property<string>("Erstelldatum")
.HasColumnType("text");
b.Property<int>("ExportType")
.HasColumnType("integer");
b.Property<int>("Kodierungssystem")
.HasColumnType("integer");
b.Property<string>("Ort")
.HasColumnType("text");
b.Property<string>("Projektname")
.HasColumnType("text");
b.Property<string>("Strasse")
.HasColumnType("text");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
b.ToTable("Projekte");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<decimal>("DeckelHoehe")
.HasColumnType("decimal(18,4)");
b.Property<int>("Entwaesserung")
.HasColumnType("integer");
b.Property<decimal>("HochWert")
.HasColumnType("decimal(18,4)");
b.Property<string>("Objektbezeichnung")
.HasColumnType("text");
b.Property<int?>("ProjektId")
.HasColumnType("integer");
b.Property<decimal>("RechtsWert")
.HasColumnType("decimal(18,4)");
b.Property<decimal>("SohlHoehe")
.HasColumnType("decimal(18,4)");
b.HasKey("Id");
b.HasIndex("ProjektId");
b.ToTable("Schaechte");
});
modelBuilder.Entity("Shared.Domain.Kanal", b =>
{
b.HasOne("Shared.Domain.Schacht", "EndSchacht")
.WithMany()
.HasForeignKey("EndSchachtId");
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Kanaele")
.HasForeignKey("ProjektId");
b.HasOne("Shared.Domain.Schacht", "StartSchacht")
.WithMany()
.HasForeignKey("StartSchachtId");
b.Navigation("EndSchacht");
b.Navigation("StartSchacht");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.HasOne("Shared.Domain.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Auftraggeber");
});
modelBuilder.Entity("Shared.Domain.Schacht", b =>
{
b.HasOne("Shared.Domain.Projekt", null)
.WithMany("Schaechte")
.HasForeignKey("ProjektId");
});
modelBuilder.Entity("Shared.Domain.Projekt", b =>
{
b.Navigation("Kanaele");
b.Navigation("Schaechte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,252 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SewerStammGen.EntityFramework.Migrations
{
/// <inheritdoc />
public partial class AddedNullValue : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Schaechte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Projektname",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Erstelldatum",
table: "Projekte",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Kanaele",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Material",
table: "Kanaele",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Telefonnummer",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Postleitzahl",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AlterColumn<string>(
name: "Ansprechpartner",
table: "Auftraggebers",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Schaechte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Projektname",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Erstelldatum",
table: "Projekte",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Objektbezeichnung",
table: "Kanaele",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Material",
table: "Kanaele",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Telefonnummer",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Strasse",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Postleitzahl",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ort",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Ansprechpartner",
table: "Auftraggebers",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
}
}
}

View File

@@ -31,27 +31,21 @@ namespace SewerStammGen.EntityFramework.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Ansprechpartner") b.Property<string>("Ansprechpartner")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Name") b.Property<string>("Name")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Ort") b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Postleitzahl") b.Property<string>("Postleitzahl")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Strasse") b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Telefonnummer") b.Property<string>("Telefonnummer")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -80,11 +74,9 @@ namespace SewerStammGen.EntityFramework.Migrations
.HasColumnType("numeric"); .HasColumnType("numeric");
b.Property<string>("Material") b.Property<string>("Material")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Objektbezeichnung") b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("ProjektId") b.Property<int?>("ProjektId")
@@ -116,7 +108,6 @@ namespace SewerStammGen.EntityFramework.Migrations
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("Erstelldatum") b.Property<string>("Erstelldatum")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ExportType") b.Property<int>("ExportType")
@@ -126,15 +117,12 @@ namespace SewerStammGen.EntityFramework.Migrations
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("Ort") b.Property<string>("Ort")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Projektname") b.Property<string>("Projektname")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Strasse") b.Property<string>("Strasse")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.HasKey("Id"); b.HasKey("Id");
@@ -162,7 +150,6 @@ namespace SewerStammGen.EntityFramework.Migrations
.HasColumnType("decimal(18,4)"); .HasColumnType("decimal(18,4)");
b.Property<string>("Objektbezeichnung") b.Property<string>("Objektbezeichnung")
.IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int?>("ProjektId") b.Property<int?>("ProjektId")

View File

@@ -36,7 +36,8 @@ namespace SewerStammGen.EntityFramework.Services.Common
public async Task<bool> Delete(int id) public async Task<bool> Delete(int id)
{ {
using SewerStammGenDbContext context = _contextFactory.CreateDbContext(); using SewerStammGenDbContext context = _contextFactory.CreateDbContext();
T entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id); T? entity = await context.Set<T>().FirstOrDefaultAsync((e) => e.Id == id);
if (entity == null) return false;
context.Set<T>().Remove(entity); context.Set<T>().Remove(entity);
await context.SaveChangesAsync(); await context.SaveChangesAsync();
return true; return true;

View File

@@ -1,5 +1,7 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using SewerStammGen.EntityFramework;
using SewerStammGen.HostBuilders; using SewerStammGen.HostBuilders;
using SewerStammGen.WPF.ViewModel; using SewerStammGen.WPF.ViewModel;
using System; using System;
@@ -40,6 +42,12 @@ namespace SewerStammGen.WPF
_host.Start(); _host.Start();
SewerStammGenDbContextFactory contextFactory = _host.Services.GetRequiredService<SewerStammGenDbContextFactory>();
using(SewerStammGenDbContext context = contextFactory.CreateDbContext())
{
context.Database.Migrate();
}
MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() }; MainWindow? window = new MainWindow() { DataContext = _host.Services.GetRequiredService<MainWindowViewModel>() };
window.Show(); window.Show();

View File

@@ -0,0 +1,44 @@
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.Commands
{
internal class ProjektAddCommand : AsyncCommandBase
{
private readonly IActualState _actualState;
private readonly IDataService<Projekt> _generic;
private readonly IRenavigator _renavigator;
public ProjektAddCommand(IDataService<Projekt> generic, IActualState actualState, IRenavigator renavigator)
{
_renavigator = renavigator;
_generic = generic;
_actualState = actualState;
}
public override async Task ExecuteAsync(object? parameter)
{
Projekt newProjekt = new Projekt()
{
Erstelldatum = "",
Strasse = "",
Ort = "",
Projektname = "",
Auftraggeber = new Auftraggeber(),
Schaechte = new List<Schacht>(),
Kanaele = new List<Kanal>()
};
//newProjekt = await _generic.Create(newProjekt);
_actualState.SetProjekt(newProjekt);
_renavigator.Renavigate();
}
}
}

View File

@@ -0,0 +1,35 @@
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using Shared.Domain;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.Commands
{
internal class ProjektEditCommand : AsyncCommandBase
{
private IDataService<Projekt> _dataService;
private IActualState _actualState;
private IRenavigator _renavigator;
private ProjektListViewModel _projektListViewModel;
public ProjektEditCommand(IDataService<Projekt> dataService, IActualState actualState, IRenavigator renavigator, ProjektListViewModel projektListViewModel)
{
_dataService = dataService;
_actualState = actualState;
_renavigator = renavigator;
_projektListViewModel = projektListViewModel;
}
public override async Task ExecuteAsync(object? parameter)
{
_actualState.SetProjekt(_projektListViewModel.SelectedProjekt);
_renavigator.Renavigate();
}
}
}

View File

@@ -0,0 +1,26 @@
using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Domain;
using System;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.Commands
{
internal class ProjektSelectCommand : AsyncCommandBase
{
private readonly IActualState _actualState;
private readonly ProjektListViewModel _projektListViewModel;
public ProjektSelectCommand(IActualState actualState, ProjektListViewModel projektListViewModel)
{
_actualState = actualState;
_projektListViewModel = projektListViewModel;
}
public override async Task ExecuteAsync(object? parameter)
{
if (_projektListViewModel.SelectedProjekt == null) return;
_actualState.SetProjekt(_projektListViewModel.SelectedProjekt);
}
}
}

View File

@@ -18,10 +18,12 @@ namespace SewerStammGen.HostBuilders
{ {
hostBuilder.ConfigureServices((context, services) => hostBuilder.ConfigureServices((context, services) =>
{ {
string connectionString = ""; string? connectionString = "";
Action<DbContextOptionsBuilder> configureDbContext = null; Action<DbContextOptionsBuilder>? configureDbContext = null;
string databaseToUse = context.Configuration.GetConnectionString("databaseToUse"); string? databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
Trace.WriteLine(databaseToUse); if (databaseToUse != null)
{
if (databaseToUse.Equals("default")) if (databaseToUse.Equals("default"))
{ {
connectionString = context.Configuration.GetConnectionString("default"); connectionString = context.Configuration.GetConnectionString("default");
@@ -32,10 +34,12 @@ namespace SewerStammGen.HostBuilders
connectionString = context.Configuration.GetConnectionString("sqlite"); connectionString = context.Configuration.GetConnectionString("sqlite");
configureDbContext = o => o.UseSqlite(connectionString); configureDbContext = o => o.UseSqlite(connectionString);
} }
services.AddDbContext<SewerStammGenDbContext>(configureDbContext); services.AddDbContext<SewerStammGenDbContext>(configureDbContext);
services.AddSingleton<SewerStammGenDbContextFactory>(new SewerStammGenDbContextFactory(configureDbContext)); services.AddSingleton<SewerStammGenDbContextFactory>(new SewerStammGenDbContextFactory(configureDbContext));
}
}); });
return hostBuilder; return hostBuilder;
} }

View File

@@ -2,6 +2,7 @@
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using SewerStammGen.EntityFramework.Services; using SewerStammGen.EntityFramework.Services;
using SewerStammGen.WPF.Interface.Navigator; using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State.Navigation; using SewerStammGen.WPF.ViewModel.State.Navigation;
using Shared.Contracts; using Shared.Contracts;
using Shared.Domain; using Shared.Domain;
@@ -21,7 +22,7 @@ namespace SewerStammGen.HostBuilders
host.ConfigureServices(services => host.ConfigureServices(services =>
{ {
services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>(); services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>();
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
services.AddSingleton<IDataService<Projekt>, GenericDataService<Projekt>>(); services.AddSingleton<IDataService<Projekt>, GenericDataService<Projekt>>();
}); });
return host; return host;

View File

@@ -1,4 +1,6 @@
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using SewerStammGen.WPF.ViewModel.State;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -13,7 +15,7 @@ namespace SewerStammGen.HostBuilders
{ {
hostBuilder.ConfigureServices(services => hostBuilder.ConfigureServices(services =>
{ {
services.AddSingleton<IActualState, ActualState>();
}); });
return hostBuilder; return hostBuilder;
} }

View File

@@ -1,7 +1,9 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using SewerStammGen.WPF.Commands;
using SewerStammGen.WPF.Interface; using SewerStammGen.WPF.Interface;
using SewerStammGen.WPF.ViewModel; using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State.Navigation;
using SewerStammGen.WPF.ViewModel.Factories; using SewerStammGen.WPF.ViewModel.Factories;
using Shared.Contracts; using Shared.Contracts;
using Shared.Domain; using Shared.Domain;
@@ -11,6 +13,7 @@ using System.Linq;
using System.Net.Security; using System.Net.Security;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SewerStammGen.WPF.ViewModel.State;
namespace SewerStammGen.HostBuilders namespace SewerStammGen.HostBuilders
{ {
@@ -20,7 +23,12 @@ namespace SewerStammGen.HostBuilders
{ {
hostBuilder.ConfigureServices(services => hostBuilder.ConfigureServices(services =>
{ {
services.AddTransient<MainWindowViewModel>(); services.AddTransient<MainWindowViewModel>();
services.AddSingleton<ViewModelDelegateRenavigator<ProjektListViewModel>>();
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
services.AddSingleton<CreateViewModel<HomeViewModel>>(services => services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
{ {
return () => new HomeViewModel(); return () => new HomeViewModel();
@@ -36,10 +44,21 @@ namespace SewerStammGen.HostBuilders
return () => new SewerConnectorViewModel(); return () => new SewerConnectorViewModel();
}); });
services.AddSingleton<CreateViewModel<ProjektEditViewModel>>(services =>
{
return () => new ProjektEditViewModel(
services.GetRequiredService<IDataService<Projekt>>(),
services.GetRequiredService<ViewModelDelegateRenavigator<ProjektListViewModel>>(),
services.GetRequiredService<IActualState>()
);
});
services.AddSingleton<CreateViewModel<ProjektListViewModel>>(services => services.AddSingleton<CreateViewModel<ProjektListViewModel>>(services =>
{ {
return () => new ProjektListViewModel( return () => new ProjektListViewModel(
services.GetRequiredService<IDataService<Projekt>>() services.GetRequiredService<IDataService<Projekt>>(),
services.GetRequiredService<ViewModelDelegateRenavigator<ProjektEditViewModel>>(),
services.GetRequiredService<IActualState>()
); );
}); });

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.Interface.Navigator
{
public interface IRenavigator
{
void Renavigate();
}
}

View File

@@ -9,7 +9,9 @@
xmlns:viewmodel="clr-namespace:SewerStammGen.WPF.ViewModel" xmlns:viewmodel="clr-namespace:SewerStammGen.WPF.ViewModel"
xmlns:controls="clr-namespace:SewerStammGen.WPF.Views.Controls" xmlns:controls="clr-namespace:SewerStammGen.WPF.Views.Controls"
mc:Ignorable="d" mc:Ignorable="d"
Title="{Binding ApplicationTitle}" Height="450" Width="800"> Title="{Binding ApplicationTitle}" Height="450" Width="800" FontSize="20"
WindowState="Maximized"
>
<Window.Resources> <Window.Resources>
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}"> <DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
<view:HomeView /> <view:HomeView />
@@ -23,15 +25,23 @@
<DataTemplate DataType="{x:Type viewmodel:ProjektListViewModel}"> <DataTemplate DataType="{x:Type viewmodel:ProjektListViewModel}">
<view:ProjektListView /> <view:ProjektListView />
</DataTemplate> </DataTemplate>
<DataTemplate DataType="{x:Type viewmodel:ProjektEditViewModel}">
<view:ProjektEditView />
</DataTemplate>
</Window.Resources> </Window.Resources>
<Grid> <Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="200" /> <ColumnDefinition Width="200" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<controls:UCMainWindowNavigationBar Grid.Column="0" /> <controls:UCMainWindowNavigationBar Grid.Column="0" />
<ContentControl Grid.Column="1" Content="{Binding CurrentViewModel}" /> <ContentControl Grid.Column="1" Content="{Binding CurrentViewModel}" />
<StatusBar Grid.Row="1" Grid.ColumnSpan="2">
<StatusBarItem Content="{Binding Projektnummer}" />
</StatusBar>
</Grid> </Grid>
</Window> </Window>

View File

@@ -13,6 +13,9 @@
<Compile Update="Views\HomeView.xaml.cs"> <Compile Update="Views\HomeView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="Views\Projekte\ProjektEditView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="Views\Projekte\ProjektListView.xaml.cs"> <Compile Update="Views\Projekte\ProjektListView.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
@@ -36,6 +39,9 @@
<Page Update="Views\HomeView.xaml"> <Page Update="Views\HomeView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>
<Page Update="Views\Projekte\ProjektEditView.xaml">
<SubType>Designer</SubType>
</Page>
<Page Update="Views\Projekte\ProjektListView.xaml"> <Page Update="Views\Projekte\ProjektListView.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</Page> </Page>

View File

@@ -9,12 +9,15 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using SewerStammGen.WPF.ViewModel.State;
namespace SewerStammGen.WPF.ViewModel namespace SewerStammGen.WPF.ViewModel
{ {
public class MainWindowViewModel : BaseViewModel public class MainWindowViewModel : BaseViewModel
{ {
public IMainWindowNavigator Navigator { get; set; } public IMainWindowNavigator Navigator { get; set; }
public string? Projektnummer { get; set; }
private readonly IActualState _actualState;
public BaseViewModel CurrentViewModel => Navigator.CurrentViewModel; public BaseViewModel CurrentViewModel => Navigator.CurrentViewModel;
public ICommand UpdateCurrentViewModelCommand { get; } public ICommand UpdateCurrentViewModelCommand { get; }
@@ -26,7 +29,8 @@ namespace SewerStammGen.WPF.ViewModel
public MainWindowViewModel( public MainWindowViewModel(
IMainWindowNavigator navigator, IMainWindowNavigator navigator,
IViewModelAbstractFactory viewModelFactory IViewModelAbstractFactory viewModelFactory,
IActualState actualState
) )
{ {
@@ -35,11 +39,20 @@ namespace SewerStammGen.WPF.ViewModel
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory); UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home); UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
_actualState = actualState;
_actualState.ProjektChanged += ActualState_ProjektChanged;
Navigator.StateChanged += Navigator_StateChanged; Navigator.StateChanged += Navigator_StateChanged;
} }
private void ActualState_ProjektChanged(object? sender, EventArgs e)
{
Projektnummer = _actualState.ProjektID.ToString();
OnPropertyChanged(nameof(Projektnummer));
}
private void Navigator_StateChanged() private void Navigator_StateChanged()
{ {
OnPropertyChanged(nameof(CurrentViewModel)); OnPropertyChanged(nameof(CurrentViewModel));

View File

@@ -0,0 +1,117 @@
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Security.RightsManagement;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace SewerStammGen.WPF.ViewModel
{
internal class ProjektEditViewModel : BaseViewModel
{
private Projekt _model;
private int ProjektID;
private readonly IDataService<Projekt> _dataService;
private readonly IRenavigator _renavigator;
public ICommand Speichern { get; set; }
public string ProjektName
{
get => _model.Projektname;
set
{
if(_model.Projektname != value)
{
_model.Projektname = value;
OnPropertyChanged();
}
}
}
public string Erstelldatum
{
get => _model.Erstelldatum;
set
{
if (_model.Erstelldatum != value)
{
_model.Erstelldatum = value;
OnPropertyChanged();
}
}
}
public string Strasse
{
get => _model.Strasse;
set
{
if (_model.Strasse != value)
{
_model.Strasse = value;
OnPropertyChanged();
}
}
}
public string Ort
{
get => _model.Ort;
set
{
if (_model.Ort != value)
{
_model.Ort = value;
OnPropertyChanged();
}
}
}
public ProjektEditViewModel(IDataService<Projekt> dataService, IRenavigator renavigator, IActualState actualState)
{
_dataService = dataService;
_renavigator = renavigator;
ProjektID = actualState.ProjektID;
_model = new Projekt();
Speichern = new RelayCommand((x) => this.SaveProject());
LoadProjekt();
}
private async void LoadProjekt()
{
_model = await _dataService.Get(ProjektID);
if(_model == null)
{
_model = new Projekt()
{
Auftraggeber = new Auftraggeber(),
};
}
OnPropertyChanged(nameof(ProjektName));
OnPropertyChanged(nameof(Erstelldatum));
OnPropertyChanged(nameof(Strasse));
OnPropertyChanged(nameof(Ort));
}
private void SaveProject()
{
if (_model.Id == 0) // Handelt sich um ein neuen Eintrag
{
_dataService.Create(_model);
}
else
{
_dataService.Update(_model.Id, _model);
}
_renavigator.Renavigate();
}
}
}

View File

@@ -1,5 +1,8 @@
using SewerStammGen.EntityFramework.Services; using SewerStammGen.EntityFramework.Services;
using SewerStammGen.WPF.Commands;
using SewerStammGen.WPF.Interface.Navigator;
using SewerStammGen.WPF.ViewModel; using SewerStammGen.WPF.ViewModel;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts; using Shared.Contracts;
using Shared.Domain; using Shared.Domain;
using System; using System;
@@ -8,19 +11,49 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input;
namespace SewerStammGen.WPF.ViewModel namespace SewerStammGen.WPF.ViewModel
{ {
public class ProjektListViewModel : BaseViewModel public class ProjektListViewModel : BaseViewModel
{ {
private IDataService<Projekt> genericDataService; private IDataService<Projekt> genericDataService;
private readonly ObservableCollection<Projekt> Projekte; private readonly ObservableCollection<Projekt> _projekte;
private readonly IActualState _actualState;
public ObservableCollection<Projekt> Projekte { get => _projekte; }
public bool CanSelectProjekt => _selectedProjekt != null;
public ProjektListViewModel(IDataService<Projekt> generic) public ICommand SelectCommand { get; set; }
public ICommand AddCommand { get; set; }
public ICommand EditCommand { get; set; }
private Projekt? _selectedProjekt;
public Projekt? SelectedProjekt
{ {
Projekte = new ObservableCollection<Projekt>(); get => _selectedProjekt;
set
{
if(_selectedProjekt != value)
{
_selectedProjekt = value;
OnPropertyChanged();
OnPropertyChanged(nameof(CanSelectProjekt));
}
}
}
public ProjektListViewModel(IDataService<Projekt> generic, IRenavigator renavigator,IActualState actualState)
{
_projekte = new ObservableCollection<Projekt>();
if (generic == null) throw new ArgumentNullException(nameof(generic)); if (generic == null) throw new ArgumentNullException(nameof(generic));
this.genericDataService = generic; this.genericDataService = generic;
_actualState = actualState;
AddCommand = new ProjektAddCommand(generic,actualState, renavigator);
SelectCommand = new ProjektSelectCommand(actualState,this);
EditCommand = new ProjektEditCommand(generic, actualState, renavigator, this);
LoadProjekte(); LoadProjekte();
} }
@@ -28,7 +61,7 @@ namespace SewerStammGen.WPF.ViewModel
private async void LoadProjekte() private async void LoadProjekte()
{ {
var projects = await genericDataService.GetAll(); var projects = await genericDataService.GetAll();
InitCollection(Projekte, projects); InitCollection(_projekte, projects);
} }
private void InitCollection(ObservableCollection<Projekt> projekte, IEnumerable<Projekt> projects) private void InitCollection(ObservableCollection<Projekt> projekte, IEnumerable<Projekt> projects)

View File

@@ -0,0 +1,30 @@
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.ViewModel.State
{
internal class ActualState : IActualState
{
public int ProjektID { get; private set; }
public void SetProjekt(Projekt projekt, bool notification = true)
{
ProjektID = projekt.Id;
if(notification)
{
OnProjektChanged();
}
}
public event EventHandler? ProjektChanged;
private void OnProjektChanged()
{
ProjektChanged?.Invoke(this, new EventArgs());
}
}
}

View File

@@ -0,0 +1,18 @@
using Shared.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.ViewModel.State
{
public interface IActualState
{
event EventHandler? ProjektChanged;
int ProjektID { get; }
void SetProjekt(Projekt projekt, bool notification = true);
}
}

View File

@@ -0,0 +1,25 @@
using SewerStammGen.WPF.Interface.Navigator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.ViewModel.State.Navigation
{
internal class ViewModelDelegateRenavigator<TViewModel> : IRenavigator where TViewModel : BaseViewModel
{
private readonly IMainWindowNavigator _navigator;
private readonly CreateViewModel<TViewModel> _createViewModel;
public ViewModelDelegateRenavigator(IMainWindowNavigator navigator, CreateViewModel<TViewModel> createViewModel)
{
_navigator = navigator;
_createViewModel = createViewModel;
}
public void Renavigate()
{
_navigator.CurrentViewModel = _createViewModel();
}
}
}

View File

@@ -18,7 +18,7 @@
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:HomeViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Home}" Style="{StaticResource ToggleButtonList}" Content="Home" /> <RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:HomeViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Home}" Style="{StaticResource ToggleButtonList}" Content="Home" />
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjektListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.ProjectsList}" Style="{StaticResource ToggleButtonList}" Content="Projekte" /> <RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjektListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.ProjectsList}" Style="{StaticResource ToggleButtonList}" Content="Projekte" />
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:EditManHoleViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.EditSchacht}" Style="{StaticResource ToggleButtonList}" Content="Schächte" /> <RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:EditManHoleViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.EditSchacht}" Style="{StaticResource ToggleButtonList}" Content="Schächte" />
<RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:SewerConnectorViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.SewerConnectionEdit}" Style="{StaticResource ToggleButtonList}" Content="Kanäle" /> <RadioButton IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:SewerConnectorViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.SewerConnectionEdit}" Style="{StaticResource ToggleButtonList}" Content="Haltungen" />
</StackPanel> </StackPanel>
</Grid> </Grid>

View File

@@ -0,0 +1,35 @@
<UserControl x:Class="SewerStammGen.WPF.Views.ProjektEditView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0" Content="Projektname" />
<Label Grid.Column="0" Grid.Row="1" Content="Erstelldatum" />
<Label Grid.Column="0" Grid.Row="2" Content="Strasse" />
<Label Grid.Column="0" Grid.Row="3" Content="Ort" />
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding ProjektName}" />
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Erstelldatum}" />
<TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Strasse}" />
<TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Ort}" />
<Button Grid.ColumnSpan="2" Grid.Row="4" Content="Speichern" Command="{Binding Speichern}" />
</Grid>
</UserControl>

View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace SewerStammGen.WPF.Views
{
/// <summary>
/// Interaktionslogik für ProjektEditView.xaml
/// </summary>
public partial class ProjektEditView : UserControl
{
public ProjektEditView()
{
InitializeComponent();
}
}
}

View File

@@ -7,9 +7,19 @@
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" d:DesignWidth="800">
<Grid> <Grid>
<DataGrid ItemsSource="{Binding Projekte}"> <StackPanel>
<DataGrid FontSize="20" Margin="10" SelectedItem="{Binding SelectedProjekt}" ItemsSource="{Binding Projekte}" IsReadOnly="True" SelectionMode="Single" AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Projektname" Binding="{Binding Projektname}" />
<DataGridTextColumn Header="Erstelldatum" Binding="{Binding Erstelldatum}" />
<DataGridTextColumn Header="Strasse" Binding="{Binding Strasse}" />
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
</DataGrid.Columns>
</DataGrid> </DataGrid>
<Button Margin="2" FontSize="20" Content="Projekt Auswählen" IsEnabled="{Binding CanSelectProjekt}" Command="{Binding SelectCommand}" />
<Button Margin="2" FontSize="20" Content="Projekt Editieren" IsEnabled="{Binding CanSelectProjekt}" Command="{Binding EditCommand}" />
<Button Margin="2" FontSize="20" Content="Projekt Anlegen" Command="{Binding AddCommand}" />
</StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -9,7 +9,7 @@
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" /> <ColumnDefinition Width="auto" />
<ColumnDefinition Width="400" /> <ColumnDefinition Width="520" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
@@ -17,22 +17,30 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label FontSize="20" Grid.Column="0" Grid.Row="0" Content="Bezeichnung" /> <Label Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
<Label FontSize="20" Grid.Column="0" Grid.Row="1" Content="Rechtswert" /> <Label Grid.Column="0" Grid.Row="1" Content="Rechtswert" />
<Label FontSize="20" Grid.Column="0" Grid.Row="2" Content="Hochwert" /> <Label Grid.Column="0" Grid.Row="2" Content="Hochwert" />
<Label FontSize="20" Grid.Column="0" Grid.Row="3" Content="Sohlhöhe" /> <Label Grid.Column="0" Grid.Row="3" Content="Sohlhöhe" />
<Label FontSize="20" Grid.Column="0" Grid.Row="4" Content="Deckelhöhe" /> <Label Grid.Column="0" Grid.Row="4" Content="Deckelhöhe" />
<Label Grid.Column="0" Grid.Row="5" Content="Entwässerungsart" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="0" Text="{Binding X}" /> <TextBox Margin="2" Grid.Column="1" Grid.Row="0" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="1" Text="{Binding X}" /> <TextBox Margin="2" Grid.Column="1" Grid.Row="1" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="2" Text="{Binding X}" /> <TextBox Margin="2" Grid.Column="1" Grid.Row="2" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="3" Text="{Binding X}" /> <TextBox Margin="2" Grid.Column="1" Grid.Row="3" Text="{Binding X}" />
<TextBox Margin="2" FontSize="20" Grid.Column="1" Grid.Row="4" Text="{Binding X}" /> <TextBox Margin="2" Grid.Column="1" Grid.Row="4" Text="{Binding X}" />
<DockPanel Grid.Column="1" Grid.Row="5">
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" />
</DockPanel>
<StackPanel Grid.ColumnSpan="2" Grid.Row="5">
<StackPanel Grid.ColumnSpan="2" Grid.Row="6">
<Button FontSize="20" Content="Speichern" /> <Button FontSize="20" Content="Speichern" />
</StackPanel> </StackPanel>

View File

@@ -6,7 +6,7 @@
xmlns:syncfusion="http://schemas.syncfusion.com/wpf" xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
xmlns:local="clr-namespace:SewerStammGen.WPF.Views" xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450" Width="1028">
<UserControl.Resources> <UserControl.Resources>
<DataTemplate x:Key="headerTemplate"> <DataTemplate x:Key="headerTemplate">
<TextBox></TextBox> <TextBox></TextBox>
@@ -14,30 +14,30 @@
</UserControl.Resources> </UserControl.Resources>
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition Width="200" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Grid.Row="0" Grid.Column="0" FontSize="20" Content="Obere Schacht" /> <Label Grid.Row="0" Grid.Column="0" Content="Obere Schacht" />
<Label Grid.Row="1" Grid.Column="0" FontSize="20" Content="Untere Schacht" /> <Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" />
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Haltungsbezeichnung" /> <Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" />
<syncfusion:SfMultiColumnDropDownControl Grid.Column="1" Grid.Row="0" <syncfusion:SfMultiColumnDropDownControl Grid.Column="1" Grid.Row="0"
Width="250" Width="250"
Margin="10,0" Margin="10,0"
FontSize="20"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top" VerticalAlignment="Top"
AllowAutoComplete="True" AllowAutoComplete="True"
@@ -55,7 +55,7 @@
Width="250" Width="250"
Margin="10,0" Margin="10,0"
FontSize="20"
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Top" VerticalAlignment="Top"
AllowAutoComplete="True" AllowAutoComplete="True"
@@ -67,25 +67,36 @@
PopupWidth="400" PopupWidth="400"
ValueMember="Cast" ValueMember="Cast"
></syncfusion:SfMultiColumnDropDownControl> ></syncfusion:SfMultiColumnDropDownControl>
<TextBox Grid.Row="2" Grid.Column="1" FontSize="20" Margin="5" /> <TextBox Grid.Row="2" Grid.Column="1" Margin="5" />
</Grid> </Grid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition /> <ColumnDefinition Width="200" />
<ColumnDefinition /> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" FontSize="20" Content="Material" /> <Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Content="Material" />
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" FontSize="20" Content="Durchmesser" /> <Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Content="Durchmesser" />
<TextBox Grid.Row="0" Grid.Column="1" Margin="5" FontSize="20" Text="{Binding X}" /> <Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Content="Haltungslänge" />
<TextBox Grid.Row="1" Grid.Column="1" Margin="5" FontSize="20" Text="{Binding X}" /> <Label VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Content="Entwässerungsart" />
<TextBox Grid.Row="0" Grid.Column="1" Margin="5" Text="{Binding X}" />
<TextBox Grid.Row="1" Grid.Column="1" Margin="5" Text="{Binding X}" />
<TextBox Grid.Row="2" Grid.Column="1" Margin="5" Text="{Binding X}" />
<DockPanel Grid.Row="3" Grid.Column="1">
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" />
</DockPanel>
</Grid> </Grid>
<StackPanel Grid.Row="3"> <StackPanel Grid.Row="4">
<Button FontSize="20" Content="Speichern" /> <Button Content="Speichern" />
</StackPanel> </StackPanel>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -8,11 +8,11 @@ namespace Shared.Domain
{ {
public class Auftraggeber : DBObject public class Auftraggeber : DBObject
{ {
public string Name { get; set; } public string? Name { get; set; }
public string Strasse { get; set; } public string? Strasse { get; set; }
public string Ort { get; set; } public string? Ort { get; set; }
public string Postleitzahl { get; set; } public string? Postleitzahl { get; set; }
public string Ansprechpartner { get; set; } public string? Ansprechpartner { get; set; }
public string Telefonnummer { get; set; } public string? Telefonnummer { get; set; }
} }
} }

View File

@@ -8,11 +8,11 @@ namespace Shared.Domain
{ {
public class Kanal : DBObject public class Kanal : DBObject
{ {
public string Objektbezeichnung { get; set; } public string? Objektbezeichnung { get; set; }
public Schacht? StartSchacht { get; set; } public Schacht? StartSchacht { get; set; }
public Schacht? EndSchacht { get; set; } public Schacht? EndSchacht { get; set; }
public int DN { get; set; } public int DN { get; set; }
public string Material { get; set; } public string? Material { get; set; }
public decimal Haltungslaenge { get; set; } public decimal Haltungslaenge { get; set; }
public EEntwaeserung Entwaesserung { get; set; } public EEntwaeserung Entwaesserung { get; set; }

View File

@@ -9,10 +9,10 @@ namespace Shared.Domain
{ {
public class Projekt : DBObject public class Projekt : DBObject
{ {
public string Projektname { get; set; } public string? Projektname { get; set; }
public string Erstelldatum { get; set; } public string? Erstelldatum { get; set; }
public string Strasse { get;set; } public string? Strasse { get;set; }
public string Ort { get; set; } public string? Ort { get; set; }
public Auftraggeber Auftraggeber { get; set; } public Auftraggeber Auftraggeber { get; set; }
public EExportType ExportType { get; set; } public EExportType ExportType { get; set; }
public EKodierungssystem Kodierungssystem { get; set; } public EKodierungssystem Kodierungssystem { get; set; }

View File

@@ -9,7 +9,7 @@ namespace Shared.Domain
{ {
public class Schacht : DBObject public class Schacht : DBObject
{ {
public string Objektbezeichnung { get; set; } public string? Objektbezeichnung { get; set; }
[Column(TypeName = "decimal(18,4)")] [Column(TypeName = "decimal(18,4)")]
public decimal RechtsWert { get; set; } public decimal RechtsWert { get; set; }