diff --git a/KlassenBIB/InlinerSanierung.cs b/KlassenBIB/InlinerSanierung.cs index a656cea..ae27ed2 100644 --- a/KlassenBIB/InlinerSanierung.cs +++ b/KlassenBIB/InlinerSanierung.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -28,11 +29,22 @@ namespace KlassenBIB { return haltungslaenge * harzbedarf; } - + + public override string CheckVerzeichnisse(string projektpfad) + { + string path = Path.Combine(projektpfad, PfadZurSan); + if (!Directory.Exists(path)) Directory.CreateDirectory(path); + + string mypath = Path.Combine(path, Verzeichnispfad); + if (!Directory.Exists(mypath)) Directory.CreateDirectory(mypath); + + return mypath; + } public InlinerSanierung() { //datumKalibrierung = new DateTime(); + Verzeichnispfad = "UVAnlage"; if (datumKalibrierung <= DateTime.MinValue || datumKalibrierung >= DateTime.MaxValue) datumKalibrierung = DateTime.Now; } diff --git a/KlassenBIB/KlassenBIB.csproj b/KlassenBIB/KlassenBIB.csproj index 53d1c5f..0860559 100644 --- a/KlassenBIB/KlassenBIB.csproj +++ b/KlassenBIB/KlassenBIB.csproj @@ -51,6 +51,7 @@ + \ No newline at end of file diff --git a/KlassenBIB/Sanieren.cs b/KlassenBIB/Sanieren.cs index 1fe5557..784a57e 100644 --- a/KlassenBIB/Sanieren.cs +++ b/KlassenBIB/Sanieren.cs @@ -11,9 +11,11 @@ namespace KlassenBIB Guid guid; DateTime? datum; bool fertig = false; + string verzeichnispfad; public Guid Guid { get => guid; set => guid = value; } public DateTime? Datum { get => datum; set => datum = value; } public bool Fertig { get => fertig; set => fertig = value; } + public string Verzeichnispfad { get => verzeichnispfad; protected set => verzeichnispfad = value; } } } diff --git a/KlassenBIB/Sanierung.cs b/KlassenBIB/Sanierung.cs index 1211bf5..26e7570 100644 --- a/KlassenBIB/Sanierung.cs +++ b/KlassenBIB/Sanierung.cs @@ -11,6 +11,8 @@ namespace KlassenBIB // // Zusammenfassung: // Bietet die grundlegene Struktur für eine Sanierung + [EditorBrowsable(EditorBrowsableState.Never)] + [Browsable(false)] public abstract class Sanierung : INotifyPropertyChanged { //Guid guid; @@ -23,8 +25,19 @@ namespace KlassenBIB bool hDReinigung; DateTime hDReinigungDatum; //DateTime sanierungsDatum; - + Inspektionsobjekt inspektionsobjekt; + protected string pfadZurSan; + [Browsable(false)] + public Sanierung() + { + //if (inspektionsobjekt == null) return; + //pfadZurSan = string.Format(); + + + } + + public abstract string CheckVerzeichnisse(string projektpfad); //public Guid Guid { get => guid; set => guid = value; } public double TempAusen { @@ -46,8 +59,15 @@ namespace KlassenBIB public bool STVOAbsicherung { get => sTVOAbsicherung; set => sTVOAbsicherung = value; } public bool HDReinigung { get => hDReinigung; set => hDReinigung = value; } public DateTime HDReinigungDatum { get => hDReinigungDatum; set => hDReinigungDatum = value; } + public Inspektionsobjekt Inspektionsobjekt { get => inspektionsobjekt; set => inspektionsobjekt = value; } + protected string PfadZurSan { + get + { + return string.Format("{0}-{1}", Inspektionsobjekt.VonPunkt, Inspektionsobjekt.BisPunkt); + } + } //public DateTime SanierungsDatum { get => sanierungsDatum; set => sanierungsDatum = value; } - + public event PropertyChangedEventHandler PropertyChanged; private void NotifyPropertyChanged([CallerMemberName] string propertyName = null) { diff --git a/KlassenBIB/SchachtAnbindung.cs b/KlassenBIB/SchachtAnbindung.cs new file mode 100644 index 0000000..4f29d7f --- /dev/null +++ b/KlassenBIB/SchachtAnbindung.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace KlassenBIB +{ + public class SchachtAnbindung : Sanieren + { + public SchachtAnbindung() + { + Verzeichnispfad = "Schachtanbindung"; + } + + public override string CheckVerzeichnisse(string projektpfad) + { + string path = Path.Combine(projektpfad, PfadZurSan); + if (!Directory.Exists(path)) Directory.CreateDirectory(path); + + string mypath = Path.Combine(path, Verzeichnispfad); + if (!Directory.Exists(mypath)) Directory.CreateDirectory(mypath); + + return mypath; + } + } +} diff --git a/SanSystem/Global.cs b/SanSystem/Global.cs index 4f68c38..fc7e332 100644 --- a/SanSystem/Global.cs +++ b/SanSystem/Global.cs @@ -11,6 +11,7 @@ namespace SanSystem { public static readonly Global instance = new Global(); + public string projektpfad = "temp"; public ILanguage language = null; public static Global Instance @@ -21,6 +22,8 @@ namespace SanSystem } } + + public void LoadLanguage() { language = Language.Language.GetLanguage(Language.BUILTINLANGUAGES.GERMAN); diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index 0ad1f7b..9b2ddcf 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -22,6 +22,7 @@ namespace SanSystem LINERGRUNDLAGEN } InlinerSanierung inliner = null; + string destinationPath = string.Empty; public UCInliner(InlinerSanierung san) { InitializeComponent(); @@ -60,6 +61,7 @@ namespace SanSystem private void UCInliner_Load(object sender, EventArgs e) { + CheckDirectories(); cb_genehmigung.DataBindings.Clear(); cb_stvo.DataBindings.Clear(); cb_wasserhaltung.DataBindings.Clear(); @@ -76,7 +78,7 @@ namespace SanSystem cb_genehmigung.DataBindings.Add(new Binding("Checked", inliner, "genehmigungVorhanden")); cb_stvo.DataBindings.Add(new Binding("Checked", inliner, "sTVOAbsicherung")); cb_wasserhaltung.DataBindings.Add(new Binding("Checked", inliner, "wasserhaltungEingerichtet")); - txt_temp_aussen.DataBindings.Add(new Binding("Text", inliner, "TempAusen", false, DataSourceUpdateMode.OnPropertyChanged)); + txt_temp_aussen.DataBindings.Add(new Binding("Text", inliner, "TempAusen")); txt_temp_kanal.DataBindings.Add(new Binding("Text", inliner, "TempKanal")); } @@ -98,9 +100,7 @@ namespace SanSystem private void CheckDirectories() { - string verzeichnispfad = string.Format("{0}-{1}") - string path = Path.Combine("") - if(!Directory.Exists()) + destinationPath = inliner.CheckVerzeichnisse(Global.Instance.projektpfad); } } } diff --git a/SanSystem/frmObjektEdit.cs b/SanSystem/frmObjektEdit.cs index f0e5f41..44253e0 100644 --- a/SanSystem/frmObjektEdit.cs +++ b/SanSystem/frmObjektEdit.cs @@ -37,6 +37,12 @@ namespace SanSystem tab.Controls.Add(uCInliner); tabControl1.TabPages.Add(tab); } + else if(san is SchachtAnbindung) + { + tab.Text = "Schachtanbindung"; + + tabControl1.TabPages.Add(tab); + } } @@ -86,10 +92,22 @@ namespace SanSystem FrmSelectNewSan frmSelectNewSan = new FrmSelectNewSan(); frmSelectNewSan.AddInlinerClicked += FrmSelectNewSan_AddInlinerClicked; + frmSelectNewSan.AddSchachtAnbindungClicked += FrmSelectNewSan_AddSchachtAnbindungClicked; frmSelectNewSan.ShowDialog(); } + private void FrmSelectNewSan_AddSchachtAnbindungClicked(object sender, EventArgs e) + { + SchachtAnbindung schachtAnbindung = new SchachtAnbindung(); + schachtAnbindung.Inspektionsobjekt = inspektionsobjekt; + inspektionsobjekt.Sanierung.Add(schachtAnbindung); + TabPage tab = new TabPage(); + tab.Text = "Schachtanbindung"; + + tabControl1.TabPages.Add(tab); + } + private void FrmSelectNewSan_AddInlinerClicked(object sender, EventArgs e) { if(inspektionsobjekt.Sanierung.Count > 0) @@ -104,6 +122,7 @@ namespace SanSystem } } InlinerSanierung san = new InlinerSanierung(); + san.Inspektionsobjekt = inspektionsobjekt; inspektionsobjekt.Sanierung.Add(san); TabPage tab = new TabPage(); tab.Text = "InlinerSanierung"; @@ -112,5 +131,7 @@ namespace SanSystem tab.Controls.Add(uCInliner); tabControl1.TabPages.Add(tab); } + + } }