MainWindow geändert, dynamische Menu erzeugt
This commit is contained in:
@@ -4,11 +4,12 @@ using KanSan.Base.Interfaces.UI;
|
||||
using KanSan.Base.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text;
|
||||
|
||||
namespace KanSan.ViewModel
|
||||
{
|
||||
public class ObjekteEditViewModel : IObjekteEditViewModel
|
||||
public class ObjekteEditViewModel : PropertyChangedClass,IObjekteEditViewModel, INotifyPropertyChanged
|
||||
{
|
||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||
string strassename;
|
||||
@@ -17,15 +18,127 @@ namespace KanSan.ViewModel
|
||||
string punktUnten;
|
||||
int durchmesser;
|
||||
string material;
|
||||
bool rohrleitungInBetrieb;
|
||||
bool wasserHaltungdurchgefuehrt;
|
||||
bool haltungGespuelt;
|
||||
bool genehmigungErforderlich;
|
||||
bool baustellenAbsicherung;
|
||||
|
||||
private Sewer objekt;
|
||||
|
||||
public string StrasseName { get => strassename; set => throw new NotImplementedException(); }
|
||||
public string Objektnummer { get => objektnummer; set => throw new NotImplementedException(); }
|
||||
public string PunktOben { get => punktOben; set => throw new NotImplementedException(); }
|
||||
public string PunktUnten { get => punktUnten; set => throw new NotImplementedException(); }
|
||||
public int Durchmesser { get => durchmesser; set => throw new NotImplementedException(); }
|
||||
public string Material { get => material; set => throw new NotImplementedException(); }
|
||||
#region gettersetters
|
||||
public string StrasseName
|
||||
{
|
||||
get => strassename;
|
||||
set
|
||||
{
|
||||
if (strassename == value) return;
|
||||
strassename = value;
|
||||
OnPropertyChanged();
|
||||
|
||||
}
|
||||
}
|
||||
public string Objektnummer
|
||||
{
|
||||
get => objektnummer;
|
||||
set
|
||||
{
|
||||
if (objektnummer == value) return;
|
||||
objektnummer = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string PunktOben
|
||||
{
|
||||
get => punktOben;
|
||||
set
|
||||
{
|
||||
if (punktOben == value) return;
|
||||
punktOben = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string PunktUnten
|
||||
{
|
||||
get => punktUnten;
|
||||
set
|
||||
{
|
||||
if (punktUnten == value) return;
|
||||
punktUnten = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public int Durchmesser
|
||||
{
|
||||
get => durchmesser;
|
||||
set
|
||||
{
|
||||
if (durchmesser == value) return;
|
||||
durchmesser = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public string Material
|
||||
{
|
||||
get => material;
|
||||
set
|
||||
{
|
||||
if (material == value) return;
|
||||
material = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool RohrleitungInBetrieb
|
||||
{
|
||||
get => rohrleitungInBetrieb;
|
||||
set
|
||||
{
|
||||
if (rohrleitungInBetrieb == value) return;
|
||||
rohrleitungInBetrieb = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool WasserHaltungDurchgefuehrt
|
||||
{
|
||||
get => wasserHaltungdurchgefuehrt;
|
||||
set
|
||||
{
|
||||
if (wasserHaltungdurchgefuehrt == value) return;
|
||||
wasserHaltungdurchgefuehrt = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool HaltungGespuelt
|
||||
{
|
||||
get => haltungGespuelt;
|
||||
set
|
||||
{
|
||||
if (haltungGespuelt == value) return;
|
||||
haltungGespuelt = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool GenehmigungErforderlich
|
||||
{
|
||||
get => genehmigungErforderlich;
|
||||
set
|
||||
{
|
||||
if (genehmigungErforderlich == value) return;
|
||||
genehmigungErforderlich = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public bool BaustellenAbsicherung
|
||||
{
|
||||
get => baustellenAbsicherung;
|
||||
set
|
||||
{
|
||||
if (baustellenAbsicherung == value) return;
|
||||
baustellenAbsicherung = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
public ObjekteEditViewModel(Sewer sewer)
|
||||
{
|
||||
@@ -36,12 +149,22 @@ namespace KanSan.ViewModel
|
||||
objektnummer = objekt.ObjektNummer;
|
||||
durchmesser = objekt.DN;
|
||||
material = objekt.Material.ToString();
|
||||
rohrleitungInBetrieb = objekt.RohrleitungInBetrieb;
|
||||
wasserHaltungdurchgefuehrt = objekt.WasserHaltungDurchgefuehrt;
|
||||
haltungGespuelt = objekt.HaltungGespuelt;
|
||||
genehmigungErforderlich = objekt.GenehmigungErforderlich;
|
||||
baustellenAbsicherung = objekt.BaustellensicherungErforderlich;
|
||||
}
|
||||
|
||||
public void Speichern()
|
||||
{
|
||||
objekt.StrasseName = strassename;
|
||||
objekt.DN = durchmesser;
|
||||
objekt.RohrleitungInBetrieb = rohrleitungInBetrieb;
|
||||
objekt.WasserHaltungDurchgefuehrt = wasserHaltungdurchgefuehrt;
|
||||
objekt.BaustellensicherungErforderlich = baustellenAbsicherung;
|
||||
objekt.HaltungGespuelt = haltungGespuelt;
|
||||
objekt.GenehmigungErforderlich = genehmigungErforderlich;
|
||||
|
||||
unitOfWork.KanaeleRepository.Update(objekt);
|
||||
unitOfWork.Commit();
|
||||
|
||||
Reference in New Issue
Block a user