Projekte können erstellt und geladen werden
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@
|
||||
*/bin/Debug/*
|
||||
/SewerStammGen/bin/Release/*
|
||||
/Shared/bin/Release/*
|
||||
*/bin/*
|
||||
|
||||
220
SewerStammGen.EntityFramework/Migrations/20230330100444_AddedNullValue.Designer.cs
generated
Normal file
220
SewerStammGen.EntityFramework/Migrations/20230330100444_AddedNullValue.Designer.cs
generated
Normal 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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,27 +31,21 @@ namespace SewerStammGen.EntityFramework.Migrations
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("Ansprechpartner")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Ort")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Postleitzahl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Strasse")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Telefonnummer")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -80,11 +74,9 @@ namespace SewerStammGen.EntityFramework.Migrations
|
||||
.HasColumnType("numeric");
|
||||
|
||||
b.Property<string>("Material")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Objektbezeichnung")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ProjektId")
|
||||
@@ -116,7 +108,6 @@ namespace SewerStammGen.EntityFramework.Migrations
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Erstelldatum")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("ExportType")
|
||||
@@ -126,15 +117,12 @@ namespace SewerStammGen.EntityFramework.Migrations
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Ort")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Projektname")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Strasse")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -162,7 +150,6 @@ namespace SewerStammGen.EntityFramework.Migrations
|
||||
.HasColumnType("decimal(18,4)");
|
||||
|
||||
b.Property<string>("Objektbezeichnung")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("ProjektId")
|
||||
|
||||
@@ -36,7 +36,8 @@ namespace SewerStammGen.EntityFramework.Services.Common
|
||||
public async Task<bool> Delete(int id)
|
||||
{
|
||||
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);
|
||||
await context.SaveChangesAsync();
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.EntityFramework;
|
||||
using SewerStammGen.HostBuilders;
|
||||
using SewerStammGen.WPF.ViewModel;
|
||||
using System;
|
||||
@@ -40,6 +42,12 @@ namespace SewerStammGen.WPF
|
||||
|
||||
_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>() };
|
||||
window.Show();
|
||||
|
||||
|
||||
44
SewerStammGen/Commands/ProjektAddCommand.cs
Normal file
44
SewerStammGen/Commands/ProjektAddCommand.cs
Normal 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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
35
SewerStammGen/Commands/ProjektEditCommand.cs
Normal file
35
SewerStammGen/Commands/ProjektEditCommand.cs
Normal 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();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
26
SewerStammGen/Commands/ProjektSelectCommand.cs
Normal file
26
SewerStammGen/Commands/ProjektSelectCommand.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,24 +18,28 @@ namespace SewerStammGen.HostBuilders
|
||||
{
|
||||
hostBuilder.ConfigureServices((context, services) =>
|
||||
{
|
||||
string connectionString = "";
|
||||
Action<DbContextOptionsBuilder> configureDbContext = null;
|
||||
string databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
|
||||
Trace.WriteLine(databaseToUse);
|
||||
if (databaseToUse.Equals("default"))
|
||||
string? connectionString = "";
|
||||
Action<DbContextOptionsBuilder>? configureDbContext = null;
|
||||
string? databaseToUse = context.Configuration.GetConnectionString("databaseToUse");
|
||||
if (databaseToUse != null)
|
||||
{
|
||||
connectionString = context.Configuration.GetConnectionString("default");
|
||||
configureDbContext = o => o.UseNpgsql(connectionString);
|
||||
}
|
||||
else if (databaseToUse.Equals("sqlite"))
|
||||
{
|
||||
connectionString = context.Configuration.GetConnectionString("sqlite");
|
||||
configureDbContext = o => o.UseSqlite(connectionString);
|
||||
|
||||
if (databaseToUse.Equals("default"))
|
||||
{
|
||||
connectionString = context.Configuration.GetConnectionString("default");
|
||||
configureDbContext = o => o.UseNpgsql(connectionString);
|
||||
}
|
||||
else if (databaseToUse.Equals("sqlite"))
|
||||
{
|
||||
connectionString = context.Configuration.GetConnectionString("sqlite");
|
||||
configureDbContext = o => o.UseSqlite(connectionString);
|
||||
}
|
||||
services.AddDbContext<SewerStammGenDbContext>(configureDbContext);
|
||||
services.AddSingleton<SewerStammGenDbContextFactory>(new SewerStammGenDbContextFactory(configureDbContext));
|
||||
}
|
||||
|
||||
|
||||
services.AddDbContext<SewerStammGenDbContext>(configureDbContext);
|
||||
services.AddSingleton<SewerStammGenDbContextFactory>(new SewerStammGenDbContextFactory(configureDbContext));
|
||||
|
||||
});
|
||||
return hostBuilder;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.EntityFramework.Services;
|
||||
using SewerStammGen.WPF.Interface.Navigator;
|
||||
using SewerStammGen.WPF.ViewModel;
|
||||
using SewerStammGen.WPF.ViewModel.State.Navigation;
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
@@ -21,7 +22,7 @@ namespace SewerStammGen.HostBuilders
|
||||
host.ConfigureServices(services =>
|
||||
{
|
||||
services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>();
|
||||
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||
services.AddSingleton<IDataService<Projekt>, GenericDataService<Projekt>>();
|
||||
});
|
||||
return host;
|
||||
|
||||
@@ -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.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -13,7 +15,7 @@ namespace SewerStammGen.HostBuilders
|
||||
{
|
||||
hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
|
||||
services.AddSingleton<IActualState, ActualState>();
|
||||
});
|
||||
return hostBuilder;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using SewerStammGen.WPF.Commands;
|
||||
using SewerStammGen.WPF.Interface;
|
||||
using SewerStammGen.WPF.ViewModel;
|
||||
using SewerStammGen.WPF.ViewModel.State.Navigation;
|
||||
using SewerStammGen.WPF.ViewModel.Factories;
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
@@ -11,6 +13,7 @@ using System.Linq;
|
||||
using System.Net.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SewerStammGen.WPF.ViewModel.State;
|
||||
|
||||
namespace SewerStammGen.HostBuilders
|
||||
{
|
||||
@@ -20,7 +23,12 @@ namespace SewerStammGen.HostBuilders
|
||||
{
|
||||
hostBuilder.ConfigureServices(services =>
|
||||
{
|
||||
|
||||
services.AddTransient<MainWindowViewModel>();
|
||||
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektListViewModel>>();
|
||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||
|
||||
services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
|
||||
{
|
||||
return () => new HomeViewModel();
|
||||
@@ -36,10 +44,21 @@ namespace SewerStammGen.HostBuilders
|
||||
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 =>
|
||||
{
|
||||
return () => new ProjektListViewModel(
|
||||
services.GetRequiredService<IDataService<Projekt>>()
|
||||
services.GetRequiredService<IDataService<Projekt>>(),
|
||||
services.GetRequiredService<ViewModelDelegateRenavigator<ProjektEditViewModel>>(),
|
||||
services.GetRequiredService<IActualState>()
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
13
SewerStammGen/Interface/Navigator/IRenavigator.cs
Normal file
13
SewerStammGen/Interface/Navigator/IRenavigator.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,9 @@
|
||||
xmlns:viewmodel="clr-namespace:SewerStammGen.WPF.ViewModel"
|
||||
xmlns:controls="clr-namespace:SewerStammGen.WPF.Views.Controls"
|
||||
mc:Ignorable="d"
|
||||
Title="{Binding ApplicationTitle}" Height="450" Width="800">
|
||||
Title="{Binding ApplicationTitle}" Height="450" Width="800" FontSize="20"
|
||||
WindowState="Maximized"
|
||||
>
|
||||
<Window.Resources>
|
||||
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
|
||||
<view:HomeView />
|
||||
@@ -23,15 +25,23 @@
|
||||
<DataTemplate DataType="{x:Type viewmodel:ProjektListViewModel}">
|
||||
<view:ProjektListView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ProjektEditViewModel}">
|
||||
<view:ProjektEditView />
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<controls:UCMainWindowNavigationBar Grid.Column="0" />
|
||||
<ContentControl Grid.Column="1" Content="{Binding CurrentViewModel}" />
|
||||
<StatusBar Grid.Row="1" Grid.ColumnSpan="2">
|
||||
<StatusBarItem Content="{Binding Projektnummer}" />
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<Compile Update="Views\HomeView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Projekte\ProjektEditView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Views\Projekte\ProjektListView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -36,6 +39,9 @@
|
||||
<Page Update="Views\HomeView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Projekte\ProjektEditView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="Views\Projekte\ProjektListView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -9,12 +9,15 @@ using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using SewerStammGen.WPF.ViewModel.State;
|
||||
|
||||
namespace SewerStammGen.WPF.ViewModel
|
||||
{
|
||||
public class MainWindowViewModel : BaseViewModel
|
||||
{
|
||||
public IMainWindowNavigator Navigator { get; set; }
|
||||
public string? Projektnummer { get; set; }
|
||||
private readonly IActualState _actualState;
|
||||
public BaseViewModel CurrentViewModel => Navigator.CurrentViewModel;
|
||||
|
||||
public ICommand UpdateCurrentViewModelCommand { get; }
|
||||
@@ -26,7 +29,8 @@ namespace SewerStammGen.WPF.ViewModel
|
||||
|
||||
public MainWindowViewModel(
|
||||
IMainWindowNavigator navigator,
|
||||
IViewModelAbstractFactory viewModelFactory
|
||||
IViewModelAbstractFactory viewModelFactory,
|
||||
IActualState actualState
|
||||
|
||||
)
|
||||
{
|
||||
@@ -35,11 +39,20 @@ namespace SewerStammGen.WPF.ViewModel
|
||||
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
|
||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
||||
|
||||
_actualState = actualState;
|
||||
|
||||
_actualState.ProjektChanged += ActualState_ProjektChanged;
|
||||
|
||||
|
||||
Navigator.StateChanged += Navigator_StateChanged;
|
||||
}
|
||||
|
||||
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
||||
{
|
||||
Projektnummer = _actualState.ProjektID.ToString();
|
||||
OnPropertyChanged(nameof(Projektnummer));
|
||||
}
|
||||
|
||||
private void Navigator_StateChanged()
|
||||
{
|
||||
OnPropertyChanged(nameof(CurrentViewModel));
|
||||
|
||||
117
SewerStammGen/ViewModel/Projekt/ProjektEditViewModel.cs
Normal file
117
SewerStammGen/ViewModel/Projekt/ProjektEditViewModel.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
using SewerStammGen.EntityFramework.Services;
|
||||
using SewerStammGen.WPF.Commands;
|
||||
using SewerStammGen.WPF.Interface.Navigator;
|
||||
using SewerStammGen.WPF.ViewModel;
|
||||
using SewerStammGen.WPF.ViewModel.State;
|
||||
using Shared.Contracts;
|
||||
using Shared.Domain;
|
||||
using System;
|
||||
@@ -8,19 +11,49 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace SewerStammGen.WPF.ViewModel
|
||||
{
|
||||
public class ProjektListViewModel : BaseViewModel
|
||||
{
|
||||
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));
|
||||
this.genericDataService = generic;
|
||||
_actualState = actualState;
|
||||
AddCommand = new ProjektAddCommand(generic,actualState, renavigator);
|
||||
SelectCommand = new ProjektSelectCommand(actualState,this);
|
||||
EditCommand = new ProjektEditCommand(generic, actualState, renavigator, this);
|
||||
|
||||
LoadProjekte();
|
||||
}
|
||||
@@ -28,7 +61,7 @@ namespace SewerStammGen.WPF.ViewModel
|
||||
private async void LoadProjekte()
|
||||
{
|
||||
var projects = await genericDataService.GetAll();
|
||||
InitCollection(Projekte, projects);
|
||||
InitCollection(_projekte, projects);
|
||||
}
|
||||
|
||||
private void InitCollection(ObservableCollection<Projekt> projekte, IEnumerable<Projekt> projects)
|
||||
|
||||
30
SewerStammGen/ViewModel/State/ActualState.cs
Normal file
30
SewerStammGen/ViewModel/State/ActualState.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
18
SewerStammGen/ViewModel/State/IActualState.cs
Normal file
18
SewerStammGen/ViewModel/State/IActualState.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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: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: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>
|
||||
|
||||
</Grid>
|
||||
|
||||
35
SewerStammGen/Views/Projekte/ProjektEditView.xaml
Normal file
35
SewerStammGen/Views/Projekte/ProjektEditView.xaml
Normal 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>
|
||||
28
SewerStammGen/Views/Projekte/ProjektEditView.xaml.cs
Normal file
28
SewerStammGen/Views/Projekte/ProjektEditView.xaml.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,19 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<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>
|
||||
<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>
|
||||
|
||||
</DataGrid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="auto" />
|
||||
<ColumnDefinition Width="400" />
|
||||
<ColumnDefinition Width="520" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
@@ -17,22 +17,30 @@
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label FontSize="20" Grid.Column="0" Grid.Row="0" Content="Bezeichnung" />
|
||||
<Label FontSize="20" Grid.Column="0" Grid.Row="1" Content="Rechtswert" />
|
||||
<Label FontSize="20" Grid.Column="0" Grid.Row="2" Content="Hochwert" />
|
||||
<Label FontSize="20" 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="0" Content="Bezeichnung" />
|
||||
<Label Grid.Column="0" Grid.Row="1" Content="Rechtswert" />
|
||||
<Label Grid.Column="0" Grid.Row="2" Content="Hochwert" />
|
||||
<Label Grid.Column="0" Grid.Row="3" Content="Sohlhö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" FontSize="20" 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" FontSize="20" 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="0" Text="{Binding X}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="1" Text="{Binding X}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="2" Text="{Binding X}" />
|
||||
<TextBox Margin="2" Grid.Column="1" Grid.Row="3" 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" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||
xmlns:local="clr-namespace:SewerStammGen.WPF.Views"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
d:DesignHeight="450" Width="1028">
|
||||
<UserControl.Resources>
|
||||
<DataTemplate x:Key="headerTemplate">
|
||||
<TextBox></TextBox>
|
||||
@@ -14,30 +14,30 @@
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" FontSize="20" Content="Obere Schacht" />
|
||||
<Label Grid.Row="1" Grid.Column="0" FontSize="20" Content="Untere Schacht" />
|
||||
<Label Grid.Row="2" Grid.Column="0" FontSize="20" Content="Haltungsbezeichnung" />
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="Obere Schacht" />
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" />
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" />
|
||||
|
||||
<syncfusion:SfMultiColumnDropDownControl Grid.Column="1" Grid.Row="0"
|
||||
Width="250"
|
||||
|
||||
Margin="10,0"
|
||||
FontSize="20"
|
||||
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
AllowAutoComplete="True"
|
||||
@@ -55,7 +55,7 @@
|
||||
Width="250"
|
||||
|
||||
Margin="10,0"
|
||||
FontSize="20"
|
||||
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
AllowAutoComplete="True"
|
||||
@@ -67,25 +67,36 @@
|
||||
PopupWidth="400"
|
||||
ValueMember="Cast"
|
||||
></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.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" FontSize="20" Content="Material" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" FontSize="20" Content="Durchmesser" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Margin="5" FontSize="20" Text="{Binding X}" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="5" FontSize="20" Text="{Binding X}" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Content="Material" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="1" Grid.Column="0" Content="Durchmesser" />
|
||||
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Content="Haltungslänge" />
|
||||
<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>
|
||||
<StackPanel Grid.Row="3">
|
||||
<Button FontSize="20" Content="Speichern" />
|
||||
<StackPanel Grid.Row="4">
|
||||
<Button Content="Speichern" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Shared.Domain
|
||||
{
|
||||
public class Auftraggeber : DBObject
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Strasse { get; set; }
|
||||
public string Ort { get; set; }
|
||||
public string Postleitzahl { get; set; }
|
||||
public string Ansprechpartner { get; set; }
|
||||
public string Telefonnummer { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? Strasse { get; set; }
|
||||
public string? Ort { get; set; }
|
||||
public string? Postleitzahl { get; set; }
|
||||
public string? Ansprechpartner { get; set; }
|
||||
public string? Telefonnummer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Shared.Domain
|
||||
{
|
||||
public class Kanal : DBObject
|
||||
{
|
||||
public string Objektbezeichnung { get; set; }
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
public Schacht? StartSchacht { get; set; }
|
||||
public Schacht? EndSchacht { get; set; }
|
||||
public int DN { get; set; }
|
||||
public string Material { get; set; }
|
||||
public string? Material { get; set; }
|
||||
public decimal Haltungslaenge { get; set; }
|
||||
public EEntwaeserung Entwaesserung { get; set; }
|
||||
|
||||
|
||||
@@ -9,10 +9,10 @@ namespace Shared.Domain
|
||||
{
|
||||
public class Projekt : DBObject
|
||||
{
|
||||
public string Projektname { get; set; }
|
||||
public string Erstelldatum { get; set; }
|
||||
public string Strasse { get;set; }
|
||||
public string Ort { get; set; }
|
||||
public string? Projektname { get; set; }
|
||||
public string? Erstelldatum { get; set; }
|
||||
public string? Strasse { get;set; }
|
||||
public string? Ort { get; set; }
|
||||
public Auftraggeber Auftraggeber { get; set; }
|
||||
public EExportType ExportType { get; set; }
|
||||
public EKodierungssystem Kodierungssystem { get; set; }
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Shared.Domain
|
||||
{
|
||||
public class Schacht : DBObject
|
||||
{
|
||||
public string Objektbezeichnung { get; set; }
|
||||
public string? Objektbezeichnung { get; set; }
|
||||
|
||||
[Column(TypeName = "decimal(18,4)")]
|
||||
public decimal RechtsWert { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user