Imprägnierungsliste hinzugefügt
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
Projects,
|
||||
Buildingsites,
|
||||
SewerObjects,
|
||||
SewerMainMenu
|
||||
SewerMainMenu,
|
||||
Impregnierung
|
||||
}
|
||||
}
|
||||
|
||||
56
DaSaSo.EntityFramework/Services/ImpregnationDataService.cs
Normal file
56
DaSaSo.EntityFramework/Services/ImpregnationDataService.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Services;
|
||||
using DaSaSo.EntityFramework.Services.Common;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.EntityFramework.Services
|
||||
{
|
||||
public class ImpregnationDataService : IDataService<Impregnation>
|
||||
{
|
||||
private readonly DaSaSoDbContextFactory _contextFactory;
|
||||
private readonly NonQueryDataService<Impregnation> _nonQueryDataService;
|
||||
|
||||
public ImpregnationDataService(DaSaSoDbContextFactory contextFactory)
|
||||
{
|
||||
_contextFactory = contextFactory;
|
||||
_nonQueryDataService = new NonQueryDataService<Impregnation>(contextFactory);
|
||||
}
|
||||
|
||||
public async Task<Impregnation> Create(Impregnation entity)
|
||||
{
|
||||
return await _nonQueryDataService.Create(entity);
|
||||
}
|
||||
|
||||
public Impregnation CreateNonAsync(Impregnation entity)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<bool> Delete(int id)
|
||||
{
|
||||
return await _nonQueryDataService.Delete(id);
|
||||
}
|
||||
|
||||
public Task<Impregnation> Get(int id)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<Impregnation>> GetAll()
|
||||
{
|
||||
using DaSaSoDbContext context = _contextFactory.CreateDbContext();
|
||||
IEnumerable<Impregnation> entities = await context.Impregnations.ToListAsync();
|
||||
return entities;
|
||||
}
|
||||
|
||||
public Task<Impregnation> Update(int id, Impregnation entity)
|
||||
{
|
||||
return _nonQueryDataService.Update(id, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ namespace DaSaSo.ViewModel.Factories
|
||||
private CreateViewModel<BuildingsiteListViewModel> _createBuildingsiteListViewModel;
|
||||
private CreateViewModel<SewerObjectListViewModel> _createSewerObjectListViewModel;
|
||||
private CreateViewModel<SewerMainListViewModel> _createSewerMainMenuListViewModel;
|
||||
private CreateViewModel<ImpregnierungListViewModel> _createImpregnierungListViewModel;
|
||||
|
||||
public MainWindowViewModelFactory(
|
||||
CreateViewModel<HomeViewModel> createHomeViewModel,
|
||||
@@ -21,7 +22,8 @@ namespace DaSaSo.ViewModel.Factories
|
||||
CreateViewModel<ProjectListViewModel> createProjektListViewModel,
|
||||
CreateViewModel<BuildingsiteListViewModel> createBuildingsiteListViewModel,
|
||||
CreateViewModel<SewerObjectListViewModel> createSewerObjectListViewModel,
|
||||
CreateViewModel<SewerMainListViewModel> createSewerMainMenuListViewModel
|
||||
CreateViewModel<SewerMainListViewModel> createSewerMainMenuListViewModel,
|
||||
CreateViewModel<ImpregnierungListViewModel> createImpregnierungListViewModel
|
||||
)
|
||||
{
|
||||
_createHomeViewModel = createHomeViewModel;
|
||||
@@ -31,6 +33,8 @@ namespace DaSaSo.ViewModel.Factories
|
||||
_createBuildingsiteListViewModel = createBuildingsiteListViewModel;
|
||||
_createSewerObjectListViewModel = createSewerObjectListViewModel;
|
||||
_createSewerMainMenuListViewModel = createSewerMainMenuListViewModel;
|
||||
_createImpregnierungListViewModel = createImpregnierungListViewModel;
|
||||
|
||||
}
|
||||
|
||||
public BaseViewModel CreateViewModel(EMainWindowViewType viewType)
|
||||
@@ -52,7 +56,10 @@ namespace DaSaSo.ViewModel.Factories
|
||||
return _createSewerObjectListViewModel();
|
||||
case EMainWindowViewType.SewerMainMenu:
|
||||
return _createSewerMainMenuListViewModel();
|
||||
|
||||
case EMainWindowViewType.Impregnierung:
|
||||
return _createImpregnierungListViewModel();
|
||||
|
||||
|
||||
default:
|
||||
throw new ArgumentException("The Viewtype does not have a ViewModel.", "viewType");
|
||||
}
|
||||
|
||||
53
DaSaSo.ViewModel/ImpregnierungListViewModel.cs
Normal file
53
DaSaSo.ViewModel/ImpregnierungListViewModel.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using DaSaSo.Domain.Model;
|
||||
using DaSaSo.Domain.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DaSaSo.ViewModel
|
||||
{
|
||||
public class ImpregnierungListViewModel : BaseViewModel
|
||||
{
|
||||
public ObservableCollection<Impregnation> Impregnations;
|
||||
private readonly IDataService<Impregnation> _impregnationService;
|
||||
bool _isLoading;
|
||||
|
||||
public bool IsLoading {
|
||||
get => _isLoading;
|
||||
set
|
||||
{
|
||||
if(_isLoading != value)
|
||||
{
|
||||
_isLoading = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ImpregnierungListViewModel(IDataService<Impregnation> impregnationService)
|
||||
{
|
||||
IsLoading = true;
|
||||
Impregnations = new ObservableCollection<Impregnation>();
|
||||
_impregnationService = impregnationService;
|
||||
LoadImpregnations();
|
||||
|
||||
}
|
||||
|
||||
private async void LoadImpregnations()
|
||||
{
|
||||
var impregList = await _impregnationService.GetAll();
|
||||
InitCollection(Impregnations, impregList);
|
||||
IsLoading = false;
|
||||
}
|
||||
|
||||
private void InitCollection(ObservableCollection<Impregnation> target, IEnumerable<Impregnation> source)
|
||||
{
|
||||
target.Clear();
|
||||
foreach (var i in source)
|
||||
target.Add(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,7 @@ namespace DaSaSo.ViewModel
|
||||
private IActualProject ActualProject { get; set; }
|
||||
public ICommand UpdateCurrentSewerViewModelCommand { get; }
|
||||
public ICommand CloseCommand { get; set; }
|
||||
public ICommand SchadenCommand { get; set; }
|
||||
// public ICommand SchadenCommand { get; set; }
|
||||
public ICommand Schlauchliner { get; set; }
|
||||
public BaseViewModel CurrentSewerViewModel => Navigator.CurrentViewModel;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
xmlns:converters="clr-namespace:DaSaSo.Wpf.Converters"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="200">
|
||||
d:DesignHeight="375" d:DesignWidth="200">
|
||||
<UserControl.Resources>
|
||||
<converters:EqualValueToParameterConverter x:Key="EqualValueToParameterConverter" />
|
||||
<converters:EqualValueToBooleanConverter x:Key="EqualValueToBooleanConverter" />
|
||||
@@ -21,13 +21,14 @@
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<RadioButton Grid.Row="0" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ClientListViewModel}}" Content="Kunden" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="True" CommandParameter="{x:Static nav:EMainWindowViewType.Clients}"/>
|
||||
<RadioButton Grid.Row="1" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ProjectListViewModel}}" Content="Projekte" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectProject}" CommandParameter="{x:Static nav:EMainWindowViewType.Projects}" />
|
||||
<RadioButton Grid.Row="2" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:BuildingsiteListViewModel}}" Content="Baustellen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectBuildingSite}" CommandParameter="{x:Static nav:EMainWindowViewType.Buildingsites}" />
|
||||
<RadioButton Grid.Row="3" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:SewerObjectListViewModel}}" Content="Objekten" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" IsEnabled="{Binding CanSelectSewerObjects}" CommandParameter="{x:Static nav:EMainWindowViewType.SewerObjects}" />
|
||||
|
||||
<Border Grid.RowSpan="4" Background="LightBlue" Visibility="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToBooleanConverter}, ConverterParameter={x:Type viewmodel:SewerMainListViewModel}}" d:Visibility="Hidden">
|
||||
<RadioButton Grid.Row="4" IsChecked="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToParameterConverter}, ConverterParameter={x:Type viewmodel:ImpregnierungListViewModel}}" Content="Imprägnierungen" Style="{StaticResource ToggleButtonList}" Command="{Binding UpdateCurrentViewModelCommand}" CommandParameter="{x:Static nav:EMainWindowViewType.Impregnierung}" />
|
||||
<Border Grid.RowSpan="5" Background="LightBlue" Visibility="{Binding CurrentViewModel, Mode=OneWay, Converter={StaticResource EqualValueToBooleanConverter}, ConverterParameter={x:Type viewmodel:SewerMainListViewModel}}" d:Visibility="Hidden">
|
||||
<TextBlock Foreground="WhiteSmoke" FontSize="18" Text="Editing Sewer" />
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
@@ -28,6 +28,9 @@
|
||||
<Compile Update="View\HomeView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Impregnation\ImpregnationListView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Update="View\Project\ProjectEditView.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
@@ -90,6 +93,9 @@
|
||||
<Page Update="View\HomeView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="View\Impregnation\ImpregnationListView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Update="View\Project\ProjectEditView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace DaSaSo.Wpf.HostBuilders
|
||||
services.AddTransient<IDataService<Buildingsite>, BuildingsiteDataService>();
|
||||
services.AddSingleton<IDataService<SewerObject>, SewerObjectDataService>();
|
||||
services.AddSingleton<IDataService<SewerPoint>, SewerpointDataService>();
|
||||
services.AddSingleton<IDataService<Impregnation>, ImpregnationDataService>();
|
||||
services.AddSingleton<IProjectService, ProjectService>();
|
||||
services.AddSingleton<IBuildingsiteService, BuildingsiteService>();
|
||||
services.AddSingleton<ISewerObjectService, SewerObjectService>();
|
||||
|
||||
@@ -66,6 +66,14 @@ namespace DaSaSo.Wpf.HostBuilders
|
||||
{
|
||||
return () => new HomeViewModel();
|
||||
});
|
||||
|
||||
services.AddSingleton<CreateViewModel<ImpregnierungListViewModel>>(services =>
|
||||
{
|
||||
return () => new ImpregnierungListViewModel(
|
||||
services.GetRequiredService<IDataService<Impregnation>>()
|
||||
);
|
||||
});
|
||||
|
||||
services.AddTransient<CreateViewModel<SewerStammdatenViewModel>>(services =>
|
||||
{
|
||||
return () => new SewerStammdatenViewModel(
|
||||
|
||||
12
DaSaSo.Wpf/View/Impregnation/ImpregnationListView.xaml
Normal file
12
DaSaSo.Wpf/View/Impregnation/ImpregnationListView.xaml
Normal file
@@ -0,0 +1,12 @@
|
||||
<UserControl x:Class="DaSaSo.Wpf.View.Impregnation.ImpregnationListView"
|
||||
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:DaSaSo.Wpf.View.Impregnation"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<TextBlock Text="Imprägnierungen" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
28
DaSaSo.Wpf/View/Impregnation/ImpregnationListView.xaml.cs
Normal file
28
DaSaSo.Wpf/View/Impregnation/ImpregnationListView.xaml.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
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 DaSaSo.Wpf.View.Impregnation
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ImpregnationListView.xaml
|
||||
/// </summary>
|
||||
public partial class ImpregnationListView : UserControl
|
||||
{
|
||||
public ImpregnationListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@
|
||||
xmlns:BuildingsiteViews="clr-namespace:DaSaSo.Wpf.View.Buildingsites"
|
||||
xmlns:SewerObjectViews="clr-namespace:DaSaSo.Wpf.View.SewerObjecte"
|
||||
xmlns:SewerObjectView="clr-namespace:DaSaSo.Wpf.View.SewerObject"
|
||||
xmlns:ImpregnationViews="clr-namespace:DaSaSo.Wpf.View.Impregnation"
|
||||
xmlns:controls="clr-namespace:DaSaSo.Wpf.Controls"
|
||||
xmlns:View="clr-namespace:DaSaSo.Wpf.View"
|
||||
xmlns:local="clr-namespace:DaSaSo.Wpf" xmlns:viewmodel="clr-namespace:DaSaSo.ViewModel;assembly=DaSaSo.ViewModel" d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel}"
|
||||
@@ -41,6 +42,9 @@
|
||||
<DataTemplate DataType="{x:Type viewmodel:SewerMainListViewModel}">
|
||||
<SewerObjectView:SewerMainView />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type viewmodel:ImpregnierungListViewModel}">
|
||||
<ImpregnationViews:ImpregnationListView />
|
||||
</DataTemplate>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
|
||||
Reference in New Issue
Block a user