Schächte werden nun hinzugefügt
This commit is contained in:
222
SewerStammGen.EntityFramework/Migrations/20230331095322_SchachtRefProject.Designer.cs
generated
Normal file
222
SewerStammGen.EntityFramework/Migrations/20230331095322_SchachtRefProject.Designer.cs
generated
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// <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("20230331095322_SchachtRefProject")]
|
||||||
|
partial class SchachtRefProject
|
||||||
|
{
|
||||||
|
/// <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", "Projekt")
|
||||||
|
.WithMany("Schaechte")
|
||||||
|
.HasForeignKey("ProjektId");
|
||||||
|
|
||||||
|
b.Navigation("Projekt");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shared.Domain.Projekt", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Kanaele");
|
||||||
|
|
||||||
|
b.Navigation("Schaechte");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SewerStammGen.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SchachtRefProject : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
222
SewerStammGen.EntityFramework/Migrations/20230331121831_SchachtRefProjectVirtual.Designer.cs
generated
Normal file
222
SewerStammGen.EntityFramework/Migrations/20230331121831_SchachtRefProjectVirtual.Designer.cs
generated
Normal file
@@ -0,0 +1,222 @@
|
|||||||
|
// <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("20230331121831_SchachtRefProjectVirtual")]
|
||||||
|
partial class SchachtRefProjectVirtual
|
||||||
|
{
|
||||||
|
/// <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", "Projekt")
|
||||||
|
.WithMany("Schaechte")
|
||||||
|
.HasForeignKey("ProjektId");
|
||||||
|
|
||||||
|
b.Navigation("Projekt");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("Shared.Domain.Projekt", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Kanaele");
|
||||||
|
|
||||||
|
b.Navigation("Schaechte");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace SewerStammGen.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class SchachtRefProjectVirtual : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -200,9 +200,11 @@ namespace SewerStammGen.EntityFramework.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("Shared.Domain.Schacht", b =>
|
modelBuilder.Entity("Shared.Domain.Schacht", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("Shared.Domain.Projekt", null)
|
b.HasOne("Shared.Domain.Projekt", "Projekt")
|
||||||
.WithMany("Schaechte")
|
.WithMany("Schaechte")
|
||||||
.HasForeignKey("ProjektId");
|
.HasForeignKey("ProjektId");
|
||||||
|
|
||||||
|
b.Navigation("Projekt");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("Shared.Domain.Projekt", b =>
|
modelBuilder.Entity("Shared.Domain.Projekt", b =>
|
||||||
|
|||||||
63
SewerStammGen.EntityFramework/Services/SchachtDataService.cs
Normal file
63
SewerStammGen.EntityFramework/Services/SchachtDataService.cs
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SewerStammGen.EntityFramework.Services.Common;
|
||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.EntityFramework.Services
|
||||||
|
{
|
||||||
|
public class SchachtDataService : ISchachtDataService
|
||||||
|
{
|
||||||
|
private readonly SewerStammGenDbContextFactory _contextFactory;
|
||||||
|
private readonly NonQueryDataService<Schacht> _nonQueryDataService;
|
||||||
|
|
||||||
|
public SchachtDataService(SewerStammGenDbContextFactory contextFactory)
|
||||||
|
{
|
||||||
|
_contextFactory = contextFactory;
|
||||||
|
_nonQueryDataService = new NonQueryDataService<Schacht>(contextFactory);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Schacht> Create(Schacht entity)
|
||||||
|
{
|
||||||
|
return await _nonQueryDataService.Create(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Schacht CreateNonAsync(Schacht entity)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<bool> Delete(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<Schacht> Get(int id)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<Schacht>> GetAll(int projektID)
|
||||||
|
{
|
||||||
|
using (SewerStammGenDbContext context = _contextFactory.CreateDbContext())
|
||||||
|
{
|
||||||
|
IEnumerable<Schacht> entities = await context.Set<Schacht>().Where(x => x.Projekt.Id.Equals(projektID)).ToListAsync();
|
||||||
|
return entities;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Task<IEnumerable<Schacht>> GetAll()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Schacht> Update(int id, Schacht entity)
|
||||||
|
{
|
||||||
|
return await _nonQueryDataService.Update(id, entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
46
SewerStammGen/Commands/SchachtAddCommand.cs
Normal file
46
SewerStammGen/Commands/SchachtAddCommand.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
class SchachtAddCommand : AsyncCommandBase
|
||||||
|
{
|
||||||
|
private readonly ISchachtDataService schachtDataService;
|
||||||
|
private readonly IActualState actualState;
|
||||||
|
private readonly IRenavigator renavigator;
|
||||||
|
private readonly IDataService<Projekt> projektService;
|
||||||
|
private readonly ISchachtService schachtService;
|
||||||
|
|
||||||
|
|
||||||
|
public SchachtAddCommand(ISchachtDataService schachtDataService,IDataService<Projekt> projektService, IActualState actualState, IRenavigator renavigator, ISchachtService schachtService)
|
||||||
|
{
|
||||||
|
this.schachtDataService = schachtDataService;
|
||||||
|
this.actualState = actualState;
|
||||||
|
this.renavigator = renavigator;
|
||||||
|
this.projektService = projektService;
|
||||||
|
this.schachtService = schachtService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override async Task ExecuteAsync(object? parameter)
|
||||||
|
{
|
||||||
|
/*var d = await projektService.Get(actualState.ProjektID);
|
||||||
|
Schacht newSchacht = new Schacht();
|
||||||
|
newSchacht.Projekt = d;
|
||||||
|
newSchacht.Objektbezeichnung = "test";
|
||||||
|
|
||||||
|
await schachtDataService.Create(newSchacht);
|
||||||
|
*/
|
||||||
|
Projekt aktuelleProjekt = await projektService.Get(actualState.ProjektID);
|
||||||
|
Schacht schacht = await schachtService.CreateSchacht(aktuelleProjekt);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
SewerStammGen/Commands/SchachtDeleteCommand.cs
Normal file
33
SewerStammGen/Commands/SchachtDeleteCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using SewerStammGen.WPF.Interface.Navigator;
|
||||||
|
using SewerStammGen.WPF.ViewModel;
|
||||||
|
using SewerStammGen.WPF.ViewModel.State;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.Commands
|
||||||
|
{
|
||||||
|
class SchachtDeleteCommand : AsyncCommandBase
|
||||||
|
{
|
||||||
|
private ISchachtDataService schachtService;
|
||||||
|
private IActualState actualState;
|
||||||
|
private IRenavigator renavigator;
|
||||||
|
private ManholeListViewModel manholeListViewModel;
|
||||||
|
|
||||||
|
public SchachtDeleteCommand(ISchachtDataService schachtService, IActualState actualState, IRenavigator renavigator, ManholeListViewModel manholeListViewModel)
|
||||||
|
{
|
||||||
|
this.schachtService = schachtService;
|
||||||
|
this.actualState = actualState;
|
||||||
|
this.renavigator = renavigator;
|
||||||
|
this.manholeListViewModel = manholeListViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task ExecuteAsync(object? parameter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
SewerStammGen/Commands/SchachtEditCommand.cs
Normal file
33
SewerStammGen/Commands/SchachtEditCommand.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using SewerStammGen.WPF.Interface.Navigator;
|
||||||
|
using SewerStammGen.WPF.ViewModel;
|
||||||
|
using SewerStammGen.WPF.ViewModel.State;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.Commands
|
||||||
|
{
|
||||||
|
class SchachtEditCommand : AsyncCommandBase
|
||||||
|
{
|
||||||
|
private ISchachtDataService schachtService;
|
||||||
|
private IActualState actualState;
|
||||||
|
private IRenavigator renavigator;
|
||||||
|
private ManholeListViewModel manholeListViewModel;
|
||||||
|
|
||||||
|
public SchachtEditCommand(ISchachtDataService schachtService, IActualState actualState, IRenavigator renavigator, ManholeListViewModel manholeListViewModel)
|
||||||
|
{
|
||||||
|
this.schachtService = schachtService;
|
||||||
|
this.actualState = actualState;
|
||||||
|
this.renavigator = renavigator;
|
||||||
|
this.manholeListViewModel = manholeListViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task ExecuteAsync(object? parameter)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,8 +9,9 @@ namespace SewerStammGen.Enum
|
|||||||
public enum EMainWindowViewType
|
public enum EMainWindowViewType
|
||||||
{
|
{
|
||||||
Home,
|
Home,
|
||||||
ProjectsList,
|
ProjectList,
|
||||||
EditSchacht,
|
SchachtList,
|
||||||
|
SchachtEdit,
|
||||||
SewerConnectionEdit
|
SewerConnectionEdit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
using SewerStammGen.EntityFramework.Services;
|
using SewerStammGen.EntityFramework.Services;
|
||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using SewerStammGen.Shared.Services;
|
||||||
using SewerStammGen.WPF.Interface.Navigator;
|
using SewerStammGen.WPF.Interface.Navigator;
|
||||||
using SewerStammGen.WPF.ViewModel;
|
using SewerStammGen.WPF.ViewModel;
|
||||||
using SewerStammGen.WPF.ViewModel.State.Navigation;
|
using SewerStammGen.WPF.ViewModel.State.Navigation;
|
||||||
@@ -24,6 +26,8 @@ namespace SewerStammGen.HostBuilders
|
|||||||
services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>();
|
services.AddSingleton<IMainWindowNavigator, MainWindowNavigator>();
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||||
services.AddSingleton<IDataService<Projekt>, GenericDataService<Projekt>>();
|
services.AddSingleton<IDataService<Projekt>, GenericDataService<Projekt>>();
|
||||||
|
services.AddSingleton<ISchachtDataService, SchachtDataService>();
|
||||||
|
services.AddSingleton<ISchachtService, SchachtService>();
|
||||||
});
|
});
|
||||||
return host;
|
return host;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Net.Security;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using SewerStammGen.WPF.ViewModel.State;
|
using SewerStammGen.WPF.ViewModel.State;
|
||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
|
||||||
namespace SewerStammGen.HostBuilders
|
namespace SewerStammGen.HostBuilders
|
||||||
{
|
{
|
||||||
@@ -29,21 +30,38 @@ namespace SewerStammGen.HostBuilders
|
|||||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektListViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<ProjektListViewModel>>();
|
||||||
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
services.AddSingleton<ViewModelDelegateRenavigator<ProjektEditViewModel>>();
|
||||||
|
|
||||||
|
services.AddSingleton<ViewModelDelegateRenavigator<ManholeListViewModel>>();
|
||||||
|
services.AddSingleton<ViewModelDelegateRenavigator<ManholeEditViewModel>>();
|
||||||
|
|
||||||
services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
|
services.AddSingleton<CreateViewModel<HomeViewModel>>(services =>
|
||||||
{
|
{
|
||||||
return () => new HomeViewModel();
|
return () => new HomeViewModel();
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddSingleton<CreateViewModel<EditManHoleViewModel>>(services =>
|
#region Schächte
|
||||||
|
services.AddSingleton<CreateViewModel<ManholeListViewModel>>(services =>
|
||||||
{
|
{
|
||||||
return () => new EditManHoleViewModel();
|
return () => new ManholeListViewModel(
|
||||||
|
services.GetRequiredService<ISchachtDataService>(),
|
||||||
|
services.GetRequiredService<IDataService<Projekt>>(),
|
||||||
|
services.GetRequiredService<ViewModelDelegateRenavigator<ManholeEditViewModel>>(),
|
||||||
|
services.GetRequiredService<IActualState>(),
|
||||||
|
services.GetRequiredService<ISchachtService>()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
services.AddSingleton<CreateViewModel<ManholeEditViewModel>>(services =>
|
||||||
|
{
|
||||||
|
return () => new ManholeEditViewModel();
|
||||||
|
});
|
||||||
|
#endregion
|
||||||
|
|
||||||
services.AddSingleton<CreateViewModel<SewerConnectorViewModel>>(services =>
|
services.AddSingleton<CreateViewModel<SewerConnectorViewModel>>(services =>
|
||||||
{
|
{
|
||||||
return () => new SewerConnectorViewModel();
|
return () => new SewerConnectorViewModel();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#region Projekte
|
||||||
services.AddSingleton<CreateViewModel<ProjektEditViewModel>>(services =>
|
services.AddSingleton<CreateViewModel<ProjektEditViewModel>>(services =>
|
||||||
{
|
{
|
||||||
return () => new ProjektEditViewModel(
|
return () => new ProjektEditViewModel(
|
||||||
@@ -61,6 +79,7 @@ namespace SewerStammGen.HostBuilders
|
|||||||
services.GetRequiredService<IActualState>()
|
services.GetRequiredService<IActualState>()
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
#endregion
|
||||||
|
|
||||||
services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>();
|
services.AddSingleton<IViewModelAbstractFactory, MainWindowViewModelFactory>();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,10 @@
|
|||||||
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
|
<DataTemplate DataType="{x:Type viewmodel:HomeViewModel}">
|
||||||
<view:HomeView />
|
<view:HomeView />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewmodel:EditManHoleViewModel}">
|
<DataTemplate DataType="{x:Type viewmodel:ManholeListViewModel}">
|
||||||
|
<view:SchachtListView />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type viewmodel:ManholeEditViewModel}">
|
||||||
<view:UCEditSchacht />
|
<view:UCEditSchacht />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate DataType="{x:Type viewmodel:SewerConnectorViewModel}">
|
<DataTemplate DataType="{x:Type viewmodel:SewerConnectorViewModel}">
|
||||||
|
|||||||
@@ -13,10 +13,13 @@
|
|||||||
<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">
|
<Compile Update="Views\Projekt\ProjektEditView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="Views\Projekte\ProjektListView.xaml.cs">
|
<Compile Update="Views\Projekt\ProjektListView.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Views\Schacht\SchachtListView.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Update="Views\UCEditSchacht.xaml.cs">
|
<Compile Update="Views\UCEditSchacht.xaml.cs">
|
||||||
@@ -39,10 +42,13 @@
|
|||||||
<Page Update="Views\HomeView.xaml">
|
<Page Update="Views\HomeView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Update="Views\Projekte\ProjektEditView.xaml">
|
<Page Update="Views\Projekt\ProjektEditView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Update="Views\Projekte\ProjektListView.xaml">
|
<Page Update="Views\Projekt\ProjektListView.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
|
<Page Update="Views\Schacht\SchachtListView.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
<Page Update="Views\styles\my_controls.xaml">
|
<Page Update="Views\styles\my_controls.xaml">
|
||||||
|
|||||||
@@ -11,37 +11,38 @@ namespace SewerStammGen.WPF.ViewModel.Factories
|
|||||||
public class MainWindowViewModelFactory : IViewModelAbstractFactory
|
public class MainWindowViewModelFactory : IViewModelAbstractFactory
|
||||||
{
|
{
|
||||||
private CreateViewModel<HomeViewModel> _createHomeViewModel;
|
private CreateViewModel<HomeViewModel> _createHomeViewModel;
|
||||||
private CreateViewModel<EditManHoleViewModel> _createEditManholeViewModel;
|
private CreateViewModel<ManholeEditViewModel> _createManholeEditViewModel;
|
||||||
|
private CreateViewModel<ManholeListViewModel> _createManholeListViewModel;
|
||||||
private CreateViewModel<SewerConnectorViewModel> _createSewerConnectorViewModel;
|
private CreateViewModel<SewerConnectorViewModel> _createSewerConnectorViewModel;
|
||||||
private CreateViewModel<ProjektListViewModel> _createProjektListViewModel;
|
private CreateViewModel<ProjektListViewModel> _createProjektListViewModel;
|
||||||
|
|
||||||
public MainWindowViewModelFactory(
|
public MainWindowViewModelFactory(
|
||||||
CreateViewModel<HomeViewModel> createHomeViewModel,
|
CreateViewModel<HomeViewModel> createHomeViewModel,
|
||||||
CreateViewModel<EditManHoleViewModel> createEditManholeViewModel,
|
CreateViewModel<ManholeEditViewModel> createManholeEditViewModel,
|
||||||
|
CreateViewModel<ManholeListViewModel> createManholeListViewModel,
|
||||||
CreateViewModel<SewerConnectorViewModel> createSewerConnectorViewModel,
|
CreateViewModel<SewerConnectorViewModel> createSewerConnectorViewModel,
|
||||||
CreateViewModel<ProjektListViewModel> createProjektListViewModel
|
CreateViewModel<ProjektListViewModel> createProjektListViewModel
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
_createHomeViewModel = createHomeViewModel;
|
_createHomeViewModel = createHomeViewModel;
|
||||||
_createEditManholeViewModel = createEditManholeViewModel;
|
_createManholeEditViewModel = createManholeEditViewModel;
|
||||||
_createSewerConnectorViewModel = createSewerConnectorViewModel;
|
_createSewerConnectorViewModel = createSewerConnectorViewModel;
|
||||||
_createProjektListViewModel = createProjektListViewModel;
|
_createProjektListViewModel = createProjektListViewModel;
|
||||||
|
_createManholeListViewModel = createManholeListViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
|
public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
|
||||||
{
|
{
|
||||||
switch(viewType)
|
switch(viewType)
|
||||||
{
|
{
|
||||||
case EMainWindowViewType.Home:
|
case EMainWindowViewType.Home: return _createHomeViewModel();
|
||||||
return _createHomeViewModel();
|
|
||||||
|
|
||||||
case EMainWindowViewType.EditSchacht:
|
case EMainWindowViewType.SchachtList: return _createManholeListViewModel();
|
||||||
return _createEditManholeViewModel();
|
case EMainWindowViewType.SchachtEdit: return _createManholeEditViewModel();
|
||||||
|
|
||||||
case EMainWindowViewType.SewerConnectionEdit:
|
case EMainWindowViewType.SewerConnectionEdit: return _createSewerConnectorViewModel();
|
||||||
return _createSewerConnectorViewModel();
|
|
||||||
|
|
||||||
case EMainWindowViewType.ProjectsList: return _createProjektListViewModel();
|
case EMainWindowViewType.ProjectList: return _createProjektListViewModel();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ namespace SewerStammGen.WPF.ViewModel
|
|||||||
|
|
||||||
|
|
||||||
Navigator.StateChanged += Navigator_StateChanged;
|
Navigator.StateChanged += Navigator_StateChanged;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
_actualState.ProjektID = 5;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
private void ActualState_ProjektChanged(object? sender, EventArgs e)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace SewerStammGen.WPF.ViewModel
|
namespace SewerStammGen.WPF.ViewModel
|
||||||
{
|
{
|
||||||
public class EditManHoleViewModel : BaseViewModel
|
public class ManholeEditViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
60
SewerStammGen/ViewModel/Schacht/ManholeListViewModel.cs
Normal file
60
SewerStammGen/ViewModel/Schacht/ManholeListViewModel.cs
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using SewerStammGen.WPF.Commands;
|
||||||
|
using SewerStammGen.WPF.Interface.Navigator;
|
||||||
|
using SewerStammGen.WPF.ViewModel.State;
|
||||||
|
using Shared.Contracts;
|
||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace SewerStammGen.WPF.ViewModel
|
||||||
|
{
|
||||||
|
public class ManholeListViewModel : BaseViewModel
|
||||||
|
{
|
||||||
|
private ISchachtDataService _schachtService;
|
||||||
|
private readonly ObservableCollection<Schacht> _schaechte;
|
||||||
|
private readonly IActualState _actualState;
|
||||||
|
private readonly ISchachtService _schachtServicer;
|
||||||
|
public ObservableCollection<Schacht> Schaechte { get => _schaechte; }
|
||||||
|
|
||||||
|
public ICommand AddSchachtCommand { get; set; }
|
||||||
|
public ICommand EditSchachtCommand { get; set; }
|
||||||
|
public ICommand DeleteSchachtCommand { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public ManholeListViewModel(ISchachtDataService schachtService, IDataService<Projekt> projektService,IRenavigator renavigator ,IActualState actualState, ISchachtService schachtServicer)
|
||||||
|
{
|
||||||
|
_schachtService = schachtService;
|
||||||
|
_actualState = actualState;
|
||||||
|
|
||||||
|
_schaechte = new ObservableCollection<Schacht>();
|
||||||
|
_schachtServicer = schachtServicer;
|
||||||
|
|
||||||
|
AddSchachtCommand = new SchachtAddCommand(schachtService,projektService, actualState,renavigator,schachtServicer);
|
||||||
|
EditSchachtCommand = new SchachtEditCommand(schachtService, actualState, renavigator,this);
|
||||||
|
DeleteSchachtCommand = new SchachtDeleteCommand(schachtService, actualState, renavigator, this);
|
||||||
|
|
||||||
|
LoadSchaechte();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void LoadSchaechte()
|
||||||
|
{
|
||||||
|
var schaechte = await _schachtService.GetAll(_actualState.ProjektID);
|
||||||
|
InitCollection(_schaechte, schaechte);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InitCollection(ObservableCollection<Schacht> dest, IEnumerable<Schacht> source)
|
||||||
|
{
|
||||||
|
dest.Clear();
|
||||||
|
foreach(var i in source)
|
||||||
|
{
|
||||||
|
dest.Add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,8 @@ namespace SewerStammGen.WPF.ViewModel.State
|
|||||||
{
|
{
|
||||||
internal class ActualState : IActualState
|
internal class ActualState : IActualState
|
||||||
{
|
{
|
||||||
public int ProjektID { get; private set; }
|
// TODO: set auf private set setzen
|
||||||
|
public int ProjektID { get; set; }
|
||||||
|
|
||||||
public void SetProjekt(Projekt projekt, bool notification = true)
|
public void SetProjekt(Projekt projekt, bool notification = true)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ namespace SewerStammGen.WPF.ViewModel.State
|
|||||||
public interface IActualState
|
public interface IActualState
|
||||||
{
|
{
|
||||||
event EventHandler? ProjektChanged;
|
event EventHandler? ProjektChanged;
|
||||||
|
// TODO: ProjektID set entfernen!
|
||||||
int ProjektID { get; }
|
int ProjektID { get; set; }
|
||||||
|
|
||||||
void SetProjekt(Projekt projekt, bool notification = true);
|
void SetProjekt(Projekt projekt, bool notification = true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<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.ProjectList}" 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:ManholeListViewModel}}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.SchachtList}" 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="Haltungen" />
|
<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>
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
<Grid>
|
<Grid>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<DataGrid FontSize="20" Margin="10" SelectedItem="{Binding SelectedProjekt}" ItemsSource="{Binding Projekte}" IsReadOnly="True" SelectionMode="Single" AutoGenerateColumns="False">
|
<DataGrid Margin="10" SelectedItem="{Binding SelectedProjekt}" ItemsSource="{Binding Projekte}" IsReadOnly="True" SelectionMode="Single" AutoGenerateColumns="False">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Projektname" Binding="{Binding Projektname}" />
|
<DataGridTextColumn Header="Projektname" Binding="{Binding Projektname}" />
|
||||||
<DataGridTextColumn Header="Erstelldatum" Binding="{Binding Erstelldatum}" />
|
<DataGridTextColumn Header="Erstelldatum" Binding="{Binding Erstelldatum}" />
|
||||||
27
SewerStammGen/Views/Schacht/SchachtListView.xaml
Normal file
27
SewerStammGen/Views/Schacht/SchachtListView.xaml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<UserControl x:Class="SewerStammGen.WPF.Views.SchachtListView"
|
||||||
|
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>
|
||||||
|
<StackPanel>
|
||||||
|
<DataGrid ItemsSource="{Binding Schaechte}" AutoGenerateColumns="False" IsReadOnly="True" SelectionMode="Single">
|
||||||
|
<DataGrid.Columns>
|
||||||
|
<DataGridTextColumn Header="Schachtnummer" Binding="{Binding Objektbezeichnung}" />
|
||||||
|
<DataGridTextColumn Header="Rechtswert" Binding="{Binding RechtsWert}" />
|
||||||
|
<DataGridTextColumn Header="Hochwert" Binding="{Binding HochWert}" />
|
||||||
|
<DataGridTextColumn Header="Sohlhöhe" Binding="{Binding SohlHoehe}" />
|
||||||
|
<DataGridTextColumn Header="Deckelhöhe" Binding="{Binding DeckelHoehe}" />
|
||||||
|
<DataGridTextColumn Header="Entwässerung" Binding="{Binding Entwaesserung}" />
|
||||||
|
</DataGrid.Columns>
|
||||||
|
</DataGrid>
|
||||||
|
<Button Content="Schacht hinzufügen" Command="{Binding AddSchachtCommand}" />
|
||||||
|
<Button Content="Schacht Editieren" Command="{Binding EditSchacht}" />
|
||||||
|
<Button Content="Schacht Löschen" Command="{Binding DeleteSchacht}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
28
SewerStammGen/Views/Schacht/SchachtListView.xaml.cs
Normal file
28
SewerStammGen/Views/Schacht/SchachtListView.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 SchachtList.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SchachtListView : UserControl
|
||||||
|
{
|
||||||
|
public SchachtListView()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Shared/Contracts/IProjektDataService.cs
Normal file
14
Shared/Contracts/IProjektDataService.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Shared.Contracts;
|
||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.Shared.Contracts
|
||||||
|
{
|
||||||
|
public interface IProjektDataService : IDataService<Projekt>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
15
Shared/Contracts/ISchachtDataService.cs
Normal file
15
Shared/Contracts/ISchachtDataService.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using Shared.Contracts;
|
||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.Shared.Contracts
|
||||||
|
{
|
||||||
|
public interface ISchachtDataService : IDataService<Schacht>
|
||||||
|
{
|
||||||
|
Task<IEnumerable<Schacht>> GetAll(int projektID);
|
||||||
|
}
|
||||||
|
}
|
||||||
14
Shared/Contracts/ISchachtService.cs
Normal file
14
Shared/Contracts/ISchachtService.cs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.Shared.Contracts
|
||||||
|
{
|
||||||
|
public interface ISchachtService
|
||||||
|
{
|
||||||
|
Task<Schacht> CreateSchacht(Projekt proj);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ namespace Shared.Domain
|
|||||||
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; }
|
||||||
public IList<Kanal> Kanaele { get; set; }
|
public IList<Kanal> Kanaele { get; set; } = new List<Kanal>();
|
||||||
public IList<Schacht> Schaechte { get; set;}
|
public IList<Schacht> Schaechte { get; set;} = new List<Schacht>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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; }
|
||||||
@@ -22,6 +22,8 @@ namespace Shared.Domain
|
|||||||
|
|
||||||
[Column(TypeName = "decimal(18,4)")]
|
[Column(TypeName = "decimal(18,4)")]
|
||||||
public decimal DeckelHoehe { get; set; }
|
public decimal DeckelHoehe { get; set; }
|
||||||
|
|
||||||
|
public virtual Projekt? Projekt { get; set; }
|
||||||
public EEntwaeserung Entwaesserung { get; set; }
|
public EEntwaeserung Entwaesserung { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
31
Shared/Services/SchachtService.cs
Normal file
31
Shared/Services/SchachtService.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using SewerStammGen.Shared.Contracts;
|
||||||
|
using Shared.Contracts;
|
||||||
|
using Shared.Domain;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SewerStammGen.Shared.Services
|
||||||
|
{
|
||||||
|
public class SchachtService : ISchachtService
|
||||||
|
{
|
||||||
|
private readonly IDataService<Projekt> _projectService;
|
||||||
|
|
||||||
|
public SchachtService(IDataService<Projekt> projectService)
|
||||||
|
{
|
||||||
|
_projectService = projectService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Schacht> CreateSchacht(Projekt proj)
|
||||||
|
{
|
||||||
|
Schacht schacht = new Schacht() {
|
||||||
|
Projekt = proj
|
||||||
|
};
|
||||||
|
proj.Schaechte.Add(schacht);
|
||||||
|
await _projectService.Update(proj.Id, proj);
|
||||||
|
return schacht;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user