Compare commits
5 Commits
master
...
UmbauaufIC
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97fdc31e21 | ||
|
|
ade84e30e3 | ||
|
|
c66751ddc5 | ||
|
|
7911a44f2f | ||
|
|
3e9a353fc0 |
11
KanSan.Base/Interfaces/IDialogWindowService.cs
Normal file
11
KanSan.Base/Interfaces/IDialogWindowService.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base.Interfaces
|
||||||
|
{
|
||||||
|
public interface IDialogWindowService
|
||||||
|
{
|
||||||
|
void showWindow(object viewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ namespace KanSan.Base
|
|||||||
|
|
||||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseNpgsql("Host = localhost; Database = kanSan; Username = kansan; Password = kansan");
|
optionsBuilder.UseNpgsql("Host = 192.168.122.1; Database = kanSan; Username = kansan; Password = kansan");
|
||||||
//optionsBuilder.UseSqlite("Data Source=kansan.db");
|
//optionsBuilder.UseSqlite("Data Source=kansan.db");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
10
KanSan.Base/WindowService.cs
Normal file
10
KanSan.Base/WindowService.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.Base
|
||||||
|
{
|
||||||
|
class WindowService
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,16 +1,18 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class PropertyChangedClass
|
public class BaseViewModel
|
||||||
{
|
{
|
||||||
public event PropertyChangedEventHandler PropertyChanged;
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
protected internal void OnPropertyChanged([CallerMemberName] string propertyname = null)
|
protected internal void OnPropertyChanged([CallerMemberName] string propertyname = null)
|
||||||
{
|
{
|
||||||
|
Trace.WriteLine("OnPropertyChanged ()" + propertyname);
|
||||||
if (PropertyChanged != null)
|
if (PropertyChanged != null)
|
||||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyname));
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class BaustelleEditViewModel : PropertyChangedClass, INotifyPropertyChanged, IBaustelleEditViewModel
|
public class BaustelleEditViewModel : BaseViewModel, INotifyPropertyChanged, IBaustelleEditViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
private Baustelle baustelle;
|
private Baustelle baustelle;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class BaustellenListViewModel : IBaustelleListViewModel
|
public class BaustellenListViewModel :BaseViewModel, IBaustelleListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
private List<Baustelle> baustellen;
|
private List<Baustelle> baustellen;
|
||||||
|
|||||||
32
KanSan.ViewModel/Commands/RelayCommand.cs
Normal file
32
KanSan.ViewModel/Commands/RelayCommand.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.Mapping;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace KanSan.ViewModel.Commands
|
||||||
|
{
|
||||||
|
public class RelayCommand : ICommand
|
||||||
|
{
|
||||||
|
private Action<object> execute;
|
||||||
|
private Func<object, bool> canExecute;
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
|
||||||
|
public RelayCommand(Action<object> execute, Func<object, bool> canExecute = null)
|
||||||
|
{
|
||||||
|
this.execute = execute;
|
||||||
|
this.canExecute = canExecute;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanExecute(object parameter)
|
||||||
|
{
|
||||||
|
return this.canExecute == null || this.canExecute(parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute(object parameter)
|
||||||
|
{
|
||||||
|
this.execute(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,18 @@
|
|||||||
using KanSan.Base;
|
using KanSan.Base;
|
||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class KundenEditViewModel : PropertyChangedClass, INotifyPropertyChanged
|
public class KundenEditViewModel : BaseViewModel, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
@@ -20,6 +23,9 @@ namespace KanSan.ViewModel
|
|||||||
private string plz;
|
private string plz;
|
||||||
private string ort;
|
private string ort;
|
||||||
|
|
||||||
|
public ICommand SaveClient { get; set; }
|
||||||
|
public ICommand RemoveClient { get; set; }
|
||||||
|
|
||||||
#region getters
|
#region getters
|
||||||
public string Vorname
|
public string Vorname
|
||||||
{
|
{
|
||||||
@@ -88,11 +94,8 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public KundenEditViewModel(Kunde kunde = null)
|
public KundenEditViewModel(Kunde kunde)
|
||||||
{
|
{
|
||||||
if (kunde == null)
|
|
||||||
_kunde = unitOfWork.KundenRepository.Get().First();
|
|
||||||
else
|
|
||||||
_kunde = kunde;
|
_kunde = kunde;
|
||||||
|
|
||||||
vorname = _kunde.Vorname;
|
vorname = _kunde.Vorname;
|
||||||
@@ -100,10 +103,21 @@ namespace KanSan.ViewModel
|
|||||||
strasse = _kunde.Strasse;
|
strasse = _kunde.Strasse;
|
||||||
plz = _kunde.PLZ;
|
plz = _kunde.PLZ;
|
||||||
ort = _kunde.Ort;
|
ort = _kunde.Ort;
|
||||||
|
|
||||||
|
SaveClient = new RelayCommand(parameter => Speichern());
|
||||||
|
RemoveClient = new RelayCommand(parameter => Remove());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Speichern()
|
private void Remove()
|
||||||
{
|
{
|
||||||
|
unitOfWork.KundenRepository.Delete(_kunde);
|
||||||
|
unitOfWork.Commit();
|
||||||
|
Mediator.Notify("GoToListClientScreen");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Speichern()
|
||||||
|
{
|
||||||
|
Trace.WriteLine("Speichere");
|
||||||
_kunde.Vorname = Vorname;
|
_kunde.Vorname = Vorname;
|
||||||
_kunde.Nachname = Nachname;
|
_kunde.Nachname = Nachname;
|
||||||
_kunde.Strasse = Strasse;
|
_kunde.Strasse = Strasse;
|
||||||
@@ -112,6 +126,7 @@ namespace KanSan.ViewModel
|
|||||||
|
|
||||||
unitOfWork.KundenRepository.Update(_kunde);
|
unitOfWork.KundenRepository.Update(_kunde);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
|
Mediator.Notify("GoToListClientScreen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,19 +2,33 @@
|
|||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Interfaces.UI;
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class KundenListViewModel : IKundenListViewModel
|
public class KundenListViewModel : BaseViewModel, IKundenListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
private List<Kunde> kunden;
|
private List<Kunde> kunden;
|
||||||
|
|
||||||
|
private Kunde selectedKunde;
|
||||||
|
public Kunde SelectedKunde {
|
||||||
|
get { return selectedKunde; }
|
||||||
|
set {
|
||||||
|
selectedKunde = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public ICommand AddNewClientCommand { get; set; }
|
||||||
|
public ICommand EditClientCommand { get; set; }
|
||||||
|
public ICommand SelectClientCommand { get; set; }
|
||||||
|
|
||||||
public List<Kunde> Kunden
|
public List<Kunde> Kunden
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -26,22 +40,41 @@ namespace KanSan.ViewModel
|
|||||||
public KundenListViewModel()
|
public KundenListViewModel()
|
||||||
{
|
{
|
||||||
kunden = unitOfWork.KundenRepository.Get().ToList();
|
kunden = unitOfWork.KundenRepository.Get().ToList();
|
||||||
|
|
||||||
|
AddNewClientCommand = new RelayCommand(parameter => NewClient());
|
||||||
|
EditClientCommand = new RelayCommand(parameter => EditClient());
|
||||||
|
SelectClientCommand = new RelayCommand(parameter => SelectClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Kunde NeueKunde()
|
private void SelectClient()
|
||||||
{
|
{
|
||||||
Kunde result = new Kunde();
|
if (selectedKunde == null) return;
|
||||||
//result.ID = 1;
|
Mediator.Notify("ClientSelected", selectedKunde);
|
||||||
result.GuidNr = Guid.NewGuid();
|
}
|
||||||
|
|
||||||
|
private void NewClient()
|
||||||
|
{
|
||||||
|
Kunde newClient = NeueKunde();
|
||||||
|
Mediator.Notify("GoToEditClientScreen", newClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditClient()
|
||||||
|
{
|
||||||
|
if (SelectedKunde == null) return;
|
||||||
|
Mediator.Notify("GoToEditClientScreen",selectedKunde);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Kunde NeueKunde()
|
||||||
|
{
|
||||||
|
Kunde result = new Kunde()
|
||||||
|
{
|
||||||
|
GuidNr = Guid.NewGuid()
|
||||||
|
};
|
||||||
|
|
||||||
unitOfWork.KundenRepository.Insert(result);
|
unitOfWork.KundenRepository.Insert(result);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
//IEnumerable<Kunde> kunden = unitOfWork.KundenRepository.Get(d => d.GuidNr.Equals(result.GuidNr));
|
|
||||||
//if (kunden.Count() < 1)
|
|
||||||
// throw new Exception("Kunde konnte nicht gefunden werden");
|
|
||||||
|
|
||||||
//return kunden.First();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace KanSan.ViewModel
|
|||||||
public string Tag { get => tag; set => tag = value; }
|
public string Tag { get => tag; set => tag = value; }
|
||||||
public bool IsActiveInBaustelle { get => isActiveInBaustelle; set => isActiveInBaustelle = value; }
|
public bool IsActiveInBaustelle { get => isActiveInBaustelle; set => isActiveInBaustelle = value; }
|
||||||
}
|
}
|
||||||
public class LeistungsverzeichnisBaustelleViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
public class LeistungsverzeichnisBaustelleViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisBaustelleViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class LeistungsverzeichnisPositionenListViewModel :PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
public class LeistungsverzeichnisPositionenListViewModel :BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
List<LeistungsverzeichnisPosition> lvPositionen;
|
List<LeistungsverzeichnisPosition> lvPositionen;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class LeistungsverzeichnisPositionViewModel : PropertyChangedClass, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
public class LeistungsverzeichnisPositionViewModel : BaseViewModel, INotifyPropertyChanged, ILeistungsverzeichnisPositionViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using KanSan.Base;
|
using KanSan.Base;
|
||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Syncfusion.XlsIO;
|
using Syncfusion.XlsIO;
|
||||||
using System;
|
using System;
|
||||||
@@ -10,13 +12,19 @@ using System.Diagnostics;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class MainWindowViewModel : PropertyChangedClass, INotifyPropertyChanged
|
public class MainWindowViewModel : BaseViewModel, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
|
BaseViewModel actualViewModel;
|
||||||
|
|
||||||
|
|
||||||
RegistryKey registry;
|
RegistryKey registry;
|
||||||
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\KanSan";
|
const string REGISTRYKEY = "HKEY_CURRENT_USER\\Software\\Cosysda\\KanSan";
|
||||||
|
|
||||||
@@ -26,8 +34,35 @@ namespace KanSan.ViewModel
|
|||||||
private Sewer _selectedObjekt;
|
private Sewer _selectedObjekt;
|
||||||
|
|
||||||
public static Baustelle Baustelle;
|
public static Baustelle Baustelle;
|
||||||
|
//public static Sewer SelectedObjekt;
|
||||||
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
public static List<LeistungsverzeichnisPosition> LVPositionen = null;
|
||||||
|
|
||||||
|
public static IServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
|
public ICommand ListClientsCommand { get; set; }
|
||||||
|
public ICommand ListProjectsCommand { get; set; }
|
||||||
|
public ICommand ListBaustellenCommand { get; set; }
|
||||||
|
public ICommand ListObjectsCommand { get; set; }
|
||||||
|
public ICommand ShowLeistungsverzeichnisCommand { get; set; }
|
||||||
|
public ICommand SelectLeistungsverzeichnisBaustelleCommand { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public BaseViewModel ActualViewModel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return actualViewModel;
|
||||||
|
//return actualViewModel;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (actualViewModel == value) return;
|
||||||
|
Trace.WriteLine("AktualView Geändert zu " + value);
|
||||||
|
actualViewModel = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string ApplicationTitle
|
public string ApplicationTitle
|
||||||
{
|
{
|
||||||
@@ -113,6 +148,7 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Sewer SelectedObjekt
|
public Sewer SelectedObjekt
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -129,6 +165,7 @@ namespace KanSan.ViewModel
|
|||||||
OnPropertyChanged();
|
OnPropertyChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveInRegistry(string key, string value)
|
private void SaveInRegistry(string key, string value)
|
||||||
{
|
{
|
||||||
Registry.SetValue(REGISTRYKEY, key, value);
|
Registry.SetValue(REGISTRYKEY, key, value);
|
||||||
@@ -184,10 +221,107 @@ namespace KanSan.ViewModel
|
|||||||
Registry.CurrentUser.CreateSubKey("Software\\Cosysda\\KanSan");
|
Registry.CurrentUser.CreateSubKey("Software\\Cosysda\\KanSan");
|
||||||
LadeRegistry();
|
LadeRegistry();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void init()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
public MainWindowViewModel()
|
public MainWindowViewModel()
|
||||||
{
|
{
|
||||||
|
ServiceProvider = ConfigureServiceProvider();
|
||||||
LadeRegistry();
|
LadeRegistry();
|
||||||
LoadBaustellenLeistungsverzeichnis();
|
LoadBaustellenLeistungsverzeichnis();
|
||||||
|
|
||||||
|
|
||||||
|
ListClients();
|
||||||
|
|
||||||
|
|
||||||
|
ListClientsCommand = new RelayCommand(parmater => ListClients());
|
||||||
|
ListProjectsCommand = new RelayCommand(parameter => ListProjekte());
|
||||||
|
ListBaustellenCommand = new RelayCommand(paramter => ListBaustellen());
|
||||||
|
ListObjectsCommand = new RelayCommand(parameter => ListObjekte());
|
||||||
|
|
||||||
|
Mediator.Subscribe("GoToListClientScreen", OnGoToListClientScreen);
|
||||||
|
Mediator.Subscribe("GoToEditClientScreen", OnGoToEditClientScreen);
|
||||||
|
Mediator.Subscribe("ClientSelected", OnSelectedClient);
|
||||||
|
|
||||||
|
Mediator.Subscribe("GoToListProjektScreen", OnGoToListProjektScreen);
|
||||||
|
Mediator.Subscribe("GoToEditProjektScreen", OnGoToEditProjektScreen);
|
||||||
|
Mediator.Subscribe("ProjektSelected", OnSelectedProjekt);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSelectedProjekt(object obj)
|
||||||
|
{
|
||||||
|
if (!(obj is Projekt)) return;
|
||||||
|
SelectedProjekt = (obj as Projekt);
|
||||||
|
ListBaustellen();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoToListProjektScreen(object obj)
|
||||||
|
{
|
||||||
|
ListProjekte();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoToEditProjektScreen(object obj)
|
||||||
|
{
|
||||||
|
if (!(obj is Projekt)) return;
|
||||||
|
ActualViewModel = new ProjektEditViewModel((obj as Projekt));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSelectedClient(object obj)
|
||||||
|
{
|
||||||
|
if (!(obj is Kunde)) return;
|
||||||
|
SelectedKunde = (obj as Kunde);
|
||||||
|
ListProjekte();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoToEditClientScreen(object obj)
|
||||||
|
{
|
||||||
|
if (!(obj is Kunde)) return;
|
||||||
|
Kunde client = (obj as Kunde);
|
||||||
|
EditClient(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGoToListClientScreen(object obj)
|
||||||
|
{
|
||||||
|
ListClients();
|
||||||
|
}
|
||||||
|
|
||||||
|
private IServiceProvider ConfigureServiceProvider()
|
||||||
|
{
|
||||||
|
IServiceCollection service = new ServiceCollection();
|
||||||
|
|
||||||
|
service.AddSingleton<MainWindowViewModel>();
|
||||||
|
|
||||||
|
return service.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListClients()
|
||||||
|
{
|
||||||
|
ActualViewModel = new KundenListViewModel();
|
||||||
|
}
|
||||||
|
private void EditClient(Kunde client)
|
||||||
|
{
|
||||||
|
ActualViewModel = new KundenEditViewModel(client);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListProjekte()
|
||||||
|
{
|
||||||
|
if (SelectedKunde == null)
|
||||||
|
ActualViewModel = new KundenListViewModel();
|
||||||
|
else
|
||||||
|
ActualViewModel = new ProjektListViewModel(SelectedKunde);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListBaustellen()
|
||||||
|
{
|
||||||
|
ActualViewModel = new BaustellenListViewModel(SelectedProjekt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ListObjekte()
|
||||||
|
{
|
||||||
|
ActualViewModel = new ObjekteListViewModel(SelectedBaustelle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GenerateExcelFile()
|
public void GenerateExcelFile()
|
||||||
|
|||||||
45
KanSan.ViewModel/Mediator.cs
Normal file
45
KanSan.ViewModel/Mediator.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace KanSan.ViewModel
|
||||||
|
{
|
||||||
|
class Mediator
|
||||||
|
{
|
||||||
|
private static IDictionary<string, List<Action<object>>> pl_dict = new Dictionary<string, List<Action<object>>>();
|
||||||
|
public static void Subscribe(string token, Action<object> callback)
|
||||||
|
{
|
||||||
|
if(!pl_dict.ContainsKey(token))
|
||||||
|
{
|
||||||
|
var list = new List<Action<object>>();
|
||||||
|
list.Add(callback);
|
||||||
|
pl_dict.Add(token, list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
foreach(var item in pl_dict[token])
|
||||||
|
{
|
||||||
|
if (item.Method.ToString() == callback.Method.ToString())
|
||||||
|
found = true;
|
||||||
|
}
|
||||||
|
if (!found)
|
||||||
|
pl_dict[token].Add(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Unsubscribe(string token, Action<object> callback)
|
||||||
|
{
|
||||||
|
if (pl_dict.ContainsKey(token))
|
||||||
|
pl_dict[token].Remove(callback);
|
||||||
|
}
|
||||||
|
public static void Notify(string token, object args = null)
|
||||||
|
{
|
||||||
|
if(pl_dict.ContainsKey(token))
|
||||||
|
{
|
||||||
|
foreach (var callback in pl_dict[token])
|
||||||
|
callback(args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,12 @@ using KanSan.Base.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class ObjekteEditViewModel : PropertyChangedClass,IObjekteEditViewModel, INotifyPropertyChanged
|
public class ObjekteEditViewModel : BaseViewModel,IObjekteEditViewModel, INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
string strassename;
|
string strassename;
|
||||||
@@ -170,6 +171,8 @@ namespace KanSan.ViewModel
|
|||||||
|
|
||||||
public void Speichern()
|
public void Speichern()
|
||||||
{
|
{
|
||||||
|
objekt.PunktOben = getPoint(punktOben, true);
|
||||||
|
objekt.PunktUnten = getPoint(punktUnten, true);
|
||||||
objekt.StrasseName = strassename;
|
objekt.StrasseName = strassename;
|
||||||
objekt.DN = durchmesser;
|
objekt.DN = durchmesser;
|
||||||
objekt.Haltungslaenge = haltungslaenge;
|
objekt.Haltungslaenge = haltungslaenge;
|
||||||
@@ -183,5 +186,28 @@ namespace KanSan.ViewModel
|
|||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SewerPoint getPoint(string objektnummer, bool createIfNotFound = false)
|
||||||
|
{
|
||||||
|
List<SewerPoint> sewerPoints = unitOfWork.ObjekteRepository.Get(x => x.Objektnummer.Equals(objektnummer)).ToList();
|
||||||
|
if (sewerPoints.Count < 1)
|
||||||
|
{
|
||||||
|
if (createIfNotFound == false)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Guid guidNr = Guid.NewGuid();
|
||||||
|
unitOfWork.ObjekteRepository.Update(new SewerPoint()
|
||||||
|
{
|
||||||
|
Objektnummer = objektnummer,
|
||||||
|
GuidNr = guidNr
|
||||||
|
});
|
||||||
|
unitOfWork.Commit();
|
||||||
|
|
||||||
|
return unitOfWork.ObjekteRepository.Get(x => x.GuidNr.Equals(guidNr)).ToList().First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sewerPoints.First();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,14 @@
|
|||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Interfaces.UI;
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
@@ -14,8 +18,20 @@ namespace KanSan.ViewModel
|
|||||||
public string Strassename { get; set; }
|
public string Strassename { get; set; }
|
||||||
public IEnumerable<Sewer> Objekte { get; set; }
|
public IEnumerable<Sewer> Objekte { get; set; }
|
||||||
}
|
}
|
||||||
public class ObjekteListViewModel
|
public class ObjekteListViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
|
private ICommand _objektSelected;
|
||||||
|
public ICommand ObjektSelected {
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return _objektSelected ?? (_objektSelected = new RelayCommand(x =>
|
||||||
|
{
|
||||||
|
Mediator.Notify("GoTo1Screen", "");
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|
||||||
List<ObjekteTransfer> kanalObjekte = new List<ObjekteTransfer>();
|
List<ObjekteTransfer> kanalObjekte = new List<ObjekteTransfer>();
|
||||||
@@ -37,9 +53,26 @@ namespace KanSan.ViewModel
|
|||||||
}).ToList();
|
}).ToList();
|
||||||
kanalObjekte = x;
|
kanalObjekte = x;
|
||||||
|
|
||||||
|
//ObjektSelected = new RelayCommand(SelectObjekt);
|
||||||
|
|
||||||
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
//kanalObjekte = unitOfWork.KanaeleRepository.Get(x => x.Baustelle.Equals(selectedBaustelle)).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SelectObjekt(object obj)
|
||||||
|
{
|
||||||
|
|
||||||
|
//Debugger.Break();
|
||||||
|
if (!(obj is Sewer)) return;
|
||||||
|
Sewer sewer = (Sewer)obj;
|
||||||
|
if (sewer == null) return;
|
||||||
|
|
||||||
|
//MainWindowViewModel.SelectedObjekt = sewer;
|
||||||
|
/*SewerMainWindowViewModel t = new SewerMainWindowViewModel(sewer);
|
||||||
|
Debugger.Break();
|
||||||
|
//throw new NotImplementedException();
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
public Sewer NeueObjektHinzufügen()
|
public Sewer NeueObjektHinzufügen()
|
||||||
{
|
{
|
||||||
Guid guid = Guid.NewGuid();
|
Guid guid = Guid.NewGuid();
|
||||||
|
|||||||
@@ -2,16 +2,20 @@
|
|||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Interfaces.UI;
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class ProjektEditViewModel : PropertyChangedClass,INotifyPropertyChanged, IProjektEditViewModel
|
public class ProjektEditViewModel : BaseViewModel,INotifyPropertyChanged, IProjektEditViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
public ICommand SaveProjekt { get; set; }
|
||||||
|
public ICommand RemoveProjekt { get; set; }
|
||||||
private Projekt projekt;
|
private Projekt projekt;
|
||||||
string projektnummer;
|
string projektnummer;
|
||||||
string ort;
|
string ort;
|
||||||
@@ -41,6 +45,7 @@ namespace KanSan.ViewModel
|
|||||||
this.projekt = projekt;
|
this.projekt = projekt;
|
||||||
projektnummer = projekt.Projektnummer;
|
projektnummer = projekt.Projektnummer;
|
||||||
ort = projekt.Ort;
|
ort = projekt.Ort;
|
||||||
|
SaveProjekt = new RelayCommand(parameter => Speichern());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Speichern()
|
public void Speichern()
|
||||||
@@ -49,6 +54,7 @@ namespace KanSan.ViewModel
|
|||||||
projekt.Projektnummer = Projektnummer;
|
projekt.Projektnummer = Projektnummer;
|
||||||
unitOfWork.ProjekteRepository.Update(projekt);
|
unitOfWork.ProjekteRepository.Update(projekt);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
|
Mediator.Notify("GoToListProjektScreen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,14 +2,17 @@
|
|||||||
using KanSan.Base.Interfaces;
|
using KanSan.Base.Interfaces;
|
||||||
using KanSan.Base.Interfaces.UI;
|
using KanSan.Base.Interfaces.UI;
|
||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class ProjektListViewModel : IProjektListViewModel
|
public class ProjektListViewModel : BaseViewModel, IProjektListViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
private List<Projekt> projektevonKunde;
|
private List<Projekt> projektevonKunde;
|
||||||
@@ -22,26 +25,45 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
private Kunde selectedKunde;
|
private Kunde selectedKunde;
|
||||||
|
|
||||||
|
public ICommand NewProjekt { get; set; }
|
||||||
|
public ICommand EditProjekt { get; set; }
|
||||||
|
public ICommand SelectProjekt { get; set; }
|
||||||
|
public Projekt SelectedProjekt { get; set; }
|
||||||
|
|
||||||
public ProjektListViewModel(Kunde client)
|
public ProjektListViewModel(Kunde client)
|
||||||
{
|
{
|
||||||
|
|
||||||
this.selectedKunde = client;
|
this.selectedKunde = client;
|
||||||
|
|
||||||
|
|
||||||
projektevonKunde = unitOfWork.ProjekteRepository.Get(x => x.Kunde.Equals(client)).ToList();
|
projektevonKunde = unitOfWork.ProjekteRepository.Get(x => x.Kunde.Equals(client)).ToList();
|
||||||
|
|
||||||
|
SelectProjekt = new RelayCommand(parameter => SelectActualProjekt());
|
||||||
|
EditProjekt = new RelayCommand(parameter => EditSelectedProjekt());
|
||||||
|
NewProjekt = new RelayCommand(parameter => AddNewProjekt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectProjekt()
|
private void SelectActualProjekt()
|
||||||
{
|
{
|
||||||
|
if (SelectedProjekt == null) return;
|
||||||
|
Mediator.Notify("ProjektSelected", SelectedProjekt);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddNewProjekt()
|
||||||
|
{
|
||||||
|
Projekt newProj = NeueProjekt();
|
||||||
|
Mediator.Notify("GoToEditProjektScreen", newProj);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void EditSelectedProjekt()
|
||||||
|
{
|
||||||
|
Mediator.Notify("GoToEditProjektScreen", SelectedProjekt);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Projekt NeueProjekt()
|
public Projekt NeueProjekt()
|
||||||
{
|
{
|
||||||
Guid guid = Guid.NewGuid();
|
|
||||||
Projekt newProjekt = new Projekt()
|
Projekt newProjekt = new Projekt()
|
||||||
{
|
{
|
||||||
GuidNr = guid,
|
GuidNr = Guid.NewGuid(),
|
||||||
Kunde = selectedKunde
|
Kunde = selectedKunde
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -49,9 +71,7 @@ namespace KanSan.ViewModel
|
|||||||
//unitOfWork.ProjekteRepository.Insert(newProjekt);
|
//unitOfWork.ProjekteRepository.Insert(newProjekt);
|
||||||
unitOfWork.Commit();
|
unitOfWork.Commit();
|
||||||
|
|
||||||
List<Projekt> res = unitOfWork.ProjekteRepository.Get(x => x.GuidNr.Equals(guid)).ToList();
|
return newProjekt;
|
||||||
if (res.Count < 1) throw new Exception("Der zuvor eingefügte Projekt konnte nicht in der Datenbank gefunden werden");
|
|
||||||
return res.First();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class ProjektViewModel : PropertyChangedClass,INotifyPropertyChanged
|
public class ProjektViewModel : BaseViewModel,INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private Projekt _baustelle;
|
private Projekt _baustelle;
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class SchaedenEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ISchaedenEditViewModel
|
public class SchaedenEditViewModel : BaseViewModel, INotifyPropertyChanged, ISchaedenEditViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
decimal entfernung;
|
decimal entfernung;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class SchaedenListViewModel : ISchaedenListViewModel
|
public class SchaedenListViewModel : BaseViewModel, ISchaedenListViewModel
|
||||||
{
|
{
|
||||||
private Sewer actualSelectedSewer;
|
private Sewer actualSelectedSewer;
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
|
|||||||
@@ -1,18 +1,36 @@
|
|||||||
using KanSan.Base.Models;
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel.Commands;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class SewerMainMenuViewModel : PropertyChangedClass,INotifyPropertyChanged
|
public class SewerMainWindowViewModel : BaseViewModel,INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
private Sewer model;
|
private Sewer model;
|
||||||
private SchaedenViewModel schadenViewModel;
|
private SchaedenViewModel schadenViewModel;
|
||||||
private Schaeden schaden;
|
private Schaeden schaden;
|
||||||
|
private BaseViewModel aktualView;
|
||||||
|
|
||||||
|
public BaseViewModel AktualView
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return aktualView;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (aktualView == value) return;
|
||||||
|
aktualView = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Sewer Objekt
|
public Sewer Objekt
|
||||||
{
|
{
|
||||||
@@ -56,12 +74,30 @@ namespace KanSan.ViewModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ICommand StammdatenSelect { get; private set; }
|
||||||
|
public ICommand SchädenübersichtSelect { get; private set; }
|
||||||
|
|
||||||
|
public SewerMainWindowViewModel(Sewer model)
|
||||||
public SewerMainMenuViewModel(Sewer model)
|
|
||||||
{
|
{
|
||||||
if (model == null) throw new ArgumentNullException();
|
if (model == null) throw new ArgumentNullException();
|
||||||
this.model = model;
|
this.model = model;
|
||||||
|
|
||||||
|
StammdatenSelect = new RelayCommand(parameter => SelectStammdaten());
|
||||||
|
SchädenübersichtSelect = new RelayCommand(parameter => SelectSchädenübersicht());
|
||||||
|
|
||||||
|
var x = MainWindowViewModel.ServiceProvider.GetService<MainWindowViewModel>();
|
||||||
|
x.ActualViewModel = new ObjekteEditViewModel(model);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectSchädenübersicht()
|
||||||
|
{
|
||||||
|
AktualView = new SchaedenListViewModel(model);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SelectStammdaten()
|
||||||
|
{
|
||||||
|
AktualView = new ObjekteEditViewModel(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ using System.Text;
|
|||||||
|
|
||||||
namespace KanSan.ViewModel
|
namespace KanSan.ViewModel
|
||||||
{
|
{
|
||||||
public class TaetigkeitEditViewModel : PropertyChangedClass, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
public class TaetigkeitEditViewModel : BaseViewModel, INotifyPropertyChanged, ITaetigkeitEditViewModel
|
||||||
{
|
{
|
||||||
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
IUnitOfWork unitOfWork = new UnitOfWork(new KanSanContext());
|
||||||
Fahrzeug fahrzeug;
|
Fahrzeug fahrzeug;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
|
||||||
xmlns:local="clr-namespace:KanSan"
|
xmlns:local="clr-namespace:KanSan"
|
||||||
StartupUri="MainWindow.xaml">
|
>
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using KanSan.ViewModel;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -18,8 +20,11 @@ namespace KanSan
|
|||||||
{
|
{
|
||||||
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM0MjUzQDMxMzgyZTMxMmUzMG8wTDNQcm5mN3UxaU9MbjdkVUlQbDgzWHcvUXZCOHdaVVY3c2I5S3BvN0U9");
|
Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MjM0MjUzQDMxMzgyZTMxMmUzMG8wTDNQcm5mN3UxaU9MbjdkVUlQbDgzWHcvUXZCOHdaVVY3c2I5S3BvN0U9");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IServiceProvider ServiceProvider { get; private set; }
|
||||||
|
|
||||||
protected override void OnStartup(StartupEventArgs e)
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
{
|
{
|
||||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), new FrameworkPropertyMetadata
|
||||||
@@ -31,6 +36,23 @@ namespace KanSan
|
|||||||
{
|
{
|
||||||
DefaultValue = FindResource(typeof(UserControl))
|
DefaultValue = FindResource(typeof(UserControl))
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ServiceProvider = CreateServiceProvider();
|
||||||
|
|
||||||
|
Window window = ServiceProvider.GetRequiredService<MainWindow>();
|
||||||
|
window.Show();
|
||||||
|
base.OnStartup(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private IServiceProvider CreateServiceProvider()
|
||||||
|
{
|
||||||
|
IServiceCollection services = new ServiceCollection();
|
||||||
|
services.AddSingleton<SewerMainWindowViewModel>();
|
||||||
|
|
||||||
|
services.AddScoped<MainWindowViewModel>();
|
||||||
|
services.AddScoped<MainWindow>(s => new MainWindow(s.GetRequiredService<MainWindowViewModel>()));
|
||||||
|
|
||||||
|
return services.BuildServiceProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
KanSan/DialogWindowService.cs
Normal file
20
KanSan/DialogWindowService.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using KanSan.Base.Interfaces;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace KanSan
|
||||||
|
{
|
||||||
|
class DialogWindowService: IDialogWindowService
|
||||||
|
{
|
||||||
|
public void showWindow(object viewModel)
|
||||||
|
{
|
||||||
|
Window win = new Window();
|
||||||
|
win.Content = viewModel;
|
||||||
|
win.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -61,9 +61,15 @@
|
|||||||
<Compile Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml.cs">
|
<Compile Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="UI\SewerMainWindow.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="UI\UCHarzSanierung.xaml.cs">
|
<Compile Update="UI\UCHarzSanierung.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="UI\SanMaßnahmen\UCSanierungOverview.xaml.cs">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Compile>
|
||||||
<Compile Update="UI\UCSewerMainWindow.xaml.cs">
|
<Compile Update="UI\UCSewerMainWindow.xaml.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -138,9 +144,15 @@
|
|||||||
<Page Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml">
|
<Page Update="UI\Güteschutz\UCGüteschutzBerichtEdit.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="UI\SewerMainWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="UI\UCHarzSanierung.xaml">
|
<Page Update="UI\UCHarzSanierung.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="UI\SanMaßnahmen\UCSanierungOverview.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
<Page Update="UI\UCSewerMainWindow.xaml">
|
<Page Update="UI\UCSewerMainWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
|
||||||
xmlns:local="clr-namespace:KanSan"
|
xmlns:local="clr-namespace:KanSan"
|
||||||
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF" x:Class="KanSan.MainWindow"
|
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF" x:Class="KanSan.MainWindow"
|
||||||
TitleTextAlignment="Center" TitleBarBackground="BlueViolet"
|
TitleTextAlignment="Center" TitleBarBackground="BlueViolet"
|
||||||
@@ -17,6 +18,7 @@
|
|||||||
<ResourceDictionary Source="./my_controls.xaml" />
|
<ResourceDictionary Source="./my_controls.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@@ -36,10 +38,10 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<StackPanel Grid.Row="0" Grid.ColumnSpan="2">
|
<StackPanel Grid.Row="0" Grid.ColumnSpan="2">
|
||||||
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Checked="rbKunden_Checked" />
|
<RadioButton Name="rbKunden" Content="Kunden" Style="{StaticResource ToggelButtonList}" Command="{Binding ListClientsCommand}" />
|
||||||
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Checked="rbProjekte_Checked" />
|
<RadioButton Name="rbProjekte" Content="Projekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListProjectsCommand}" />
|
||||||
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Checked="rbBaustellen_Checked" />
|
<RadioButton Name="rbBaustellen" Content="Baustellen" Style="{StaticResource ToggelButtonList}" Command="{Binding ListBaustellenCommand}" />
|
||||||
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Checked="rbObjekte_Checked" />
|
<RadioButton x:Name="rbObjekte" Content="Objekte" Style="{StaticResource ToggelButtonList}" Command="{Binding ListObjectsCommand}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<Line Grid.Row="1" Stroke="Black" Width="auto" Height="4" StrokeThickness="20" Fill="Black" Stretch="Fill" X1="9" X2="10" />
|
<Line Grid.Row="1" Stroke="Black" Width="auto" Height="4" StrokeThickness="20" Fill="Black" Stretch="Fill" X1="9" X2="10" />
|
||||||
<StackPanel Grid.Row="2">
|
<StackPanel Grid.Row="2">
|
||||||
@@ -48,7 +50,7 @@
|
|||||||
<RadioButton Name="Test" Checked="Test_Checked" Content="Test" Style="{StaticResource ToggelButtonList}" />
|
<RadioButton Name="Test" Checked="Test_Checked" Content="Test" Style="{StaticResource ToggelButtonList}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
<ContentControl Grid.Column="1" Name="ContentController" Content="KanSan"/>
|
<ContentControl Grid.Column="1" Name="ContentController" Content="{Binding ActualViewModel}"/>
|
||||||
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
|
<StatusBar Grid.ColumnSpan="2" Margin="0,1,0,0" Grid.Row="1">
|
||||||
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
<StatusBarItem Content="{Binding SelectedKunde.Vorname}" />
|
||||||
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
|
<StatusBarItem Content="{Binding SelectedProjekt.Projektnummer}" />
|
||||||
|
|||||||
@@ -36,52 +36,19 @@ namespace KanSan
|
|||||||
UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle;
|
UI.UCLeistungsverzeichnisPositionenBaustelle UCLeistungsverzeichnisPositionenBaustelle;
|
||||||
UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
UI.UCLeistungsverzeichnisPosList UCLeistungsverzeichnisPosList;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow(object dataContext)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
this.DataContext = new MainWindowViewModel();
|
DataContext = dataContext;
|
||||||
(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
//(this.DataContext as MainWindowViewModel).GenerateExcelFile();
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
System.Diagnostics.PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UCProjektList_ProjektAdded(object sender, UI.SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.projekt == null) return;
|
|
||||||
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
|
||||||
ContentController.Content = uCProjektEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCProjektList_ProjektSelected(object sender, UI.SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedProjekt = e.projekt;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCKundeList_KundeSelect(object sender, UI.KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedKunde = e.kunde;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCKundeList_KundeAdded(object sender, UI.KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
UCKundeEdit = new UI.UCKundeEdit(e.kunde);
|
|
||||||
UCKundeEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = UCKundeEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void UCProjektList_ProjektEdited(object sender, UI.SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.projekt == null) return;
|
|
||||||
UI.UCProjektEdit uCProjektEdit = new UI.UCProjektEdit(e.projekt);
|
|
||||||
|
|
||||||
uCProjektEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = uCProjektEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Edit_SpeichernClicked(object sender, EventArgs e)
|
private void Edit_SpeichernClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -89,87 +56,6 @@ namespace KanSan
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleSelected(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as MainWindowViewModel).SelectedBaustelle = e.baustelle;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleEdited(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.baustelle == null) return;
|
|
||||||
UI.UCBaustelleEdit uCBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
|
||||||
|
|
||||||
uCBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = uCBaustelleEdit;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UCBaustelleList_BaustelleAdded(object sender, UI.SelectBaustelleEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.baustelle == null) return;
|
|
||||||
UI.UCBaustelleEdit uBaustelleEdit = new UI.UCBaustelleEdit(e.baustelle);
|
|
||||||
uBaustelleEdit.SpeichernClicked += Edit_SpeichernClicked;
|
|
||||||
ContentController.Content = uBaustelleEdit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void UCObjekteList_ObjektSelected(object sender, UI.ObjektSelectEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Objekt == null) return;
|
|
||||||
(DataContext as MainWindowViewModel).SelectedObjekt = e.Objekt;
|
|
||||||
rbObjekte.IsChecked = false;
|
|
||||||
|
|
||||||
uCSewerMainMenu = new UI.UCSewerMainMenu(e.Objekt);
|
|
||||||
|
|
||||||
ContentController.Content = uCSewerMainMenu;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rbKunden_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
rbLeistungsverzeichnis.IsChecked = false;
|
|
||||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
|
||||||
UCKundeList = new UI.UCKundeList();
|
|
||||||
UCKundeList.KundeAdded += UCKundeList_KundeAdded;
|
|
||||||
UCKundeList.KundeSelect += UCKundeList_KundeSelect;
|
|
||||||
ContentController.Content = UCKundeList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rbProjekte_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
rbLeistungsverzeichnis.IsChecked = false;
|
|
||||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
|
||||||
Kunde client = (DataContext as MainWindowViewModel).SelectedKunde;
|
|
||||||
if (client == null) return;
|
|
||||||
UCProjektList = new UI.UCProjektList(client);
|
|
||||||
UCProjektList.ProjektSelected += UCProjektList_ProjektSelected;
|
|
||||||
UCProjektList.ProjektAdded += UCProjektList_ProjektAdded;
|
|
||||||
UCProjektList.ProjektEdited += UCProjektList_ProjektEdited;
|
|
||||||
ContentController.Content = UCProjektList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rbBaustellen_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
rbLeistungsverzeichnis.IsChecked = false;
|
|
||||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
|
||||||
Projekt projekt = (DataContext as MainWindowViewModel).SelectedProjekt;
|
|
||||||
if (projekt == null) return;
|
|
||||||
UCBaustelleList = new UI.UCBaustelleList(projekt);
|
|
||||||
UCBaustelleList.BaustelleAdded += UCBaustelleList_BaustelleAdded;
|
|
||||||
UCBaustelleList.BaustelleEdited += UCBaustelleList_BaustelleEdited;
|
|
||||||
UCBaustelleList.BaustelleSelected += UCBaustelleList_BaustelleSelected;
|
|
||||||
ContentController.Content = UCBaustelleList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rbObjekte_Checked(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
rbLeistungsverzeichnis.IsChecked = false;
|
|
||||||
rbLeistungsverzeichnisBaustellen.IsChecked = false;
|
|
||||||
rbObjekte.IsChecked = true;
|
|
||||||
UI.UCObjekteList uCObjekteList = new UI.UCObjekteList((DataContext as MainWindowViewModel).SelectedBaustelle);
|
|
||||||
uCObjekteList.ObjektSelected += UCObjekteList_ObjektSelected;
|
|
||||||
ContentController.Content = uCObjekteList;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
private void rbLeistungsverzeichnis_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ namespace KanSan.UI
|
|||||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleSelected;
|
public event EventHandler<SelectBaustelleEventArgs> BaustelleSelected;
|
||||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleAdded;
|
public event EventHandler<SelectBaustelleEventArgs> BaustelleAdded;
|
||||||
public event EventHandler<SelectBaustelleEventArgs> BaustelleEdited;
|
public event EventHandler<SelectBaustelleEventArgs> BaustelleEdited;
|
||||||
|
|
||||||
|
public UCBaustelleList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
public UCBaustelleList(Projekt projekt)
|
public UCBaustelleList(Projekt projekt)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
@@ -26,7 +27,8 @@
|
|||||||
<Label Grid.Column="0" Grid.Row="3">Plz</Label>
|
<Label Grid.Column="0" Grid.Row="3">Plz</Label>
|
||||||
<Label Grid.Column="0" Grid.Row="4">Ort</Label>
|
<Label Grid.Column="0" Grid.Row="4">Ort</Label>
|
||||||
|
|
||||||
<Button Name="Speichern" Content="Speichern" Grid.Row="5" Grid.ColumnSpan="2" Click="Speichern_Click" />
|
<Button Name="Speichern" Content="Speichern" Grid.Row="5" Grid.ColumnSpan="2" Command="{Binding SaveClient}" />
|
||||||
|
<Button Content="Löschen" Grid.Row="6" Grid.ColumnSpan="2" Command="{Binding RemoveClient}" />
|
||||||
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Vorname}" />
|
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Vorname}" />
|
||||||
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Nachname}" />
|
<TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Nachname}" />
|
||||||
|
|||||||
@@ -22,30 +22,9 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCKundeEdit : UserControl
|
public partial class UCKundeEdit : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler SpeichernClicked;
|
public UCKundeEdit()
|
||||||
|
|
||||||
protected virtual void OnSpeichernKlicked(EventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler handler = SpeichernClicked;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
//private Kunde kunde = null;
|
|
||||||
//private UnitOfWork unitOfWork = null;
|
|
||||||
public UCKundeEdit(Kunde kunde = null)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
this.DataContext = new KundenEditViewModel(kunde);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
((KundenEditViewModel)DataContext).Speichern();
|
|
||||||
OnSpeichernKlicked(EventArgs.Empty);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,16 @@
|
|||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid AutoGenerateColumns="False" SelectionMode="Single" ItemsSource="{Binding Kunden}" Name="dgKundenList">
|
<DataGrid IsReadOnly="True" AutoGenerateColumns="False" SelectionMode="Single" SelectedItem="{Binding SelectedKunde, Mode=TwoWay}" ItemsSource="{Binding Kunden}" Name="dgKundenList">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Vorname" Binding="{Binding Vorname}" />
|
<DataGridTextColumn Header="Vorname" Binding="{Binding Vorname}" />
|
||||||
<DataGridTextColumn Header="Nachname" Binding="{Binding Nachname}" />
|
<DataGridTextColumn Header="Nachname" Binding="{Binding Nachname}" />
|
||||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button Grid.Row="1" Name="SelectKunde" Content="Kunde Auswählen" Click="SelectKunde_Click" />
|
<Button Grid.Row="1" Name="SelectKunde" Content="Kunde Auswählen" Command="{Binding SelectClientCommand}" />
|
||||||
<Button Grid.Row="2" Name="EditKunde" Content="Kunde Editieren" Click="EditKunde_Click" />
|
<Button Grid.Row="2" Name="EditKunde" Content="Kunde Editieren" Command="{Binding EditClientCommand}" />
|
||||||
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Click="NeueKunde_Click" />
|
<Button Grid.Row="3" Name="NeueKunde" Content="Neue Kunde anlegen" Command="{Binding AddNewClientCommand}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -21,54 +21,10 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCKundeList : UserControl
|
public partial class UCKundeList : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler<KundeAddedKlickEventArgs> KundeAdded;
|
|
||||||
public event EventHandler<KundeAddedKlickEventArgs> KundeSelect;
|
|
||||||
public UCKundeList()
|
public UCKundeList()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new KundenListViewModel();
|
this.DataContext = new KundenListViewModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NeueKunde_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
KundeAddedKlickEventArgs args = new KundeAddedKlickEventArgs();
|
|
||||||
args.kunde = (DataContext as KundenListViewModel).NeueKunde();
|
|
||||||
OnClickKundeAdded(args);
|
|
||||||
|
|
||||||
}
|
|
||||||
protected virtual void OnClickKundeAdded(KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<KundeAddedKlickEventArgs> handler = KundeAdded;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnClickSelectedKunde(KundeAddedKlickEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<KundeAddedKlickEventArgs> handler = KundeSelect;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void EditKunde_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Kunde selectedKunde = (dgKundenList.SelectedItem as Kunde);
|
|
||||||
if (selectedKunde == null) return;
|
|
||||||
|
|
||||||
OnClickKundeAdded(new KundeAddedKlickEventArgs() { kunde = selectedKunde });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SelectKunde_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Kunde selectedKunde = (dgKundenList.SelectedItem as Kunde);
|
|
||||||
if (selectedKunde == null) return;
|
|
||||||
OnClickSelectedKunde(new KundeAddedKlickEventArgs() { kunde = selectedKunde });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class KundeAddedKlickEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public Kunde kunde { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" Click="Speichern_Click"/>
|
<Button Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Content="Speichern" Name="Speichern" />
|
||||||
<StackPanel Grid.Column="1">
|
<StackPanel Grid.Column="1">
|
||||||
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
<CheckBox Content="Rohrleitung in Betrieb" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.RohrleitungInBetrieb)}" Style="{StaticResource checkBoxCircle}"/>
|
||||||
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
<CheckBox Content="Wasserhaltung durchgeführt" IsChecked="{Binding Path=(iself:IObjekteEditViewModel.WasserHaltungDurchgefuehrt)}" Style="{StaticResource checkBoxCircle}" />
|
||||||
|
|||||||
@@ -20,15 +20,10 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCObjektEdit : UserControl
|
public partial class UCObjektEdit : UserControl
|
||||||
{
|
{
|
||||||
public UCObjektEdit(Sewer objekt)
|
public UCObjektEdit()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new ObjekteEditViewModel(objekt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as ObjekteEditViewModel).Speichern();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,8 @@
|
|||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick">
|
<TreeView Name="trvItems" ItemsSource="{Binding KanalObjekte}" MouseDoubleClick="trvItems_MouseDoubleClick" >
|
||||||
|
|
||||||
<TreeView.Resources>
|
<TreeView.Resources>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
<HierarchicalDataTemplate DataType="{x:Type self:ObjekteTransfer}" ItemsSource="{Binding Objekte}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
@@ -44,7 +45,7 @@
|
|||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</TreeView.Resources>
|
</TreeView.Resources>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" />
|
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Objekt Auswählen" Command="{Binding ObjektSelected}" />
|
||||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Objekt Editieren" />
|
<Button Grid.Row="2" Name="ProjektEdit" Content="Objekt Editieren" />
|
||||||
<Button Grid.Row="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
<Button Grid.Row="3" Name="ObjektNew" Content="Neue Objekt Hinzufügen" Click="ObjektNew_Click" />
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,63 @@ using System.Windows.Shapes;
|
|||||||
|
|
||||||
namespace KanSan.UI
|
namespace KanSan.UI
|
||||||
{
|
{
|
||||||
|
public class MouseLeftButtonUp
|
||||||
|
{
|
||||||
|
public static DependencyProperty CommandProperty = DependencyProperty.RegisterAttached("Command", typeof(ICommand), typeof(MouseLeftButtonUp), new UIPropertyMetadata(CommandChanged));
|
||||||
|
public static DependencyProperty CommandParameterProperty =
|
||||||
|
DependencyProperty.RegisterAttached("CommandParamter",
|
||||||
|
typeof(object),
|
||||||
|
typeof(MouseLeftButtonUp),
|
||||||
|
new UIPropertyMetadata(null));
|
||||||
|
|
||||||
|
public static void SetCommand(DependencyObject target, ICommand value)
|
||||||
|
{
|
||||||
|
target.SetValue(CommandProperty, value);
|
||||||
|
}
|
||||||
|
public static object GetCommand(DependencyObject target, ICommand value)
|
||||||
|
{
|
||||||
|
return target.GetValue(CommandProperty);
|
||||||
|
}
|
||||||
|
public static void SetCommandParamter(DependencyObject target, object value)
|
||||||
|
{
|
||||||
|
target.SetValue(CommandProperty, value);
|
||||||
|
}
|
||||||
|
public static object GetCommandParamter(DependencyObject target)
|
||||||
|
{
|
||||||
|
return target.GetValue(CommandParameterProperty);
|
||||||
|
}
|
||||||
|
private static void CommandChanged(DependencyObject target, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
//throw new NotImplementedException();
|
||||||
|
Control control = target as Control;
|
||||||
|
if (control == null) return;
|
||||||
|
if ((e.NewValue != null) && (e.OldValue == null))
|
||||||
|
control.MouseLeftButtonUp += OnMouseLeftButtonUp;
|
||||||
|
else if ((e.NewValue == null) && (e.OldValue != null))
|
||||||
|
control.MouseLeftButtonUp -= OnMouseLeftButtonUp;
|
||||||
|
|
||||||
|
}
|
||||||
|
private static void OnMouseLeftButtonUp(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//throw new NotImplementedException();
|
||||||
|
Control control = sender as Control;
|
||||||
|
ICommand command = (ICommand)control.GetValue(CommandProperty);
|
||||||
|
object commandParameter = control.GetValue(CommandParameterProperty);
|
||||||
|
command.Execute(commandParameter);
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaktionslogik für UCObjekteList.xaml
|
/// Interaktionslogik für UCObjekteList.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCObjekteList : UserControl
|
public partial class UCObjekteList : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler<ObjektSelectEventArgs> ObjektSelected;
|
|
||||||
Baustelle baustelle;
|
Baustelle baustelle;
|
||||||
|
public UCObjekteList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
public UCObjekteList(Baustelle baustelle)
|
public UCObjekteList(Baustelle baustelle)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -38,24 +88,17 @@ namespace KanSan.UI
|
|||||||
|
|
||||||
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void trvItems_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
TreeView treeView = (TreeView)sender;
|
TreeView treeView = (TreeView)sender;
|
||||||
if (treeView == null) return;
|
if (treeView == null) return;
|
||||||
if (!(treeView.SelectedItem is Sewer)) return;
|
if (!(treeView.SelectedItem is Sewer)) return;
|
||||||
Sewer sewer = (Sewer)treeView.SelectedItem;
|
Sewer sewer = (Sewer)treeView.SelectedItem;
|
||||||
if (sewer == null) return;
|
if (sewer == null) return;
|
||||||
OnObjektSelectKlick(new ObjektSelectEventArgs() { Objekt = sewer });
|
SewerMainWindow sewerMainWindow = new SewerMainWindow();
|
||||||
|
sewerMainWindow.DataContext = new SewerMainWindowViewModel(sewer);
|
||||||
|
sewerMainWindow.ShowDialog();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnObjektSelectKlick(ObjektSelectEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<ObjektSelectEventArgs> handler = ObjektSelected;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ObjektSelectEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public Sewer Objekt { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<Label Background="Beige" Grid.Column="0" Grid.Row="0" Content="Projektnummer" />
|
<Label Background="Beige" Grid.Column="0" Grid.Row="0" Content="Projektnummer" />
|
||||||
<Label Background="Beige" Grid.Column="0" Grid.Row="1" Content="Ort" />
|
<Label Background="Beige" Grid.Column="0" Grid.Row="1" Content="Ort" />
|
||||||
<Button Grid.Row="2" Grid.ColumnSpan="2" Name="Speichern" Content="Speichern" Click="Speichern_Click" />
|
<Button Grid.Row="2" Grid.ColumnSpan="2" Name="Speichern" Content="Speichern" Command="{Binding SaveProjekt}" />
|
||||||
|
|
||||||
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Projektnummer}" />
|
<TextBox Grid.Column="1" Grid.Row="0" Text="{Binding Projektnummer}" />
|
||||||
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Ort}" />
|
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Ort}" />
|
||||||
|
|||||||
@@ -20,25 +20,9 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCProjektEdit : UserControl
|
public partial class UCProjektEdit : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler SpeichernClicked;
|
public UCProjektEdit()
|
||||||
|
|
||||||
protected virtual void OnSpeichernKlicked(EventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler handler = SpeichernClicked;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
public UCProjektEdit(Projekt projekt)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
this.DataContext = new ProjektEditViewModel(projekt);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Speichern_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
(DataContext as ProjektEditViewModel).Speichern();
|
|
||||||
OnSpeichernKlicked(EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,14 +17,14 @@
|
|||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
<RowDefinition Height="50" />
|
<RowDefinition Height="50" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DataGrid ItemsSource="{Binding ProjekteVomKunde}" Name="dgProjekte" AutoGenerateColumns="False">
|
<DataGrid IsReadOnly="True" ItemsSource="{Binding ProjekteVomKunde}" SelectedItem="{Binding SelectedProjekt}" Name="dgProjekte" AutoGenerateColumns="False">
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
<DataGridTextColumn Header="Projektnummer" Binding="{Binding Projektnummer}" />
|
<DataGridTextColumn Header="Projektnummer" Binding="{Binding Projektnummer}" />
|
||||||
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
<DataGridTextColumn Header="Ort" Binding="{Binding Ort}" />
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Click="ProjektSelect_Click" />
|
<Button Grid.Row="1" x:Name="ProjektSelect" Content="Projekt Auswählen" Command="{Binding SelectProjekt}"/>
|
||||||
<Button Grid.Row="2" Name="ProjektEdit" Content="Projekt Editieren" Click="ProjektEdit_Click" />
|
<Button Grid.Row="2" Name="ProjektEdit" Content="Projekt Editieren" Command="{Binding EditProjekt}"/>
|
||||||
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Click="ProjektNew_Click" />
|
<Button Grid.Row="3" Name="ProjektNew" Content="Neue Projekt Hinzufügen" Command="{Binding NewProjekt}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -20,61 +20,10 @@ namespace KanSan.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class UCProjektList : UserControl
|
public partial class UCProjektList : UserControl
|
||||||
{
|
{
|
||||||
public event EventHandler<SelectProjektEventArgs> ProjektAdded;
|
|
||||||
public event EventHandler<SelectProjektEventArgs> ProjektEdited;
|
|
||||||
public event EventHandler<SelectProjektEventArgs> ProjektSelected;
|
|
||||||
|
|
||||||
public UCProjektList(Kunde selectedKunde)
|
public UCProjektList()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new ProjektListViewModel(selectedKunde);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ProjektSelect_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
|
||||||
if (selectedProjekt == null) return;
|
|
||||||
OnClickProjektSelect(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProjektEdit_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
Projekt selectedProjekt = (dgProjekte.SelectedItem as Projekt);
|
|
||||||
if (selectedProjekt == null) return;
|
|
||||||
OnClickProjektEdit(new SelectProjektEventArgs() { projekt = selectedProjekt });
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProjektNew_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
OnClickProjektAdd(
|
|
||||||
new SelectProjektEventArgs()
|
|
||||||
{
|
|
||||||
projekt = (DataContext as ProjektListViewModel).NeueProjekt()
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void OnClickProjektSelect(SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<SelectProjektEventArgs> handler = ProjektSelected;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
protected virtual void OnClickProjektEdit(SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<SelectProjektEventArgs> handler = ProjektEdited;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
protected virtual void OnClickProjektAdd(SelectProjektEventArgs e)
|
|
||||||
{
|
|
||||||
EventHandler<SelectProjektEventArgs> handler = ProjektAdded;
|
|
||||||
if (handler != null)
|
|
||||||
handler(this, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class SelectProjektEventArgs : EventArgs
|
|
||||||
{
|
|
||||||
public Projekt projekt { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml
Normal file
19
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<UserControl x:Class="KanSan.UI.UCSanierungOverview"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="./../../my_controls.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<ContentControl Name="Sanierungsmaßnahmen" Content="{Binding Path=Sanierungsmaßnahmen}" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
26
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml.cs
Normal file
26
KanSan/UI/SanMaßnahmen/UCSanierungOverview.xaml.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace KanSan.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für UCSanierungOverview.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class UCSanierungOverview : UserControl
|
||||||
|
{
|
||||||
|
public UCSanierungOverview()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<Button Grid.Row="1" Name="NewSchaden" Click="NewSchaden_Click" Content="Neue Schäden Hinzufügen" />
|
<Button Grid.Row="1" Name="NewSchaden" Command="{Binding neueSchadenHinzufügen}" Content="Neue Schäden Hinzufügen" />
|
||||||
<Button Grid.Row="2" Name="GenerateExcel" Content="Schadensbericht erstellen" Click="GenerateExcel_Click" />
|
<Button Grid.Row="2" Name="GenerateExcel" Content="Schadensbericht erstellen" Click="GenerateExcel_Click" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ namespace KanSan.UI
|
|||||||
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
this.DataContext = new SchaedenListViewModel(actualSelectedSewer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UCSchaedenList()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
protected virtual void OnClickSchaedenSelect(SelectSchaedenEventArgs e)
|
||||||
{
|
{
|
||||||
EventHandler<SelectSchaedenEventArgs> handler = SchaedenSelected;
|
EventHandler<SelectSchaedenEventArgs> handler = SchaedenSelected;
|
||||||
|
|||||||
42
KanSan/UI/SewerMainWindow.xaml
Normal file
42
KanSan/UI/SewerMainWindow.xaml
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<syncfusion:ChromelessWindow x:Class="KanSan.UI.SewerMainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||||
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
|
mc:Ignorable="d" TitleBarBackground="BlueViolet"
|
||||||
|
Title="SewerMainWindow" Height="450" Width="800" WindowStartupLocation="CenterScreen" WindowState="Maximized">
|
||||||
|
<Window.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="./../my_controls.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Window.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="150" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="11*" />
|
||||||
|
<RowDefinition Height="64*" />
|
||||||
|
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
|
||||||
|
<TextBlock Text="{Binding ObjektBezeichnung}" />
|
||||||
|
<!--<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />
|
||||||
|
<TextBlock Text="{Binding Path=(self:SewerMainMenuViewModel.SchadenEntfernung)}" />-->
|
||||||
|
<TextBlock Text="" />
|
||||||
|
</StackPanel>
|
||||||
|
<!--<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Path=(self:SewerMainMenuViewModel.ObjektBezeichnung)}" />-->
|
||||||
|
|
||||||
|
<StackPanel Grid.Column="0" Grid.Row="1" Name="MenuItems">
|
||||||
|
|
||||||
|
<RadioButton Command="{Binding StammdatenSelect}" Style="{StaticResource ToggelButtonList}" Content="Stammdaten" />
|
||||||
|
<RadioButton Command="{Binding SchädenübersichtSelect}" Name="rbSchaeden" Style="{StaticResource ToggelButtonList}" Content="Schäden" />
|
||||||
|
</StackPanel>
|
||||||
|
<ContentControl Grid.Column="1" Grid.Row="1" Content="{Binding AktualView}" Name="ObjektContentcontroller" />
|
||||||
|
</Grid>
|
||||||
|
</syncfusion:ChromelessWindow>
|
||||||
33
KanSan/UI/SewerMainWindow.xaml.cs
Normal file
33
KanSan/UI/SewerMainWindow.xaml.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using KanSan.Base.Models;
|
||||||
|
using KanSan.ViewModel;
|
||||||
|
using Syncfusion.Windows.Shared;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace KanSan.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaktionslogik für SewerMainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class SewerMainWindow : ChromelessWindow
|
||||||
|
{
|
||||||
|
public SewerMainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
public SewerMainWindow(Sewer model)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
this.DataContext = new SewerMainWindowViewModel(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
xmlns:self="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||||
|
xmlns:syncfusion="clr-namespace:Syncfusion.Windows.Shared;assembly=Syncfusion.Shared.WPF"
|
||||||
xmlns:local="clr-namespace:KanSan.UI"
|
xmlns:local="clr-namespace:KanSan.UI"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ namespace KanSan.UI
|
|||||||
public UCSewerMainMenu(Sewer objekt)
|
public UCSewerMainMenu(Sewer objekt)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.DataContext = new SewerMainMenuViewModel(objekt);
|
this.DataContext = new SewerMainWindowViewModel(objekt);
|
||||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
//UI.UCObjektEdit uCObjektEdit = new UCObjektEdit(objekt);
|
||||||
ObjektContentcontroller.Content = uCObjektEdit;
|
//ObjektContentcontroller.Content = uCObjektEdit;
|
||||||
rbStammdaten.IsChecked = true;
|
rbStammdaten.IsChecked = true;
|
||||||
|
|
||||||
Style style = this.FindResource("ToggelButtonList") as Style;
|
Style style = this.FindResource("ToggelButtonList") as Style;
|
||||||
@@ -42,30 +42,31 @@ namespace KanSan.UI
|
|||||||
|
|
||||||
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
private void rbSewerMenuItem_Checked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
RadioButton btn = (RadioButton)sender;
|
RadioButton btn = (RadioButton)sender;
|
||||||
if (btn == null) return;
|
if (btn == null) return;
|
||||||
switch(btn.Name)
|
switch(btn.Name)
|
||||||
{
|
{
|
||||||
case "rbStammdaten":
|
case "rbStammdaten":
|
||||||
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainMenuViewModel).Objekt);
|
UI.UCObjektEdit uCObjektEdit = new UCObjektEdit((DataContext as SewerMainWindowViewModel).Objekt);
|
||||||
ObjektContentcontroller.Content = uCObjektEdit;
|
ObjektContentcontroller.Content = uCObjektEdit;
|
||||||
break;
|
break;
|
||||||
case "rbSchaeden":
|
case "rbSchaeden":
|
||||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||||
uCSchaedenList.SanierungsmaßnahmenSelected += UCSchaedenList_SanierungsmaßnahmenSelected;
|
uCSchaedenList.SanierungsmaßnahmenSelected += UCSchaedenList_SanierungsmaßnahmenSelected;
|
||||||
ObjektContentcontroller.Content = uCSchaedenList;
|
ObjektContentcontroller.Content = uCSchaedenList;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
Schaeden aktuellSchadenSelected = null;
|
Schaeden aktuellSchadenSelected = null;
|
||||||
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
private void UCSchaedenList_SanierungsmaßnahmenSelected(object sender, SelectSchaedenEventArgs e)
|
||||||
{
|
{
|
||||||
aktuellSchadenSelected = e.schaeden;
|
aktuellSchadenSelected = e.schaeden;
|
||||||
UI.UCSanMaßnahmenList uCSanMaßnahmenList = new UCSanMaßnahmenList(e.schaeden);
|
UI.UCSanMaßnahmenList uCSanMaßnahmenList = new UCSanMaßnahmenList(e.schaeden);
|
||||||
(DataContext as SewerMainMenuViewModel).Schaden = e.schaeden;
|
(DataContext as SewerMainWindowViewModel).Schaden = e.schaeden;
|
||||||
|
|
||||||
uCSanMaßnahmenList.TaetigkeitenSelected += UCSanMaßnahmenList_TaetigkeitenSelected;
|
uCSanMaßnahmenList.TaetigkeitenSelected += UCSanMaßnahmenList_TaetigkeitenSelected;
|
||||||
rbSchaeden.IsChecked = false;
|
rbSchaeden.IsChecked = false;
|
||||||
@@ -103,7 +104,7 @@ namespace KanSan.UI
|
|||||||
|
|
||||||
private void UCSchaedenEdit_SpeichernClicked(object sender, EventArgs e)
|
private void UCSchaedenEdit_SpeichernClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainMenuViewModel).Objekt);
|
UI.UCSchaedenList uCSchaedenList = new UCSchaedenList((DataContext as SewerMainWindowViewModel).Objekt);
|
||||||
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
uCSchaedenList.SchaedenSelected += UCSchaedenList_SchaedenSelected;
|
||||||
ObjektContentcontroller.Content = uCSchaedenList;
|
ObjektContentcontroller.Content = uCSchaedenList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,37 @@
|
|||||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:KanSan"
|
xmlns:local="clr-namespace:KanSan"
|
||||||
|
xmlns:vm="clr-namespace:KanSan.ViewModel;assembly=KanSan.ViewModel"
|
||||||
xmlns:l="clr-namespace:KanSan.UI">
|
xmlns:l="clr-namespace:KanSan.UI">
|
||||||
<DataTemplate x:Key="SanierungViewModelDataTemplate" DataType="{x:Type l:UCHarzSanierung }">
|
<DataTemplate x:Key="SanierungViewModelDataTemplate" DataType="{x:Type l:UCHarzSanierung }">
|
||||||
<l:UCHarzSanierung />
|
<l:UCHarzSanierung />
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:ProjektEditViewModel}">
|
||||||
|
<l:UCProjektEdit />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:KundenListViewModel}">
|
||||||
|
<l:UCKundeList/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:KundenEditViewModel}">
|
||||||
|
<l:UCKundeEdit/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:ProjektListViewModel}">
|
||||||
|
<l:UCProjektList/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:BaustellenListViewModel}">
|
||||||
|
<l:UCBaustelleList/>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:ObjekteListViewModel}">
|
||||||
|
<l:UCObjekteList />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:ObjekteEditViewModel}">
|
||||||
|
<l:UCObjektEdit />
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate DataType="{x:Type vm:SchaedenListViewModel}">
|
||||||
|
<l:UCSchaedenList />
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
|
||||||
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
<DataTemplate x:Key="SelectNewTätigkeitenLVPosition">
|
||||||
<Border BorderThickness="2" BorderBrush="Red">
|
<Border BorderThickness="2" BorderBrush="Red">
|
||||||
<ItemsControl ItemsSource="{Binding LVPositionen }">
|
<ItemsControl ItemsSource="{Binding LVPositionen }">
|
||||||
|
|||||||
Reference in New Issue
Block a user