From fc144554a521e1185a30b08e133505ea0b8173a7 Mon Sep 17 00:00:00 2001 From: Husky Date: Fri, 21 Feb 2020 09:50:32 +0100 Subject: [PATCH] Klassen erweitert --- KanSan.Base/Enums/EMaterial.cs | 9 + KanSan.Base/Enums/EPunktType.cs | 10 + KanSan.Base/Interfaces/IDatabaseEntry.cs | 12 ++ KanSan.Base/Interfaces/IUnitOfWork.cs | 2 +- KanSan.Base/KanSanContext.cs | 4 +- .../20200220200339_InitialCommit.Designer.cs | 87 -------- .../20200220200339_InitialCommit.cs | 66 ------ .../20200221084801_InitialCommit.Designer.cs | 198 ++++++++++++++++++ .../20200221084801_InitialCommit.cs | 171 +++++++++++++++ .../Migrations/KanSanContextModelSnapshot.cs | 135 ++++++++++-- KanSan.Base/Models/Baustelle.cs | 15 +- KanSan.Base/Models/DatenbankClass.cs | 12 -- KanSan.Base/Models/Kunde.cs | 9 +- KanSan.Base/Models/Projekt.cs | 16 ++ KanSan.Base/Models/Sewer.cs | 22 ++ KanSan.Base/Models/SewerPoint.cs | 12 ++ KanSan.Base/UnitOfWork.cs | 6 +- KanSan/ViewModel/BaustelleViewModel.cs | 2 +- 18 files changed, 596 insertions(+), 192 deletions(-) create mode 100644 KanSan.Base/Enums/EMaterial.cs create mode 100644 KanSan.Base/Enums/EPunktType.cs create mode 100644 KanSan.Base/Interfaces/IDatabaseEntry.cs delete mode 100644 KanSan.Base/Migrations/20200220200339_InitialCommit.Designer.cs delete mode 100644 KanSan.Base/Migrations/20200220200339_InitialCommit.cs create mode 100644 KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs create mode 100644 KanSan.Base/Migrations/20200221084801_InitialCommit.cs delete mode 100644 KanSan.Base/Models/DatenbankClass.cs create mode 100644 KanSan.Base/Models/Projekt.cs create mode 100644 KanSan.Base/Models/Sewer.cs create mode 100644 KanSan.Base/Models/SewerPoint.cs diff --git a/KanSan.Base/Enums/EMaterial.cs b/KanSan.Base/Enums/EMaterial.cs new file mode 100644 index 0000000..b7e4ad8 --- /dev/null +++ b/KanSan.Base/Enums/EMaterial.cs @@ -0,0 +1,9 @@ +namespace KanSan.Base.Enums +{ + public enum EMaterial + { + Steinzeug, + Beton, + Polypropolen + } +} diff --git a/KanSan.Base/Enums/EPunktType.cs b/KanSan.Base/Enums/EPunktType.cs new file mode 100644 index 0000000..34aae0d --- /dev/null +++ b/KanSan.Base/Enums/EPunktType.cs @@ -0,0 +1,10 @@ +namespace KanSan.Base.Enums +{ + public enum EPunktType + { + Leitung, + Haltung, + Schacht, + Anschlusspunkt + } +} diff --git a/KanSan.Base/Interfaces/IDatabaseEntry.cs b/KanSan.Base/Interfaces/IDatabaseEntry.cs new file mode 100644 index 0000000..5324599 --- /dev/null +++ b/KanSan.Base/Interfaces/IDatabaseEntry.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace KanSan.Base.Interfaces +{ + public interface IDatabaseEntry + { + int ID { get; set; } + Guid GuidNr { get; set; } + } +} diff --git a/KanSan.Base/Interfaces/IUnitOfWork.cs b/KanSan.Base/Interfaces/IUnitOfWork.cs index 0d3e2ec..1bb0f35 100644 --- a/KanSan.Base/Interfaces/IUnitOfWork.cs +++ b/KanSan.Base/Interfaces/IUnitOfWork.cs @@ -7,7 +7,7 @@ namespace KanSan.Base.Interfaces { public interface IUnitOfWork { - IRepository BaustellenRepository { get; } + IRepository BaustellenRepository { get; } IRepository KundenRepository { get; } void Commit(); } diff --git a/KanSan.Base/KanSanContext.cs b/KanSan.Base/KanSanContext.cs index f89243c..9840725 100644 --- a/KanSan.Base/KanSanContext.cs +++ b/KanSan.Base/KanSanContext.cs @@ -6,8 +6,10 @@ namespace KanSan.Base { public class KanSanContext : DbContext { - public DbSet Baustellen { get; set; } + public DbSet Projekte { get; set; } public DbSet Kunden { get; set; } + public DbSet Kanaele { get; set; } + public DbSet SewerPoints { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlite("Data Source=kansan.db"); diff --git a/KanSan.Base/Migrations/20200220200339_InitialCommit.Designer.cs b/KanSan.Base/Migrations/20200220200339_InitialCommit.Designer.cs deleted file mode 100644 index 0a76b88..0000000 --- a/KanSan.Base/Migrations/20200220200339_InitialCommit.Designer.cs +++ /dev/null @@ -1,87 +0,0 @@ -// -using System; -using KanSan.Base; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace KanSan.Base.Migrations -{ - [DbContext(typeof(KanSanContext))] - [Migration("20200220200339_InitialCommit")] - partial class InitialCommit - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.1.1"); - - modelBuilder.Entity("KanSan.Base.Models.Baustelle", b => - { - b.Property("ID") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidNr") - .HasColumnType("TEXT"); - - b.Property("KundeID") - .HasColumnType("INTEGER"); - - b.Property("Ort") - .HasColumnType("TEXT"); - - b.Property("Projektnummer") - .HasColumnType("TEXT"); - - b.Property("Strasse") - .HasColumnType("TEXT"); - - b.HasKey("ID"); - - b.HasIndex("KundeID"); - - b.ToTable("Baustellen"); - }); - - modelBuilder.Entity("KanSan.Base.Models.Kunde", b => - { - b.Property("ID") - .ValueGeneratedOnAdd() - .HasColumnType("INTEGER"); - - b.Property("GuidNr") - .HasColumnType("TEXT"); - - b.Property("Nachname") - .HasColumnType("TEXT"); - - b.Property("Ort") - .HasColumnType("TEXT"); - - b.Property("PLZ") - .HasColumnType("TEXT"); - - b.Property("Strasse") - .HasColumnType("TEXT"); - - b.Property("Vorname") - .HasColumnType("TEXT"); - - b.HasKey("ID"); - - b.ToTable("Kunden"); - }); - - modelBuilder.Entity("KanSan.Base.Models.Baustelle", b => - { - b.HasOne("KanSan.Base.Models.Kunde", "Kunde") - .WithMany("Baustellen") - .HasForeignKey("KundeID"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/KanSan.Base/Migrations/20200220200339_InitialCommit.cs b/KanSan.Base/Migrations/20200220200339_InitialCommit.cs deleted file mode 100644 index 727041e..0000000 --- a/KanSan.Base/Migrations/20200220200339_InitialCommit.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace KanSan.Base.Migrations -{ - public partial class InitialCommit : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Kunden", - columns: table => new - { - ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - GuidNr = table.Column(nullable: false), - Vorname = table.Column(nullable: true), - Nachname = table.Column(nullable: true), - Strasse = table.Column(nullable: true), - PLZ = table.Column(nullable: true), - Ort = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Kunden", x => x.ID); - }); - - migrationBuilder.CreateTable( - name: "Baustellen", - columns: table => new - { - ID = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - GuidNr = table.Column(nullable: false), - KundeID = table.Column(nullable: true), - Ort = table.Column(nullable: true), - Strasse = table.Column(nullable: true), - Projektnummer = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Baustellen", x => x.ID); - table.ForeignKey( - name: "FK_Baustellen_Kunden_KundeID", - column: x => x.KundeID, - principalTable: "Kunden", - principalColumn: "ID", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Baustellen_KundeID", - table: "Baustellen", - column: "KundeID"); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Baustellen"); - - migrationBuilder.DropTable( - name: "Kunden"); - } - } -} diff --git a/KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs b/KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs new file mode 100644 index 0000000..d028784 --- /dev/null +++ b/KanSan.Base/Migrations/20200221084801_InitialCommit.Designer.cs @@ -0,0 +1,198 @@ +// +using System; +using KanSan.Base; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace KanSan.Base.Migrations +{ + [DbContext(typeof(KanSanContext))] + [Migration("20200221084801_InitialCommit")] + partial class InitialCommit + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.1"); + + modelBuilder.Entity("KanSan.Base.Models.Baustelle", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BaustelleNummer") + .HasColumnType("TEXT"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("OrtTeil") + .HasColumnType("TEXT"); + + b.Property("ProjektID") + .HasColumnType("INTEGER"); + + b.HasKey("ID"); + + b.HasIndex("ProjektID"); + + b.ToTable("Baustelle"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Kunde", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("Nachname") + .HasColumnType("TEXT"); + + b.Property("Ort") + .HasColumnType("TEXT"); + + b.Property("PLZ") + .HasColumnType("TEXT"); + + b.Property("Strasse") + .HasColumnType("TEXT"); + + b.Property("Vorname") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("Kunden"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Projekt", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("KundeID") + .HasColumnType("INTEGER"); + + b.Property("Ort") + .HasColumnType("TEXT"); + + b.Property("Projektnummer") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("KundeID"); + + b.ToTable("Projekte"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Sewer", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BaustelleID") + .HasColumnType("INTEGER"); + + b.Property("DN") + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("Material") + .HasColumnType("INTEGER"); + + b.Property("ObjektNummer") + .HasColumnType("TEXT"); + + b.Property("PunktObenID") + .HasColumnType("INTEGER"); + + b.Property("PunktTypeOben") + .HasColumnType("INTEGER"); + + b.Property("PunktTypeUnten") + .HasColumnType("INTEGER"); + + b.Property("PunktUntenID") + .HasColumnType("INTEGER"); + + b.Property("SewerType") + .HasColumnType("INTEGER"); + + b.Property("StrasseName") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("BaustelleID"); + + b.HasIndex("PunktObenID"); + + b.HasIndex("PunktUntenID"); + + b.ToTable("Kanaele"); + }); + + modelBuilder.Entity("KanSan.Base.Models.SewerPoint", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("Objektnummer") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("SewerPoints"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Baustelle", b => + { + b.HasOne("KanSan.Base.Models.Projekt", "Projekt") + .WithMany() + .HasForeignKey("ProjektID"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Projekt", b => + { + b.HasOne("KanSan.Base.Models.Kunde", "Kunde") + .WithMany("Baustellen") + .HasForeignKey("KundeID"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Sewer", b => + { + b.HasOne("KanSan.Base.Models.Baustelle", "Baustelle") + .WithMany("Kanaele") + .HasForeignKey("BaustelleID"); + + b.HasOne("KanSan.Base.Models.SewerPoint", "PunktOben") + .WithMany() + .HasForeignKey("PunktObenID"); + + b.HasOne("KanSan.Base.Models.SewerPoint", "PunktUnten") + .WithMany() + .HasForeignKey("PunktUntenID"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/KanSan.Base/Migrations/20200221084801_InitialCommit.cs b/KanSan.Base/Migrations/20200221084801_InitialCommit.cs new file mode 100644 index 0000000..53c0ee5 --- /dev/null +++ b/KanSan.Base/Migrations/20200221084801_InitialCommit.cs @@ -0,0 +1,171 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace KanSan.Base.Migrations +{ + public partial class InitialCommit : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Kunden", + columns: table => new + { + ID = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GuidNr = table.Column(nullable: false), + Vorname = table.Column(nullable: true), + Nachname = table.Column(nullable: true), + Strasse = table.Column(nullable: true), + PLZ = table.Column(nullable: true), + Ort = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Kunden", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "SewerPoints", + columns: table => new + { + ID = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GuidNr = table.Column(nullable: false), + Objektnummer = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_SewerPoints", x => x.ID); + }); + + migrationBuilder.CreateTable( + name: "Projekte", + columns: table => new + { + ID = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GuidNr = table.Column(nullable: false), + KundeID = table.Column(nullable: true), + Ort = table.Column(nullable: true), + Projektnummer = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Projekte", x => x.ID); + table.ForeignKey( + name: "FK_Projekte_Kunden_KundeID", + column: x => x.KundeID, + principalTable: "Kunden", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Baustelle", + columns: table => new + { + ID = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GuidNr = table.Column(nullable: false), + ProjektID = table.Column(nullable: true), + OrtTeil = table.Column(nullable: true), + BaustelleNummer = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Baustelle", x => x.ID); + table.ForeignKey( + name: "FK_Baustelle_Projekte_ProjektID", + column: x => x.ProjektID, + principalTable: "Projekte", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Kanaele", + columns: table => new + { + ID = table.Column(nullable: false) + .Annotation("Sqlite:Autoincrement", true), + GuidNr = table.Column(nullable: false), + BaustelleID = table.Column(nullable: true), + StrasseName = table.Column(nullable: true), + ObjektNummer = table.Column(nullable: true), + SewerType = table.Column(nullable: false), + PunktTypeOben = table.Column(nullable: false), + PunktObenID = table.Column(nullable: true), + PunktTypeUnten = table.Column(nullable: false), + PunktUntenID = table.Column(nullable: true), + DN = table.Column(nullable: false), + Material = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Kanaele", x => x.ID); + table.ForeignKey( + name: "FK_Kanaele_Baustelle_BaustelleID", + column: x => x.BaustelleID, + principalTable: "Baustelle", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Kanaele_SewerPoints_PunktObenID", + column: x => x.PunktObenID, + principalTable: "SewerPoints", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Kanaele_SewerPoints_PunktUntenID", + column: x => x.PunktUntenID, + principalTable: "SewerPoints", + principalColumn: "ID", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_Baustelle_ProjektID", + table: "Baustelle", + column: "ProjektID"); + + migrationBuilder.CreateIndex( + name: "IX_Kanaele_BaustelleID", + table: "Kanaele", + column: "BaustelleID"); + + migrationBuilder.CreateIndex( + name: "IX_Kanaele_PunktObenID", + table: "Kanaele", + column: "PunktObenID"); + + migrationBuilder.CreateIndex( + name: "IX_Kanaele_PunktUntenID", + table: "Kanaele", + column: "PunktUntenID"); + + migrationBuilder.CreateIndex( + name: "IX_Projekte_KundeID", + table: "Projekte", + column: "KundeID"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Kanaele"); + + migrationBuilder.DropTable( + name: "Baustelle"); + + migrationBuilder.DropTable( + name: "SewerPoints"); + + migrationBuilder.DropTable( + name: "Projekte"); + + migrationBuilder.DropTable( + name: "Kunden"); + } + } +} diff --git a/KanSan.Base/Migrations/KanSanContextModelSnapshot.cs b/KanSan.Base/Migrations/KanSanContextModelSnapshot.cs index 4ef9261..57e9a9d 100644 --- a/KanSan.Base/Migrations/KanSanContextModelSnapshot.cs +++ b/KanSan.Base/Migrations/KanSanContextModelSnapshot.cs @@ -22,26 +22,23 @@ namespace KanSan.Base.Migrations .ValueGeneratedOnAdd() .HasColumnType("INTEGER"); + b.Property("BaustelleNummer") + .HasColumnType("TEXT"); + b.Property("GuidNr") .HasColumnType("TEXT"); - b.Property("KundeID") + b.Property("OrtTeil") + .HasColumnType("TEXT"); + + b.Property("ProjektID") .HasColumnType("INTEGER"); - b.Property("Ort") - .HasColumnType("TEXT"); - - b.Property("Projektnummer") - .HasColumnType("TEXT"); - - b.Property("Strasse") - .HasColumnType("TEXT"); - b.HasKey("ID"); - b.HasIndex("KundeID"); + b.HasIndex("ProjektID"); - b.ToTable("Baustellen"); + b.ToTable("Baustelle"); }); modelBuilder.Entity("KanSan.Base.Models.Kunde", b => @@ -73,12 +70,126 @@ namespace KanSan.Base.Migrations b.ToTable("Kunden"); }); + modelBuilder.Entity("KanSan.Base.Models.Projekt", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("KundeID") + .HasColumnType("INTEGER"); + + b.Property("Ort") + .HasColumnType("TEXT"); + + b.Property("Projektnummer") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("KundeID"); + + b.ToTable("Projekte"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Sewer", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("BaustelleID") + .HasColumnType("INTEGER"); + + b.Property("DN") + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("Material") + .HasColumnType("INTEGER"); + + b.Property("ObjektNummer") + .HasColumnType("TEXT"); + + b.Property("PunktObenID") + .HasColumnType("INTEGER"); + + b.Property("PunktTypeOben") + .HasColumnType("INTEGER"); + + b.Property("PunktTypeUnten") + .HasColumnType("INTEGER"); + + b.Property("PunktUntenID") + .HasColumnType("INTEGER"); + + b.Property("SewerType") + .HasColumnType("INTEGER"); + + b.Property("StrasseName") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.HasIndex("BaustelleID"); + + b.HasIndex("PunktObenID"); + + b.HasIndex("PunktUntenID"); + + b.ToTable("Kanaele"); + }); + + modelBuilder.Entity("KanSan.Base.Models.SewerPoint", b => + { + b.Property("ID") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("GuidNr") + .HasColumnType("TEXT"); + + b.Property("Objektnummer") + .HasColumnType("TEXT"); + + b.HasKey("ID"); + + b.ToTable("SewerPoints"); + }); + modelBuilder.Entity("KanSan.Base.Models.Baustelle", b => + { + b.HasOne("KanSan.Base.Models.Projekt", "Projekt") + .WithMany() + .HasForeignKey("ProjektID"); + }); + + modelBuilder.Entity("KanSan.Base.Models.Projekt", b => { b.HasOne("KanSan.Base.Models.Kunde", "Kunde") .WithMany("Baustellen") .HasForeignKey("KundeID"); }); + + modelBuilder.Entity("KanSan.Base.Models.Sewer", b => + { + b.HasOne("KanSan.Base.Models.Baustelle", "Baustelle") + .WithMany("Kanaele") + .HasForeignKey("BaustelleID"); + + b.HasOne("KanSan.Base.Models.SewerPoint", "PunktOben") + .WithMany() + .HasForeignKey("PunktObenID"); + + b.HasOne("KanSan.Base.Models.SewerPoint", "PunktUnten") + .WithMany() + .HasForeignKey("PunktUntenID"); + }); #pragma warning restore 612, 618 } } diff --git a/KanSan.Base/Models/Baustelle.cs b/KanSan.Base/Models/Baustelle.cs index 8a6b39c..843d4e0 100644 --- a/KanSan.Base/Models/Baustelle.cs +++ b/KanSan.Base/Models/Baustelle.cs @@ -1,14 +1,17 @@ -using System; +using KanSan.Base.Interfaces; +using System; using System.Collections.Generic; using System.Text; namespace KanSan.Base.Models { - public class Baustelle : DatenbankClass + public class Baustelle : IDatabaseEntry { - public Kunde Kunde { get; set; } - public string Ort { get; set; } - public string Strasse { get; set; } - public string Projektnummer { get; set; } + public int ID { get; set; } + public Guid GuidNr { get; set; } + public Projekt Projekt { get; set; } + public string OrtTeil { get; set; } + public string BaustelleNummer { get; set; } + public List Kanaele { get; } = new List(); } } diff --git a/KanSan.Base/Models/DatenbankClass.cs b/KanSan.Base/Models/DatenbankClass.cs deleted file mode 100644 index 4a71bf0..0000000 --- a/KanSan.Base/Models/DatenbankClass.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace KanSan.Base.Models -{ - public class DatenbankClass - { - public int ID { get; set; } - public Guid GuidNr { get; set; } - } -} diff --git a/KanSan.Base/Models/Kunde.cs b/KanSan.Base/Models/Kunde.cs index 14df31f..92e7492 100644 --- a/KanSan.Base/Models/Kunde.cs +++ b/KanSan.Base/Models/Kunde.cs @@ -1,17 +1,20 @@ -using System; +using KanSan.Base.Interfaces; +using System; using System.Collections.Generic; using System.Text; namespace KanSan.Base.Models { - public class Kunde : DatenbankClass + public class Kunde : IDatabaseEntry { + public int ID { get; set; } + public Guid GuidNr { get; set; } public string Vorname { get; set; } public string Nachname { get; set; } public string Strasse { get; set; } public string PLZ { get; set; } public string Ort { get; set; } - public List Baustellen { get; } = new List(); + public List Baustellen { get; } = new List(); } } diff --git a/KanSan.Base/Models/Projekt.cs b/KanSan.Base/Models/Projekt.cs new file mode 100644 index 0000000..dc824aa --- /dev/null +++ b/KanSan.Base/Models/Projekt.cs @@ -0,0 +1,16 @@ +using KanSan.Base.Interfaces; +using System; +using System.Collections.Generic; +using System.Text; + +namespace KanSan.Base.Models +{ + public class Projekt : IDatabaseEntry + { + public int ID { get; set; } + public Guid GuidNr { get; set; } + public Kunde Kunde { get; set; } + public string Ort { get; set; } + public string Projektnummer { get; set; } + } +} diff --git a/KanSan.Base/Models/Sewer.cs b/KanSan.Base/Models/Sewer.cs new file mode 100644 index 0000000..2a50cf8 --- /dev/null +++ b/KanSan.Base/Models/Sewer.cs @@ -0,0 +1,22 @@ +using KanSan.Base.Enums; +using KanSan.Base.Interfaces; +using System; + +namespace KanSan.Base.Models +{ + public class Sewer : IDatabaseEntry + { + public int ID { get; set; } + public Guid GuidNr { get; set; } + public Baustelle Baustelle { get; set; } + public string StrasseName { get; set; } + public string ObjektNummer { get; set; } + public EPunktType SewerType { get; set; } + public EPunktType PunktTypeOben { get; set; } + public SewerPoint PunktOben { get; set; } + public EPunktType PunktTypeUnten { get; set; } + public SewerPoint PunktUnten { get; set; } + public int DN { get; set; } + public EMaterial Material { get; set; } + } +} diff --git a/KanSan.Base/Models/SewerPoint.cs b/KanSan.Base/Models/SewerPoint.cs new file mode 100644 index 0000000..9d6d785 --- /dev/null +++ b/KanSan.Base/Models/SewerPoint.cs @@ -0,0 +1,12 @@ +using KanSan.Base.Interfaces; +using System; + +namespace KanSan.Base.Models +{ + public class SewerPoint : IDatabaseEntry + { + public int ID { get; set; } + public Guid GuidNr { get; set; } + public string Objektnummer { get; set; } + } +} diff --git a/KanSan.Base/UnitOfWork.cs b/KanSan.Base/UnitOfWork.cs index 8a0ae1f..d4ad271 100644 --- a/KanSan.Base/UnitOfWork.cs +++ b/KanSan.Base/UnitOfWork.cs @@ -9,7 +9,7 @@ namespace KanSan.Base public class UnitOfWork : IUnitOfWork { private KanSanContext _dbContext; - private BaseRepository _baustellen; + private BaseRepository _baustellen; private BaseRepository _kunden; public UnitOfWork(KanSanContext dbContext) @@ -17,11 +17,11 @@ namespace KanSan.Base _dbContext = dbContext; } - public IRepository BaustellenRepository + public IRepository BaustellenRepository { get { - return _baustellen ?? (_baustellen = new BaseRepository(_dbContext)); + return _baustellen ?? (_baustellen = new BaseRepository(_dbContext)); } } diff --git a/KanSan/ViewModel/BaustelleViewModel.cs b/KanSan/ViewModel/BaustelleViewModel.cs index 7fa9a6d..e336aab 100644 --- a/KanSan/ViewModel/BaustelleViewModel.cs +++ b/KanSan/ViewModel/BaustelleViewModel.cs @@ -12,7 +12,7 @@ namespace KanSan.ViewModel { class BaustelleViewModel : PropertyChangedClass,INotifyPropertyChanged { - private Baustelle _baustelle; + private Projekt _baustelle; IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext()); private string ort;