Clients sind nicht mehr als oberste Prio
This commit is contained in:
@@ -8,6 +8,7 @@ namespace DaSaSo.Domain.Model
|
|||||||
{
|
{
|
||||||
public class Buildingsite : DomainObject
|
public class Buildingsite : DomainObject
|
||||||
{
|
{
|
||||||
|
public Client Client { get; set; }
|
||||||
public Project Project { get; set; }
|
public Project Project { get; set; }
|
||||||
public string BuildingSiteNumber { get; set; }
|
public string BuildingSiteNumber { get; set; }
|
||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace DaSaSo.Domain.Model
|
|||||||
public string Country { get; set; }
|
public string Country { get; set; }
|
||||||
public string Street { get; set; }
|
public string Street { get; set; }
|
||||||
public string Postcode { get; set; }
|
public string Postcode { get; set; }
|
||||||
public ICollection<Project> Projects { get; set; } = new List<Project>();
|
//public ICollection<Project> Projects { get; set; } = new List<Project>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace DaSaSo.Domain.Model
|
|||||||
{
|
{
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Projektnummer { get; set; }
|
public string Projektnummer { get; set; }
|
||||||
public Client Client { get; set; }
|
//public Client Client { get; set; }
|
||||||
public ICollection<Buildingsite> BuildingSites { get; set; } = new List<Buildingsite>();
|
public ICollection<Buildingsite> BuildingSites { get; set; } = new List<Buildingsite>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ namespace DaSaSo.Domain.Services.ProjectServices
|
|||||||
{
|
{
|
||||||
public interface IProjectService
|
public interface IProjectService
|
||||||
{
|
{
|
||||||
Task<Project> CreateProject(Client Auftraggeber);
|
Task<Project> CreateProject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,16 +16,18 @@ namespace DaSaSo.Domain.Services.ProjectServices
|
|||||||
_clientService = clientService;
|
_clientService = clientService;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Project> CreateProject(Client Auftraggeber)
|
public async Task<Project> CreateProject()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
Project project = new Project()
|
Project project = new Project()
|
||||||
{
|
{
|
||||||
Client = Auftraggeber
|
Client = Auftraggeber
|
||||||
};
|
};
|
||||||
|
*/
|
||||||
|
/*Auftraggeber.Projects.Add(project);
|
||||||
|
await _clientService.Update(Auftraggeber.Id, Auftraggeber);*/
|
||||||
|
|
||||||
Auftraggeber.Projects.Add(project);
|
return new Project();
|
||||||
await _clientService.Update(Auftraggeber.Id, Auftraggeber);
|
|
||||||
return project;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
386
DaSaSo.EntityFramework/Migrations/20211101090936_RemoveClientAsDomain.Designer.cs
generated
Normal file
386
DaSaSo.EntityFramework/Migrations/20211101090936_RemoveClientAsDomain.Designer.cs
generated
Normal file
@@ -0,0 +1,386 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using DaSaSo.EntityFramework;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DaSaSo.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(DaSaSoDbContext))]
|
||||||
|
[Migration("20211101090936_RemoveClientAsDomain")]
|
||||||
|
partial class RemoveClientAsDomain
|
||||||
|
{
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "6.0.0-rc.1.21452.10")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||||
|
|
||||||
|
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("BuildingSiteNumber")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("ContactPerson")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Country")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ProjectId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ProjectId");
|
||||||
|
|
||||||
|
b.ToTable("Buildingsites");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Client", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Country")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Firstname")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("LastName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Postcode")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Street")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Clients");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Impregnation", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("DN")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<bool>("IsAvaible")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<string>("LinerNumber")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<decimal>("Linerlength")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<string>("Number")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<decimal>("WallThickness")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Impregnations");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.PipeLiner", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<bool>("ClosedEnd")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<DateOnly>("Date")
|
||||||
|
.HasColumnType("date");
|
||||||
|
|
||||||
|
b.Property<int?>("ImpregnationId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<decimal>("InversionPressure")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<decimal>("LinerLength")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<string>("Operator")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("Preliner")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("PreparationType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<decimal>("TemperaturAssembly")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<decimal>("TemperaturStorage")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<decimal>("TemperatureOutdoors")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<decimal>("TemperatureSewer")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<string>("Weather")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ImpregnationId");
|
||||||
|
|
||||||
|
b.ToTable("PipeLiners");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Name")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Projektnummer")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Projects");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("DamageType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<decimal>("Distance")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<int?>("SewerObjectId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("SewerObjectId");
|
||||||
|
|
||||||
|
b.ToTable("SewerDamages");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int?>("BuildingSiteId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<bool>("BuildingsiteBarier")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int>("DN")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("Hausnummer")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("Material")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<string>("ObjektName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("PermitNeeded")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<int?>("PipeLinerId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktObenId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PunktObenType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int?>("PunktUntenId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<int>("PunktUntenType")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.Property<string>("SanNummer")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("SewerActivated")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<bool>("SewerCleaned")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.Property<decimal>("SewerLength")
|
||||||
|
.HasColumnType("numeric");
|
||||||
|
|
||||||
|
b.Property<string>("StreetName")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<bool>("WaterBarrier")
|
||||||
|
.HasColumnType("boolean");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("BuildingSiteId");
|
||||||
|
|
||||||
|
b.HasIndex("PipeLinerId");
|
||||||
|
|
||||||
|
b.HasIndex("PunktObenId");
|
||||||
|
|
||||||
|
b.HasIndex("PunktUntenId");
|
||||||
|
|
||||||
|
b.ToTable("SewerObjects");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerPoint", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("Objektnummer")
|
||||||
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("SewerPoints");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.Client", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.Project", "Project")
|
||||||
|
.WithMany("BuildingSites")
|
||||||
|
.HasForeignKey("ProjectId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Project");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.PipeLiner", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.Impregnation", "Impregnation")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ImpregnationId");
|
||||||
|
|
||||||
|
b.Navigation("Impregnation");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.SewerObject", "SewerObject")
|
||||||
|
.WithMany("SewerDamages")
|
||||||
|
.HasForeignKey("SewerObjectId");
|
||||||
|
|
||||||
|
b.Navigation("SewerObject");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.Buildingsite", "BuildingSite")
|
||||||
|
.WithMany("SewerObjects")
|
||||||
|
.HasForeignKey("BuildingSiteId");
|
||||||
|
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.PipeLiner", "PipeLiner")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PipeLinerId");
|
||||||
|
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktOben")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktObenId");
|
||||||
|
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.SewerPoint", "PunktUnten")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("PunktUntenId");
|
||||||
|
|
||||||
|
b.Navigation("BuildingSite");
|
||||||
|
|
||||||
|
b.Navigation("PipeLiner");
|
||||||
|
|
||||||
|
b.Navigation("PunktOben");
|
||||||
|
|
||||||
|
b.Navigation("PunktUnten");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("SewerObjects");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("BuildingSites");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerObject", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("SewerDamages");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace DaSaSo.EntityFramework.Migrations
|
||||||
|
{
|
||||||
|
public partial class RemoveClientAsDomain : Migration
|
||||||
|
{
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Projects_Clients_ClientId",
|
||||||
|
table: "Projects");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Projects_ClientId",
|
||||||
|
table: "Projects");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Projects");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateOnly>(
|
||||||
|
name: "Date",
|
||||||
|
table: "Impregnations",
|
||||||
|
type: "date",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateTime),
|
||||||
|
oldType: "timestamp with time zone");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Buildingsites",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Buildingsites_ClientId",
|
||||||
|
table: "Buildingsites",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Buildingsites_Clients_ClientId",
|
||||||
|
table: "Buildingsites",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Buildingsites_Clients_ClientId",
|
||||||
|
table: "Buildingsites");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Buildingsites_ClientId",
|
||||||
|
table: "Buildingsites");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Buildingsites");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Projects",
|
||||||
|
type: "integer",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<DateTime>(
|
||||||
|
name: "Date",
|
||||||
|
table: "Impregnations",
|
||||||
|
type: "timestamp with time zone",
|
||||||
|
nullable: false,
|
||||||
|
oldClrType: typeof(DateOnly),
|
||||||
|
oldType: "date");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Projects_ClientId",
|
||||||
|
table: "Projects",
|
||||||
|
column: "ClientId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Projects_Clients_ClientId",
|
||||||
|
table: "Projects",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,9 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
b.Property<string>("BuildingSiteNumber")
|
b.Property<string>("BuildingSiteNumber")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<int?>("ClientId")
|
||||||
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<string>("ContactPerson")
|
b.Property<string>("ContactPerson")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
@@ -44,6 +47,8 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
b.HasIndex("ProjectId");
|
b.HasIndex("ProjectId");
|
||||||
|
|
||||||
b.ToTable("Buildingsites");
|
b.ToTable("Buildingsites");
|
||||||
@@ -88,8 +93,8 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
b.Property<int>("DN")
|
b.Property<int>("DN")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
b.Property<DateTime>("Date")
|
b.Property<DateOnly>("Date")
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("date");
|
||||||
|
|
||||||
b.Property<bool>("IsAvaible")
|
b.Property<bool>("IsAvaible")
|
||||||
.HasColumnType("boolean");
|
.HasColumnType("boolean");
|
||||||
@@ -173,9 +178,6 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int?>("ClientId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
b.Property<string>("Name")
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
@@ -184,8 +186,6 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.ToTable("Projects");
|
b.ToTable("Projects");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -306,10 +306,16 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
|
modelBuilder.Entity("DaSaSo.Domain.Model.Buildingsite", b =>
|
||||||
{
|
{
|
||||||
|
b.HasOne("DaSaSo.Domain.Model.Client", "Client")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ClientId");
|
||||||
|
|
||||||
b.HasOne("DaSaSo.Domain.Model.Project", "Project")
|
b.HasOne("DaSaSo.Domain.Model.Project", "Project")
|
||||||
.WithMany("BuildingSites")
|
.WithMany("BuildingSites")
|
||||||
.HasForeignKey("ProjectId");
|
.HasForeignKey("ProjectId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
b.Navigation("Project");
|
b.Navigation("Project");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -322,15 +328,6 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
b.Navigation("Impregnation");
|
b.Navigation("Impregnation");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("DaSaSo.Domain.Model.Client", "Client")
|
|
||||||
.WithMany("Projects")
|
|
||||||
.HasForeignKey("ClientId");
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
|
modelBuilder.Entity("DaSaSo.Domain.Model.SewerDamage", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("DaSaSo.Domain.Model.SewerObject", "SewerObject")
|
b.HasOne("DaSaSo.Domain.Model.SewerObject", "SewerObject")
|
||||||
@@ -372,11 +369,6 @@ namespace DaSaSo.EntityFramework.Migrations
|
|||||||
b.Navigation("SewerObjects");
|
b.Navigation("SewerObjects");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("DaSaSo.Domain.Model.Client", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Projects");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
|
modelBuilder.Entity("DaSaSo.Domain.Model.Project", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("BuildingSites");
|
b.Navigation("BuildingSites");
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace DaSaSo.EntityFramework.Services
|
|||||||
public async Task<Client> Get(int id)
|
public async Task<Client> Get(int id)
|
||||||
{
|
{
|
||||||
using DaSaSoDbContext context = _contextFactory.CreateDbContext();
|
using DaSaSoDbContext context = _contextFactory.CreateDbContext();
|
||||||
Client entity = await context.Clients.Include(a => a.Projects).FirstOrDefaultAsync((e) => e.Id == id);
|
Client entity = await context.Clients.FirstOrDefaultAsync((e) => e.Id == id);
|
||||||
|
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,22 +41,16 @@ namespace DaSaSo.EntityFramework.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<Project>> GetAllByClient(Client client)
|
|
||||||
|
public async Task<IEnumerable<Project>> GetAll()
|
||||||
{
|
{
|
||||||
// Get Clientid
|
using(DaSaSoDbContext context = _contextFactory.CreateDbContext())
|
||||||
int id = client.Id;
|
|
||||||
using (DaSaSoDbContext context = _contextFactory.CreateDbContext())
|
|
||||||
{
|
{
|
||||||
IEnumerable<Project> entities = await context.Projects.Where(x => x.Client.Id == id).ToListAsync();
|
IEnumerable<Project> entities = await context.Projects.ToListAsync();
|
||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<IEnumerable<Project>> GetAll()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Project> Update(int id, Project entity)
|
public async Task<Project> Update(int id, Project entity)
|
||||||
{
|
{
|
||||||
return await _nonQueryDataService.Update(id, entity);
|
return await _nonQueryDataService.Update(id, entity);
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ namespace DaSaSo.ViewModel
|
|||||||
private readonly IDataService<Client> _dataService;
|
private readonly IDataService<Client> _dataService;
|
||||||
bool _isLoading = true;
|
bool _isLoading = true;
|
||||||
|
|
||||||
public ICommand SelectCommand { get; set; }
|
|
||||||
public ICommand EditCommand { get; set; }
|
public ICommand EditCommand { get; set; }
|
||||||
public ICommand AddNewClientCommand { get; set; }
|
public ICommand AddNewClientCommand { get; set; }
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ namespace DaSaSo.ViewModel
|
|||||||
_dataService = dataService;
|
_dataService = dataService;
|
||||||
|
|
||||||
LoadClient();
|
LoadClient();
|
||||||
SelectCommand = new SelectClientCommand(dataService,actualProject, this);
|
|
||||||
EditCommand = new EditClientCommand(_dataService,actualProject, editRenavigator, this);
|
EditCommand = new EditClientCommand(_dataService,actualProject, editRenavigator, this);
|
||||||
AddNewClientCommand = new AddClientCommand(_dataService, actualProject, editRenavigator, this);
|
AddNewClientCommand = new AddClientCommand(_dataService, actualProject, editRenavigator, this);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ namespace DaSaSo.ViewModel.Commands
|
|||||||
|
|
||||||
public override async Task ExecuteAsync(object? parameter)
|
public override async Task ExecuteAsync(object? parameter)
|
||||||
{
|
{
|
||||||
Project pro = await _projectService.CreateProject(_actualProject.AktuellClient);
|
Project pro = await _projectService.CreateProject();
|
||||||
_actualProject.SetProject(pro);
|
_actualProject.SetProject(pro);
|
||||||
_renavigator.Renavigate();
|
_renavigator.Renavigate();
|
||||||
|
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ namespace DaSaSo.ViewModel
|
|||||||
LoadProjecte();
|
LoadProjecte();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadProjecte()
|
public async void LoadProjecte()
|
||||||
{
|
{
|
||||||
InitCollection(Projekte, actualProject.AktuellClient.Projects);
|
var projects = await genericDataService.GetAll();
|
||||||
|
InitCollection(Projekte, projects);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitCollection(ObservableCollection<Project> target, IEnumerable<Project> source)
|
private void InitCollection(ObservableCollection<Project> target, IEnumerable<Project> source)
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ namespace DaSaSo.ViewModel
|
|||||||
private string _buildingsitename = "";
|
private string _buildingsitename = "";
|
||||||
private RegistryKey? registry;
|
private RegistryKey? registry;
|
||||||
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\DaSaSo";
|
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\DaSaSo";
|
||||||
public bool CanSelectProject { get => _actualProject.AktuellClient != null; }
|
|
||||||
public bool CanSelectBuildingSite { get => _actualProject.AktuellProjekt != null; }
|
public bool CanSelectBuildingSite { get => _actualProject.AktuellProjekt != null; }
|
||||||
public bool CanSelectSewerObjects { get => _actualProject.AktuellBaustelle != null; }
|
public bool CanSelectSewerObjects { get => _actualProject.AktuellBaustelle != null; }
|
||||||
|
|
||||||
@@ -137,7 +136,6 @@ namespace DaSaSo.ViewModel
|
|||||||
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
|
UpdateCurrentViewModelCommand = new UpdateCurrentViewModelCommand(navigator, viewModelFactory);
|
||||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Home);
|
||||||
_actualProject = actualProject;
|
_actualProject = actualProject;
|
||||||
_actualProject.ClientChanged += ActualProject_ClientChanged;
|
|
||||||
_actualProject.ProjectChanged += ActualProject_ProjectChanged;
|
_actualProject.ProjectChanged += ActualProject_ProjectChanged;
|
||||||
_actualProject.BuildingSiteChanged += ActualProject_BuildingSiteChanged;
|
_actualProject.BuildingSiteChanged += ActualProject_BuildingSiteChanged;
|
||||||
_actualProject.SewerObjectChanged += ActualProject_SewerObjectChanged;
|
_actualProject.SewerObjectChanged += ActualProject_SewerObjectChanged;
|
||||||
@@ -220,13 +218,5 @@ namespace DaSaSo.ViewModel
|
|||||||
OnPropertyChanged(nameof(CanSelectBuildingSite));
|
OnPropertyChanged(nameof(CanSelectBuildingSite));
|
||||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Buildingsites);
|
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Buildingsites);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActualProject_ClientChanged(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
SaveInRegistry("lastclient", _actualProject.AktuellClient.Id.ToString());
|
|
||||||
ClientName = _actualProject.AktuellClient.Firstname;
|
|
||||||
OnPropertyChanged(nameof(CanSelectProject));
|
|
||||||
UpdateCurrentViewModelCommand.Execute(EMainWindowViewType.Projects);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<RowDefinition Height="auto" />
|
<RowDefinition Height="auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<RadioButton Grid.Row="0" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ClientListViewModel}}" Content="Kunden" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="True" CommandParameter="{x:Static nav:EMainWindowViewType.Clients}"/>
|
<RadioButton Grid.Row="0" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ClientListViewModel}}" Content="Kunden" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="True" CommandParameter="{x:Static nav:EMainWindowViewType.Clients}"/>
|
||||||
<RadioButton Grid.Row="1" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjectListViewModel}}" Content="Projekte" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectProject}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" />
|
<RadioButton Grid.Row="1" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjectListViewModel}}" Content="Projekte" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" />
|
||||||
<RadioButton Grid.Row="2" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:BuildingsiteListViewModel}}" Content="Baustellen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectBuildingSite}" CommandParameter="{x:Static nav:EMainWindowViewType.Buildingsites}" />
|
<RadioButton Grid.Row="2" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:BuildingsiteListViewModel}}" Content="Baustellen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectBuildingSite}" CommandParameter="{x:Static nav:EMainWindowViewType.Buildingsites}" />
|
||||||
<RadioButton Grid.Row="3" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:SewerObjectListViewModel}}" Content="Objekten" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectSewerObjects}" CommandParameter="{x:Static nav:EMainWindowViewType.SewerObjects}" />
|
<RadioButton Grid.Row="3" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:SewerObjectListViewModel}}" Content="Objekten" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectSewerObjects}" CommandParameter="{x:Static nav:EMainWindowViewType.SewerObjects}" />
|
||||||
<RadioButton Grid.Row="4" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ImpregnierungListViewModel}}" Content="Imprägnierungen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Impregnierung}" />
|
<RadioButton Grid.Row="4" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ImpregnierungListViewModel}}" Content="Imprägnierungen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Impregnierung}" />
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
<StackPanel>
|
<StackPanel>
|
||||||
<TextBlock Text="Kundenliste" />
|
<TextBlock Text="Kundenliste" />
|
||||||
<ListView Margin="20" ItemsSource="{Binding Clients}" DisplayMemberPath="Firstname" SelectedItem="{Binding SelectedClient, Mode=TwoWay}"/>
|
<ListView Margin="20" ItemsSource="{Binding Clients}" DisplayMemberPath="Firstname" SelectedItem="{Binding SelectedClient, Mode=TwoWay}"/>
|
||||||
<Button Content="Kunde auswählen" Command="{Binding SelectCommand}" />
|
|
||||||
<Button Content="Kunde Editieren" Command="{Binding EditCommand}"/>
|
<Button Content="Kunde Editieren" Command="{Binding EditCommand}"/>
|
||||||
<Button Content="Kunde Hinzufügen" Command="{Binding AddNewClientCommand}" />
|
<Button Content="Kunde Hinzufügen" Command="{Binding AddNewClientCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
Reference in New Issue
Block a user