diff --git a/Database/Database.csproj b/Database/Database.csproj
index e68fd1a..f3787ec 100644
--- a/Database/Database.csproj
+++ b/Database/Database.csproj
@@ -47,6 +47,7 @@
+
diff --git a/Database/Datenbank.cs b/Database/Datenbank.cs
index e409062..edfbadf 100644
--- a/Database/Datenbank.cs
+++ b/Database/Datenbank.cs
@@ -54,6 +54,8 @@ namespace Database
}
else
loadedProjekt = new KlassenBIB.Projekt();
+
+ UpdateDatabase.UpdateNewGuids();
return true;
}
diff --git a/Database/UpdateDatabase.cs b/Database/UpdateDatabase.cs
new file mode 100644
index 0000000..e934827
--- /dev/null
+++ b/Database/UpdateDatabase.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Database
+{
+ class UpdateDatabase
+ {
+ public static void UpdateNewGuids()
+ {
+ if (Datenbank.Instance.loadedProjekt == null) return;
+ foreach(var entries in Datenbank.Instance.loadedProjekt.Objekte)
+ {
+
+ if(entries.Guid.Equals(Guid.Empty))
+ entries.Guid = Guid.NewGuid();
+
+
+ foreach(var sanierungen in entries.Sanierung)
+ {
+ if (sanierungen.Guid.Equals(Guid.Empty))
+ sanierungen.Guid = Guid.NewGuid();
+ }
+ }
+ return;
+ }
+ }
+}
diff --git a/KlassenBIB/Inspektionsobjekt.cs b/KlassenBIB/Inspektionsobjekt.cs
index f080799..17bbc08 100644
--- a/KlassenBIB/Inspektionsobjekt.cs
+++ b/KlassenBIB/Inspektionsobjekt.cs
@@ -81,6 +81,10 @@ namespace KlassenBIB
///
///
///
+ public Guid Guid { get; set; }
+ ///
+ ///
+ ///
public Inspektionsobjekt()
{
Schadenskuerzeln = new InspektionskuerzelnCollection();
diff --git a/KlassenBIB/Sanieren.cs b/KlassenBIB/Sanieren.cs
index 141ac23..37c5bd5 100644
--- a/KlassenBIB/Sanieren.cs
+++ b/KlassenBIB/Sanieren.cs
@@ -11,7 +11,7 @@ namespace KlassenBIB
///
public abstract class Sanieren : Sanierung
{
- Guid guid;
+
DateTime datum = new DateTime();
bool fertig = false;
string verzeichnispfad;
@@ -22,10 +22,6 @@ namespace KlassenBIB
///
///
///
- public Guid Guid { get => guid; set => guid = value; }
- ///
- ///
- ///
public DateTime Datum { get => datum; set => datum = value; }
///
///
diff --git a/KlassenBIB/Sanierung.cs b/KlassenBIB/Sanierung.cs
index c99d0b2..3663f21 100644
--- a/KlassenBIB/Sanierung.cs
+++ b/KlassenBIB/Sanierung.cs
@@ -18,7 +18,7 @@ namespace KlassenBIB
[Browsable(false)]
public abstract class Sanierung : INotifyPropertyChanged
{
- //Guid guid;
+ Guid guid;
double tempAusen;
double tempKanal;
string wetter;
@@ -53,7 +53,10 @@ namespace KlassenBIB
///
///
public abstract string CheckVerzeichnisse(string projektpfad);
- //public Guid Guid { get => guid; set => guid = value; }
+ ///
+ ///
+ ///
+ public Guid Guid { get => guid; set => guid = value; }
///
///
///
diff --git a/SanSystem/frmObjektEdit.Designer.cs b/SanSystem/frmObjektEdit.Designer.cs
index 9f64654..c95bcb7 100644
--- a/SanSystem/frmObjektEdit.Designer.cs
+++ b/SanSystem/frmObjektEdit.Designer.cs
@@ -373,6 +373,7 @@
this.txt_punkt_bis.Name = "txt_punkt_bis";
this.txt_punkt_bis.Size = new System.Drawing.Size(330, 30);
this.txt_punkt_bis.TabIndex = 4;
+ this.txt_punkt_bis.Leave += new System.EventHandler(this.Txt_punkt_bis_Leave);
//
// txt_punkt_von
//
@@ -466,6 +467,7 @@
this.dgv_schadenkuerzel.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgv_schadenkuerzel.Location = new System.Drawing.Point(6, 6);
this.dgv_schadenkuerzel.Name = "dgv_schadenkuerzel";
+ this.dgv_schadenkuerzel.RowHeadersWidth = 51;
this.dgv_schadenkuerzel.Size = new System.Drawing.Size(1268, 269);
this.dgv_schadenkuerzel.TabIndex = 0;
this.dgv_schadenkuerzel.RowHeaderMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dgv_schadenkuerzel_RowHeaderMouseDoubleClick);
diff --git a/SanSystem/frmObjektEdit.cs b/SanSystem/frmObjektEdit.cs
index 8a232e8..4f8bfa6 100644
--- a/SanSystem/frmObjektEdit.cs
+++ b/SanSystem/frmObjektEdit.cs
@@ -20,15 +20,16 @@ namespace SanSystem
public partial class frmObjektEdit : Form
{
Inspektionsobjekt inspektionsobjekt = null;
+ private bool neu = false;
///
///
///
///
- public frmObjektEdit(Inspektionsobjekt inspektion)
+ public frmObjektEdit(Inspektionsobjekt inspektion, bool neu = false)
{
InitializeComponent();
-
+ this.neu = neu;
btn_add_san.Text = Global.Instance.language.Labels["add_san"];
btn_close.Text = Global.Instance.language.Labels["btn_close"];
@@ -213,5 +214,13 @@ namespace SanSystem
//frmSanKonzept.MdiParent = this.MdiParent;
frmSanKonzept.ShowDialog();
}
+
+ private void Txt_punkt_bis_Leave(object sender, EventArgs e)
+ {
+ if (!neu) return;
+ // Prüfen ob dieser Element bereits vorhanden ist
+ if (Datenbank.Instance.loadedProjekt.Objekte.Exists(x => x.BisPunkt.Equals(txt_punkt_bis.Text)))
+ txt_punkt_bis.BackColor = Color.Red;
+ }
}
}
diff --git a/SanSystem/frmObjekteList.cs b/SanSystem/frmObjekteList.cs
index 2261cd1..bd813b5 100644
--- a/SanSystem/frmObjekteList.cs
+++ b/SanSystem/frmObjekteList.cs
@@ -182,12 +182,13 @@ namespace SanSystem
private void btn_add_Click(object sender, EventArgs e)
{
Inspektionsobjekt inspektionsobjekt = new Inspektionsobjekt();
+ inspektionsobjekt.Guid = Guid.NewGuid();
inspektionsobjekt.Projektnummer = inspektionsobjekte.First().Projektnummer;
inspektionsobjekt.OrtName = inspektionsobjekte.First().OrtName;
inspektionsobjekt.StrasseName = inspektionsobjekte.First().StrasseName;
Datenbank.Instance.loadedProjekt.Objekte.Add(inspektionsobjekt);
- frmObjektEdit frmObjektEdit = new frmObjektEdit(inspektionsobjekt);
+ frmObjektEdit frmObjektEdit = new frmObjektEdit(inspektionsobjekt,true);
frmObjektEdit.FormClosed += FrmObjektEdit_FormClosed;
frmObjektEdit.ShowDialog();
}