EF core added

This commit is contained in:
Damian Wessels
2023-01-14 12:20:47 +01:00
parent 12fa97bc28
commit 1c4f581f28
24 changed files with 719 additions and 53 deletions

View File

@@ -58,7 +58,7 @@ namespace SanSystem
} }
else if (san is KlassenBIB.SchachtAnbindung) else if (san is KlassenBIB.SchachtAnbindung)
{ {
string sourceDirectory = san.CheckVerzeichnisse(Global.Instance.Projektpfad); /*string sourceDirectory = san.CheckVerzeichnisse(Global.Instance.Projektpfad);
SchachtAnbindung fotoDokumentation = (san as SchachtAnbindung); SchachtAnbindung fotoDokumentation = (san as SchachtAnbindung);
KlassenBIB.Collections.Bilder fotos = fotoDokumentation.SavedBilders; KlassenBIB.Collections.Bilder fotos = fotoDokumentation.SavedBilders;
foreach (SavedBilder foto in fotos) foreach (SavedBilder foto in fotos)
@@ -70,6 +70,7 @@ namespace SanSystem
File.Copy(foto.Speicherpfad, Path.Combine(tempPath, destinationName)); File.Copy(foto.Speicherpfad, Path.Combine(tempPath, destinationName));
} }
*/
} }
} }

View File

@@ -25,26 +25,30 @@ namespace SanSystem
InitializeComponent(); InitializeComponent();
} }
private bool project_already_excist(string projektnummer)
{
return Datenbank.Instance.TeufelDB.Projekte.FindAll(x => x.Nummer.Equals(projektnummer)).Count > 0;
}
private void btn_save_Click(object sender, EventArgs e) private void btn_save_Click(object sender, EventArgs e)
{ {
if(project_already_excist(txt_pro_nr.Text)) using (var context = new SanVerwalterContext())
{ {
MessageBox.Show(string.Format("Projekt mit den nummer {0} excistiert bereits. Projekt wird nicht angelegt", txt_pro_nr.Text)); if (project_already_exist(context, txt_pro_nr.Text))
return; {
MessageBox.Show(string.Format("Projekt mit den nummer {0} excistiert bereits. Projekt wird nicht angelegt", txt_pro_nr.Text));
return;
}
Projekt projekt = new Projekt();
projekt.Nummer = txt_pro_nr.Text;
projekt.Ort = txt_ort.Text;
context.Projekte.Add(projekt);
context.SaveChanges();
} }
Projekt projekt = new Projekt();
projekt.Nummer = txt_pro_nr.Text;
projekt.Ort = txt_ort.Text;
Global.Instance.SetProjekt(projekt);
this.Close(); this.Close();
//Global.Instance.ChangeProjekt(txt_pro_nr.Text); //Global.Instance.ChangeProjekt(txt_pro_nr.Text);
} }
private bool project_already_exist(SanVerwalterContext context, string text)
{
return context.Projekte.Count(x => x.Nummer.Equals(text)) > 0;
}
private void txt_pro_nr_KeyPress(object sender, KeyPressEventArgs e) private void txt_pro_nr_KeyPress(object sender, KeyPressEventArgs e)
{ {
if(e.KeyChar == '/' || e.KeyChar == '\\') if(e.KeyChar == '/' || e.KeyChar == '\\')

View File

@@ -95,18 +95,6 @@ namespace SanSystem
} }
} }
internal void SetProjekt(Projekt projekt)
{
Database.Datenbank.Instance.SaveProjekt();
this.ProjektNummer = projekt.Nummer;
Database.Datenbank.Instance.loadedProjekt = null;
Database.Datenbank.Instance.LoadProjekt(projekt.Nummer);
if (!Directory.Exists(Projektpfad)) Directory.CreateDirectory(Projektpfad);
Database.Datenbank.Instance.TeufelDB.Projekte.Add(projekt);
Database.Datenbank.Instance.InitProjekt(projekt, Projektpfad);
}
public string Projektpfad public string Projektpfad
{ {
get get

View File

@@ -10,7 +10,7 @@ namespace KlassenBIB
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class Auftraggeber :IAuftraggeber public class Auftraggeber : DBModel, IAuftraggeber
{ {
/// <summary> /// <summary>
/// ///

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace KlassenBIB
{
public abstract class DBModel
{
public int Id { get; set; }
}
}

View File

@@ -1,6 +1,7 @@
using SanShared; using SanShared;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -11,11 +12,11 @@ namespace KlassenBIB
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class Inspektionsobjekt public class Inspektionsobjekt: DBModel
{ {
private string strasseName = "none"; private string strasseName = "none";
public IAuftraggeber OverrideAuftraggeber { get; set; } public Auftraggeber OverrideAuftraggeber { get; set; }
public bool GeschlossenesEnde { get; set; } public bool GeschlossenesEnde { get; set; }
public string StrasseName { get => strasseName; set => strasseName = value; } public string StrasseName { get => strasseName; set => strasseName = value; }
@@ -42,25 +43,26 @@ namespace KlassenBIB
public DateTime HaltungGemessen { get; set; } public DateTime HaltungGemessen { get; set; }
public Collections.Inspektionskuerzeln Schadenskuerzeln { get; set; } //public Collections.Inspektionskuerzeln Schadenskuerzeln { get; set; }
public string Bemerkung { get; set; } public string Bemerkung { get; set; }
[NotMapped]
public Collections.Sanierung Sanierung { get;set; } public Collections.Sanierung Sanierung { get;set; }
public Collections.AusgefuehrteTaetigkeiten AusgefuehrteTaetigkeiten { get; set; } //public Collections.AusgefuehrteTaetigkeiten AusgefuehrteTaetigkeiten { get; set; }
public string Inspektionsrichtung { get; set; } public string Inspektionsrichtung { get; set; }
public string Sanierungsnummer { get; set; } public string Sanierungsnummer { get; set; }
public Guid Guid { get; set; }
public Inspektionsobjekt() public Inspektionsobjekt()
{ {
Schadenskuerzeln = new Collections.Inspektionskuerzeln(); //Schadenskuerzeln = new Collections.Inspektionskuerzeln();
Sanierung = new Collections.Sanierung(); Sanierung = new Collections.Sanierung();
AusgefuehrteTaetigkeiten = new Collections.AusgefuehrteTaetigkeiten(); //AusgefuehrteTaetigkeiten = new Collections.AusgefuehrteTaetigkeiten();
if (HaltungGemessen <= DateTime.MinValue || HaltungGemessen >= DateTime.MaxValue) HaltungGemessen = DateTime.Now; if (HaltungGemessen <= DateTime.MinValue || HaltungGemessen >= DateTime.MaxValue) HaltungGemessen = DateTime.Now;
} }
} }

View File

@@ -8,12 +8,12 @@ using System.Windows.Markup;
namespace KlassenBIB namespace KlassenBIB
{ {
public class Projekt :IProjekt public class Projekt: DBModel //:IProjekt
{ {
public string Nummer { get; set; } public string Nummer { get; set; }
public string Ort { get; set; } public string Ort { get; set; }
public IAuftraggeber Auftraggeber { get; set; } public Auftraggeber Auftraggeber { get; set; }
public Collections.Leistungsverzeichnis Leistungsverzeichnis { get; set; } //public Collections.Leistungsverzeichnis Leistungsverzeichnis { get; set; }
public Collections.AbwasserTechnischeAnlage Objekte { get; set; } public Collections.AbwasserTechnischeAnlage Objekte { get; set; }
public string SanierungsIDPrefix { get; set; } public string SanierungsIDPrefix { get; set; }
public string SanierungsIDSuffix { get; set; } public string SanierungsIDSuffix { get; set; }
@@ -23,7 +23,7 @@ namespace KlassenBIB
public Projekt() public Projekt()
{ {
Objekte = new Collections.AbwasserTechnischeAnlage(); Objekte = new Collections.AbwasserTechnischeAnlage();
Leistungsverzeichnis = new Collections.Leistungsverzeichnis(); //Leistungsverzeichnis = new Collections.Leistungsverzeichnis();
Auftraggeber = new Auftraggeber(); Auftraggeber = new Auftraggeber();
} }
} }

View File

@@ -51,7 +51,7 @@ namespace KlassenBIB
return haltungslaenge * harzbedarf; return haltungslaenge * harzbedarf;
} }
public override string CheckVerzeichnisse(string projektpfad) public string CheckVerzeichnisse(string projektpfad)
{ {
string path = Path.Combine(projektpfad, PfadZurSan); string path = Path.Combine(projektpfad, PfadZurSan);
if (!Directory.Exists(path)) Directory.CreateDirectory(path); if (!Directory.Exists(path)) Directory.CreateDirectory(path);

View File

@@ -32,7 +32,7 @@ namespace KlassenBIB
/// </summary> /// </summary>
/// <param name="projektpfad"></param> /// <param name="projektpfad"></param>
/// <returns></returns> /// <returns></returns>
public override string CheckVerzeichnisse(string projektpfad) public string CheckVerzeichnisse(string projektpfad)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }

View File

@@ -10,7 +10,7 @@ namespace KlassenBIB
{ {
[EditorBrowsable(EditorBrowsableState.Never)] [EditorBrowsable(EditorBrowsableState.Never)]
[Browsable(false)] [Browsable(false)]
public abstract class Sanierung : INotifyPropertyChanged public class Sanierung : INotifyPropertyChanged
{ {
Guid guid; Guid guid;
double tempAusen; double tempAusen;
@@ -37,7 +37,7 @@ namespace KlassenBIB
} }
public abstract string CheckVerzeichnisse(string projektpfad); //public string CheckVerzeichnisse(string projektpfad);
public Guid Guid { get => guid; set => guid = value; } public Guid Guid { get => guid; set => guid = value; }

View File

@@ -37,7 +37,7 @@ namespace KlassenBIB
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public override string CheckVerzeichnisse(string projektpfad) public string CheckVerzeichnisse(string projektpfad)
{ {
string path = Path.Combine(projektpfad, PfadZurSan); string path = Path.Combine(projektpfad, PfadZurSan);
if (!Directory.Exists(path)) Directory.CreateDirectory(path); if (!Directory.Exists(path)) Directory.CreateDirectory(path);

View File

@@ -0,0 +1,226 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SanSystem;
#nullable disable
namespace SanSystem.Migrations
{
[DbContext(typeof(SanVerwalterContext))]
[Migration("20230114101006_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.0");
modelBuilder.Entity("KlassenBIB.Auftraggeber", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Ansprechpartner")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Auftraggebers");
});
modelBuilder.Entity("KlassenBIB.Inspektionsobjekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bemerkung")
.HasColumnType("TEXT");
b.Property<string>("BisPunkt")
.HasColumnType("TEXT");
b.Property<bool>("GeschlossenesEnde")
.HasColumnType("INTEGER");
b.Property<Guid>("Guid")
.HasColumnType("TEXT");
b.Property<DateTime>("HaltungGemessen")
.HasColumnType("TEXT");
b.Property<double>("Haltungslaenge")
.HasColumnType("REAL");
b.Property<string>("Hausnummer")
.HasColumnType("TEXT");
b.Property<string>("Inspektionsrichtung")
.HasColumnType("TEXT");
b.Property<uint>("Kanalrohrweite")
.HasColumnType("INTEGER");
b.Property<string>("Objektbezeichnung")
.HasColumnType("TEXT");
b.Property<string>("OrtName")
.HasColumnType("TEXT");
b.Property<int?>("OverrideAuftraggeberId")
.HasColumnType("INTEGER");
b.Property<int?>("ProjektId")
.HasColumnType("INTEGER");
b.Property<string>("Projektnummer")
.HasColumnType("TEXT");
b.Property<string>("RohrMaterial")
.HasColumnType("TEXT");
b.Property<string>("Sanierungsnummer")
.HasColumnType("TEXT");
b.Property<double>("Schachtlaenge")
.HasColumnType("REAL");
b.Property<string>("StrasseName")
.HasColumnType("TEXT");
b.Property<string>("VonPunkt")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("OverrideAuftraggeberId");
b.HasIndex("ProjektId");
b.ToTable("InspektionObjekte");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("AuftraggeberId")
.HasColumnType("INTEGER");
b.Property<string>("Nummer")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("SanierungsIDPrefix")
.HasColumnType("TEXT");
b.Property<string>("SanierungsIDSuffix")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
b.ToTable("Projekte");
});
modelBuilder.Entity("KlassenBIB.Sanierung", b =>
{
b.Property<bool>("GenehmigungVorhanden")
.HasColumnType("INTEGER");
b.Property<Guid>("Guid")
.HasColumnType("TEXT");
b.Property<bool>("HDReinigung")
.HasColumnType("INTEGER");
b.Property<DateTime>("HDReinigungDatum")
.HasColumnType("TEXT");
b.Property<int?>("InspektionsobjektId")
.HasColumnType("INTEGER");
b.Property<bool>("STVOAbsicherung")
.HasColumnType("INTEGER");
b.Property<double>("TempAusen")
.HasColumnType("REAL");
b.Property<double>("TempKanal")
.HasColumnType("REAL");
b.Property<bool>("VorbereitetMechanisch")
.HasColumnType("INTEGER");
b.Property<bool>("VorbereitetRoboter")
.HasColumnType("INTEGER");
b.Property<bool>("WasserhaltungEingerichtet")
.HasColumnType("INTEGER");
b.Property<string>("Wetter")
.HasColumnType("TEXT");
b.HasIndex("InspektionsobjektId");
b.ToTable("Sanierung");
});
modelBuilder.Entity("KlassenBIB.Inspektionsobjekt", b =>
{
b.HasOne("KlassenBIB.Auftraggeber", "OverrideAuftraggeber")
.WithMany()
.HasForeignKey("OverrideAuftraggeberId");
b.HasOne("KlassenBIB.Projekt", null)
.WithMany("Objekte")
.HasForeignKey("ProjektId");
b.Navigation("OverrideAuftraggeber");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.HasOne("KlassenBIB.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId");
b.Navigation("Auftraggeber");
});
modelBuilder.Entity("KlassenBIB.Sanierung", b =>
{
b.HasOne("KlassenBIB.Inspektionsobjekt", "Inspektionsobjekt")
.WithMany()
.HasForeignKey("InspektionsobjektId");
b.Navigation("Inspektionsobjekt");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.Navigation("Objekte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,153 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace SanSystem.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Auftraggebers",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(type: "TEXT", nullable: true),
Strasse = table.Column<string>(type: "TEXT", nullable: true),
Ort = table.Column<string>(type: "TEXT", nullable: true),
Ansprechpartner = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Auftraggebers", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Projekte",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Nummer = table.Column<string>(type: "TEXT", nullable: true),
Ort = table.Column<string>(type: "TEXT", nullable: true),
AuftraggeberId = table.Column<int>(type: "INTEGER", nullable: true),
SanierungsIDPrefix = table.Column<string>(type: "TEXT", nullable: true),
SanierungsIDSuffix = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Projekte", x => x.Id);
table.ForeignKey(
name: "FK_Projekte_Auftraggebers_AuftraggeberId",
column: x => x.AuftraggeberId,
principalTable: "Auftraggebers",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "InspektionObjekte",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
OverrideAuftraggeberId = table.Column<int>(type: "INTEGER", nullable: true),
GeschlossenesEnde = table.Column<bool>(type: "INTEGER", nullable: false),
StrasseName = table.Column<string>(type: "TEXT", nullable: true),
OrtName = table.Column<string>(type: "TEXT", nullable: true),
Hausnummer = table.Column<string>(type: "TEXT", nullable: true),
Projektnummer = table.Column<string>(type: "TEXT", nullable: true),
Objektbezeichnung = table.Column<string>(type: "TEXT", nullable: true),
VonPunkt = table.Column<string>(type: "TEXT", nullable: true),
BisPunkt = table.Column<string>(type: "TEXT", nullable: true),
RohrMaterial = table.Column<string>(type: "TEXT", nullable: true),
Kanalrohrweite = table.Column<uint>(type: "INTEGER", nullable: false),
Haltungslaenge = table.Column<double>(type: "REAL", nullable: false),
Schachtlaenge = table.Column<double>(type: "REAL", nullable: false),
HaltungGemessen = table.Column<DateTime>(type: "TEXT", nullable: false),
Bemerkung = table.Column<string>(type: "TEXT", nullable: true),
Inspektionsrichtung = table.Column<string>(type: "TEXT", nullable: true),
Sanierungsnummer = table.Column<string>(type: "TEXT", nullable: true),
Guid = table.Column<Guid>(type: "TEXT", nullable: false),
ProjektId = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_InspektionObjekte", x => x.Id);
table.ForeignKey(
name: "FK_InspektionObjekte_Auftraggebers_OverrideAuftraggeberId",
column: x => x.OverrideAuftraggeberId,
principalTable: "Auftraggebers",
principalColumn: "Id");
table.ForeignKey(
name: "FK_InspektionObjekte_Projekte_ProjektId",
column: x => x.ProjektId,
principalTable: "Projekte",
principalColumn: "Id");
});
migrationBuilder.CreateTable(
name: "Sanierung",
columns: table => new
{
Guid = table.Column<Guid>(type: "TEXT", nullable: false),
TempAusen = table.Column<double>(type: "REAL", nullable: false),
TempKanal = table.Column<double>(type: "REAL", nullable: false),
Wetter = table.Column<string>(type: "TEXT", nullable: true),
GenehmigungVorhanden = table.Column<bool>(type: "INTEGER", nullable: false),
WasserhaltungEingerichtet = table.Column<bool>(type: "INTEGER", nullable: false),
STVOAbsicherung = table.Column<bool>(type: "INTEGER", nullable: false),
HDReinigung = table.Column<bool>(type: "INTEGER", nullable: false),
HDReinigungDatum = table.Column<DateTime>(type: "TEXT", nullable: false),
InspektionsobjektId = table.Column<int>(type: "INTEGER", nullable: true),
VorbereitetMechanisch = table.Column<bool>(type: "INTEGER", nullable: false),
VorbereitetRoboter = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.ForeignKey(
name: "FK_Sanierung_InspektionObjekte_InspektionsobjektId",
column: x => x.InspektionsobjektId,
principalTable: "InspektionObjekte",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_InspektionObjekte_OverrideAuftraggeberId",
table: "InspektionObjekte",
column: "OverrideAuftraggeberId");
migrationBuilder.CreateIndex(
name: "IX_InspektionObjekte_ProjektId",
table: "InspektionObjekte",
column: "ProjektId");
migrationBuilder.CreateIndex(
name: "IX_Projekte_AuftraggeberId",
table: "Projekte",
column: "AuftraggeberId");
migrationBuilder.CreateIndex(
name: "IX_Sanierung_InspektionsobjektId",
table: "Sanierung",
column: "InspektionsobjektId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Sanierung");
migrationBuilder.DropTable(
name: "InspektionObjekte");
migrationBuilder.DropTable(
name: "Projekte");
migrationBuilder.DropTable(
name: "Auftraggebers");
}
}
}

View File

@@ -0,0 +1,224 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using SanSystem;
#nullable disable
namespace SanSystem.Migrations
{
[DbContext(typeof(SanVerwalterContext))]
partial class SanVerwalterContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "6.0.0");
modelBuilder.Entity("KlassenBIB.Auftraggeber", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Ansprechpartner")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("Strasse")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Auftraggebers");
});
modelBuilder.Entity("KlassenBIB.Inspektionsobjekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Bemerkung")
.HasColumnType("TEXT");
b.Property<string>("BisPunkt")
.HasColumnType("TEXT");
b.Property<bool>("GeschlossenesEnde")
.HasColumnType("INTEGER");
b.Property<Guid>("Guid")
.HasColumnType("TEXT");
b.Property<DateTime>("HaltungGemessen")
.HasColumnType("TEXT");
b.Property<double>("Haltungslaenge")
.HasColumnType("REAL");
b.Property<string>("Hausnummer")
.HasColumnType("TEXT");
b.Property<string>("Inspektionsrichtung")
.HasColumnType("TEXT");
b.Property<uint>("Kanalrohrweite")
.HasColumnType("INTEGER");
b.Property<string>("Objektbezeichnung")
.HasColumnType("TEXT");
b.Property<string>("OrtName")
.HasColumnType("TEXT");
b.Property<int?>("OverrideAuftraggeberId")
.HasColumnType("INTEGER");
b.Property<int?>("ProjektId")
.HasColumnType("INTEGER");
b.Property<string>("Projektnummer")
.HasColumnType("TEXT");
b.Property<string>("RohrMaterial")
.HasColumnType("TEXT");
b.Property<string>("Sanierungsnummer")
.HasColumnType("TEXT");
b.Property<double>("Schachtlaenge")
.HasColumnType("REAL");
b.Property<string>("StrasseName")
.HasColumnType("TEXT");
b.Property<string>("VonPunkt")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("OverrideAuftraggeberId");
b.HasIndex("ProjektId");
b.ToTable("InspektionObjekte");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int?>("AuftraggeberId")
.HasColumnType("INTEGER");
b.Property<string>("Nummer")
.HasColumnType("TEXT");
b.Property<string>("Ort")
.HasColumnType("TEXT");
b.Property<string>("SanierungsIDPrefix")
.HasColumnType("TEXT");
b.Property<string>("SanierungsIDSuffix")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("AuftraggeberId");
b.ToTable("Projekte");
});
modelBuilder.Entity("KlassenBIB.Sanierung", b =>
{
b.Property<bool>("GenehmigungVorhanden")
.HasColumnType("INTEGER");
b.Property<Guid>("Guid")
.HasColumnType("TEXT");
b.Property<bool>("HDReinigung")
.HasColumnType("INTEGER");
b.Property<DateTime>("HDReinigungDatum")
.HasColumnType("TEXT");
b.Property<int?>("InspektionsobjektId")
.HasColumnType("INTEGER");
b.Property<bool>("STVOAbsicherung")
.HasColumnType("INTEGER");
b.Property<double>("TempAusen")
.HasColumnType("REAL");
b.Property<double>("TempKanal")
.HasColumnType("REAL");
b.Property<bool>("VorbereitetMechanisch")
.HasColumnType("INTEGER");
b.Property<bool>("VorbereitetRoboter")
.HasColumnType("INTEGER");
b.Property<bool>("WasserhaltungEingerichtet")
.HasColumnType("INTEGER");
b.Property<string>("Wetter")
.HasColumnType("TEXT");
b.HasIndex("InspektionsobjektId");
b.ToTable("Sanierung");
});
modelBuilder.Entity("KlassenBIB.Inspektionsobjekt", b =>
{
b.HasOne("KlassenBIB.Auftraggeber", "OverrideAuftraggeber")
.WithMany()
.HasForeignKey("OverrideAuftraggeberId");
b.HasOne("KlassenBIB.Projekt", null)
.WithMany("Objekte")
.HasForeignKey("ProjektId");
b.Navigation("OverrideAuftraggeber");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.HasOne("KlassenBIB.Auftraggeber", "Auftraggeber")
.WithMany()
.HasForeignKey("AuftraggeberId");
b.Navigation("Auftraggeber");
});
modelBuilder.Entity("KlassenBIB.Sanierung", b =>
{
b.HasOne("KlassenBIB.Inspektionsobjekt", "Inspektionsobjekt")
.WithMany()
.HasForeignKey("InspektionsobjektId");
b.Navigation("Inspektionsobjekt");
});
modelBuilder.Entity("KlassenBIB.Projekt", b =>
{
b.Navigation("Objekte");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -18,6 +18,7 @@ namespace SanSystem
[STAThread] [STAThread]
static void Main() static void Main()
{ {
new Mutex(initiallyOwned: true, "SanVerwaltung", out bool result); new Mutex(initiallyOwned: true, "SanVerwaltung", out bool result);
if(!result) if(!result)
{ {

View File

@@ -18,13 +18,30 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.0" />
<PackageReference Include="Syncfusion.Chart.Windows" Version="20.4.0.43" /> <PackageReference Include="Syncfusion.Chart.Windows" Version="20.4.0.43" />
<PackageReference Include="Syncfusion.DocIO.WinForms" Version="20.4.0.43" /> <PackageReference Include="Syncfusion.DocIO.WinForms" Version="20.4.0.43" />
<PackageReference Include="Syncfusion.DocToPDFConverter.WinForms" Version="20.4.0.43" /> <PackageReference Include="Syncfusion.DocToPDFConverter.WinForms" Version="20.4.0.43" />
<PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.50.5271.500" /> <PackageReference Include="Wibu.CodeMeter.WibuCmNET" Version="7.50.5271.500" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Update="SanVerwaltung.db">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="SanVerwaltung.db-shm">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="SanVerwaltung.db-wal">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent"> <Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="git rev-parse HEAD &gt; &quot;$(ProjectDir)\version.txt&quot;" /> <Exec Command="git rev-parse HEAD &gt; &quot;$(ProjectDir)\version.txt&quot;" />
</Target> </Target>

View File

@@ -0,0 +1,32 @@
using KlassenBIB;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SanSystem
{
public class SanVerwalterContext : DbContext
{
public DbSet<Projekt> Projekte { get; set; }
public DbSet<Inspektionsobjekt> InspektionObjekte { get; set; }
public DbSet<Sanierung> Sanierung { get; set; }
public DbSet<Auftraggeber> Auftraggebers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite("Data Source=SanVerwaltung.db");
base.OnConfiguring(optionsBuilder);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Sanierung>().HasNoKey();
base.OnModelCreating(modelBuilder);
}
}
}

BIN
SanSystem/SanVerwaltung.db Normal file

Binary file not shown.

View File

@@ -188,7 +188,7 @@ namespace SchnittstelleImporter
inspektionskuerzelns.Add(inspektionskuerzeln); inspektionskuerzelns.Add(inspektionskuerzeln);
} }
inspektionsobjekt.Schadenskuerzeln = inspektionskuerzelns; //inspektionsobjekt.Schadenskuerzeln = inspektionskuerzelns;
result.Add(inspektionsobjekt); result.Add(inspektionsobjekt);
} }

View File

@@ -319,7 +319,7 @@ namespace SanSystem
{ {
MessageBox.Show("Warnung, es wurden keine Daten von der Anlage geladen, Grafik konnte nicht erstellt werden"); MessageBox.Show("Warnung, es wurden keine Daten von der Anlage geladen, Grafik konnte nicht erstellt werden");
} }
Hashtable hashtable = inliner.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt,inliner.Offset); Hashtable hashtable = new Hashtable(); //inliner.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt,inliner.Offset);
DirectoryInfo directory = Directory.GetParent(destinationPath); DirectoryInfo directory = Directory.GetParent(destinationPath);
string speicherpfad = directory.FullName; string speicherpfad = directory.FullName;
speicherpfad = Path.Combine(speicherpfad, "Einbauprotokolle"); speicherpfad = Path.Combine(speicherpfad, "Einbauprotokolle");

View File

@@ -331,10 +331,10 @@ namespace SanSystem
} }
} }
string destinationPath = san.CheckVerzeichnisse(Global.Instance.Projektpfad); string destinationPath = san.CheckVerzeichnisse(Global.Instance.Projektpfad);
Hashtable hashtable = san.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt, DateTime.MinValue); //Hashtable hashtable = san.MakeProtokoll(destinationPath, Database.Datenbank.Instance.loadedProjekt, DateTime.MinValue);
DirectoryInfo directory = Directory.GetParent(destinationPath); DirectoryInfo directory = Directory.GetParent(destinationPath);
string speicherpfad = Path.Combine(directory.FullName,"Einbauprotokolle"); string speicherpfad = Path.Combine(directory.FullName,"Einbauprotokolle");
BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("JUME", "liner_einbauBlueLight.docx", speicherpfad, san.Inspektionsobjekt.Objektbezeichnung, hashtable, bilder,null,true); //BerichtGen.FrmOptions options = new BerichtGen.FrmOptions("JUME", "liner_einbauBlueLight.docx", speicherpfad, san.Inspektionsobjekt.Objektbezeichnung, hashtable, bilder,null,true);
} }
//options.ShowDialog(); //options.ShowDialog();

View File

@@ -40,8 +40,8 @@ namespace SanSystem
tabControl1.TabPages.RemoveAt(2); tabControl1.TabPages.RemoveAt(2);
tabControl1.TabPages.RemoveAt(1); tabControl1.TabPages.RemoveAt(1);
#endif #endif
dgv_schadenkuerzel.DataSource = inspektion.Schadenskuerzeln; //dgv_schadenkuerzel.DataSource = inspektion.Schadenskuerzeln;
dgv_sanierungen.DataSource = inspektion.AusgefuehrteTaetigkeiten; //dgv_sanierungen.DataSource = inspektion.AusgefuehrteTaetigkeiten;
foreach(Sanierung san in inspektion.Sanierung) foreach(Sanierung san in inspektion.Sanierung)
{ {
@@ -283,7 +283,7 @@ namespace SanSystem
private void FrmAuftraggeberEdit_FormClosed(object sender, FormClosedEventArgs e) private void FrmAuftraggeberEdit_FormClosed(object sender, FormClosedEventArgs e)
{ {
inspektionsobjekt.OverrideAuftraggeber = (sender as frmAuftraggeberEdit).Auftraggeber; //inspektionsobjekt.OverrideAuftraggeber = (sender as frmAuftraggeberEdit).Auftraggeber;
} }
} }

View File

@@ -189,7 +189,7 @@ namespace SanSystem
private void btn_add_Click(object sender, EventArgs e) private void btn_add_Click(object sender, EventArgs e)
{ {
Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt(); Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt();
inspektionsobjekt.Guid = Guid.NewGuid(); //inspektionsobjekt.Guid = Guid.NewGuid();
inspektionsobjekt.Projektnummer = inspektionsobjekte.First().Projektnummer; inspektionsobjekt.Projektnummer = inspektionsobjekte.First().Projektnummer;
inspektionsobjekt.OrtName = inspektionsobjekte.First().OrtName; inspektionsobjekt.OrtName = inspektionsobjekte.First().OrtName;
inspektionsobjekt.StrasseName = inspektionsobjekte.First().StrasseName; inspektionsobjekt.StrasseName = inspektionsobjekte.First().StrasseName;

View File

@@ -47,6 +47,7 @@ namespace SanSystem
private void buildSortedSteetList() private void buildSortedSteetList()
{ {
List<string> ortteile = Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.OrtName).Distinct().ToList(); List<string> ortteile = Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.OrtName).Distinct().ToList();
int aktuellOpened = -1; int aktuellOpened = -1;
bool aktuelleStrasse = false; bool aktuelleStrasse = false;
@@ -109,7 +110,8 @@ namespace SanSystem
} }
private void buildUnsortedStreetList() private void buildUnsortedStreetList()
{ {
List<string> strassen = Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.StrasseName).Distinct().ToList(); List<string> strassen = Datenbank.Instance.loadedProjekt.Objekte.Select(x => x.StrasseName).Distinct().ToList();
List<string> streets = new List<string>(); List<string> streets = new List<string>();
@@ -129,6 +131,9 @@ namespace SanSystem
private void frmStrassenList_Load(object sender, EventArgs e) private void frmStrassenList_Load(object sender, EventArgs e)
{ {
this.Height = this.MdiParent.Height - 120; this.Height = this.MdiParent.Height - 120;
if(streetListSetting.SortedSelected()) if(streetListSetting.SortedSelected())
{ {