Haltung exporter angefangen

This commit is contained in:
2023-04-13 18:58:53 +02:00
parent 33d0b1da93
commit 19bba6dfc1
15 changed files with 62 additions and 25 deletions

View File

@@ -11,7 +11,7 @@ namespace SewerStammGen.ConsoleApp
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
IProjektDataService projektService = new ProjektDataService(); IProjektDataService projektService = new ProjektDataService("");
Projekt neuesProjekt = new Projekt() Projekt neuesProjekt = new Projekt()
{ {

View File

@@ -10,7 +10,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" /> <ProjectReference Include="..\SewerStammGen.DAL\SewerStammGen.DAL.csproj" />
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" /> <ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -45,7 +45,7 @@ namespace SewerStammGen.DAL.Services.PostgresqlData
throw new NotImplementedException(); throw new NotImplementedException();
} }
private Schacht parseSchacht(NpgsqlDataReader? reader) private Schacht parseSchacht(NpgsqlDataReader reader)
{ {
return new Schacht() return new Schacht()
{ {

View File

@@ -12,7 +12,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" /> <ProjectReference Include="..\SewerStammGen.Shared\SewerStammGen.Shared.csproj" />
<ProjectReference Include="..\Shared\SewerStammGen.Shared.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -1,4 +1,5 @@
using System; using SewerStammGen.Shared.Domain;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -6,8 +7,8 @@ using System.Threading.Tasks;
namespace Shared.Contracts namespace Shared.Contracts
{ {
internal interface IExport public interface IExport
{ {
bool Export(); Task<bool> Export(List<Kanal> haltungen, List<Schacht> schaechte);
} }
} }

View File

@@ -14,7 +14,7 @@ namespace SewerStammGen.Shared.Domain
public string Erstelldatum { get; set; } = String.Empty; public string Erstelldatum { get; set; } = String.Empty;
public string Strasse { get; set; } = String.Empty; public string Strasse { get; set; } = String.Empty;
public string Ort { get; set; } = String.Empty; public string Ort { get; set; } = String.Empty;
public Auftraggeber Auftraggeber { get; set; } public Auftraggeber Auftraggeber { get; set; } = new Auftraggeber();
public EExportType ExportType { get; set; } public EExportType ExportType { get; set; }
public EKodierungssystem Kodierungssystem { get; set; } public EKodierungssystem Kodierungssystem { get; set; }
public IList<Kanal> Kanaele { get; set; } = new List<Kanal>(); public IList<Kanal> Kanaele { get; set; } = new List<Kanal>();

View File

@@ -27,7 +27,6 @@ namespace SewerStammGen.WPF.Commands
public override async Task ExecuteAsync(object? parameter) public override async Task ExecuteAsync(object? parameter)
{ {
Debugger.Break();
_haltungEditViewModel.Model = await _haltungDataService.Update(_haltungEditViewModel.Model); _haltungEditViewModel.Model = await _haltungDataService.Update(_haltungEditViewModel.Model);
_renavigator.Renavigate(); _renavigator.Renavigate();

View File

@@ -0,0 +1,29 @@
using SewerStammGen.Shared.Domain;
using SewerStammGen.WPF.ViewModel.State;
using Shared.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SewerStammGen.WPF.Commands
{
internal class ProjectExportCommand : AsyncCommandBase
{
private readonly IActualState _actualState;
private readonly IExport _export;
public ProjectExportCommand(IActualState actualState)
{
_actualState = actualState;
}
public override async Task ExecuteAsync(object? parameter)
{
await _export.Export(new List<Kanal>(), new List<Schacht>());
}
}
}

View File

@@ -11,7 +11,6 @@
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" /> <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.39" />
<PackageReference Include="Syncfusion.SfGrid.WPF" Version="20.4.0.54" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -137,6 +137,7 @@ namespace SewerStammGen.WPF.ViewModel
} }
public ICommand Speichern { get; set; } public ICommand Speichern { get; set; }
public ICommand Abbrechen { get; set; }
public HaltungEditViewModel( public HaltungEditViewModel(
IHaltungDataService haltungDataService, IHaltungDataService haltungDataService,
@@ -153,6 +154,7 @@ namespace SewerStammGen.WPF.ViewModel
_model = _actualState.SelectedHaltung; _model = _actualState.SelectedHaltung;
Speichern = new HaltungEditSaveCommand(_haltungDataService, renavigator, this); Speichern = new HaltungEditSaveCommand(_haltungDataService, renavigator, this);
Abbrechen = new RelayCommand((x) => Abbruch(renavigator));
ladeVerfuegbareSchaechte(); ladeVerfuegbareSchaechte();
@@ -160,6 +162,11 @@ namespace SewerStammGen.WPF.ViewModel
} }
private void Abbruch(IRenavigator renavigator)
{
renavigator.Renavigate();
}
private async void ladeVerfuegbareSchaechte() private async void ladeVerfuegbareSchaechte()
{ {
var s = await _schachtDataService.GetAllByProjekt(_actualState.ProjektID); var s = await _schachtDataService.GetAllByProjekt(_actualState.ProjektID);

View File

@@ -24,6 +24,7 @@ namespace SewerStammGen.WPF.ViewModel
public ICommand EditCommand { get; set; } public ICommand EditCommand { get; set; }
public ICommand AddCommand { get; set; } public ICommand AddCommand { get; set; }
public ICommand ExportCommand { get; set; }
public HaltungListViewModel(IHaltungDataService haltungDataService, IActualState actualState, IRenavigator renavigator ) public HaltungListViewModel(IHaltungDataService haltungDataService, IActualState actualState, IRenavigator renavigator )
{ {
@@ -35,6 +36,7 @@ namespace SewerStammGen.WPF.ViewModel
EditCommand = new HaltungEditCommand(actualState, renavigator, this); EditCommand = new HaltungEditCommand(actualState, renavigator, this);
AddCommand = new HaltungAddCommand(); AddCommand = new HaltungAddCommand();
ExportCommand = new ProjectExportCommand(actualState);
LoadHaltungen(); LoadHaltungen();
} }

View File

@@ -1,5 +1,5 @@
using Microsoft.Xaml.Behaviors; using Microsoft.Xaml.Behaviors;
using Syncfusion.UI.Xaml.Grid; //using Syncfusion.UI.Xaml.Grid;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -8,6 +8,7 @@ using System.Threading.Tasks;
namespace SewerStammGen.WPF.Views namespace SewerStammGen.WPF.Views
{ {
/*
public class TextBoxFilterAction : TargetedTriggerAction<SfMultiColumnDropDownControl> public class TextBoxFilterAction : TargetedTriggerAction<SfMultiColumnDropDownControl>
{ {
protected override void Invoke(object parameter) protected override void Invoke(object parameter)
@@ -15,4 +16,5 @@ namespace SewerStammGen.WPF.Views
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
*/
} }

View File

@@ -9,7 +9,7 @@ namespace SewerStammGen.WPF.ViewModel.State.Navigation
{ {
internal class MainWindowNavigator : ObservableObject, IMainWindowNavigator internal class MainWindowNavigator : ObservableObject, IMainWindowNavigator
{ {
private BaseViewModel _currentViewModel; private BaseViewModel _currentViewModel = new BaseViewModel();
public BaseViewModel CurrentViewModel public BaseViewModel CurrentViewModel
{ {
get => _currentViewModel; get => _currentViewModel;

View File

@@ -12,7 +12,7 @@
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="600" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -29,11 +29,9 @@
<Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" /> <Label Grid.Row="1" Grid.Column="0" Content="Untere Schacht" />
<Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" /> <Label Grid.Row="2" Grid.Column="0" Content="Haltungsbezeichnung" />
<!--<TextBox Grid.Row="0" Grid.Column="1" Margin="5" Text="{Binding ObereSchacht}" />--> <ComboBox Grid.Row="0" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedObenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
<ComboBox Grid.Row="0" Grid.Column="1" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedObenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox> <ComboBox Grid.Row="1" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedUntenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox>
<ComboBox Grid.Row="1" Grid.Column="1" DisplayMemberPath="Objektbezeichnung" SelectedIndex="{Binding SelectedUntenIndex}" ItemsSource="{Binding AvSchaechte}"></ComboBox> <TextBox Grid.Row="2" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5" Text="{Binding Haltungsbezeichnung}" />
<!--<TextBox Grid.Row="1" Grid.Column="1" Margin="5" Text="{Binding UntereSchacht}" />-->
<TextBox Grid.Row="2" Grid.Column="1" Margin="5" Text="{Binding Haltungsbezeichnung}" />
</Grid> </Grid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
@@ -53,19 +51,20 @@
<Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Content="Haltungslänge" /> <Label VerticalAlignment="Center" Grid.Row="2" Grid.Column="0" Content="Haltungslänge" />
<Label VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Content="Entwässerungsart" /> <Label VerticalAlignment="Center" Grid.Row="3" Grid.Column="0" Content="Entwässerungsart" />
<TextBox Grid.Row="0" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Material}" Grid.ColumnSpan="2" /> <TextBox Grid.Row="0" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Material}" Grid.ColumnSpan="2" />
<TextBox Grid.Row="1" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Durchmesser}" Grid.ColumnSpan="2" /> <TextBox Grid.Row="1" Grid.Column="1" Width="200" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Durchmesser}" Grid.ColumnSpan="2" />
<TextBox Grid.Row="2" Grid.Column="1" Margin="5,5,5,5" Text="{Binding Haltungslaenge}" Grid.ColumnSpan="2" /> <TextBox Grid.Row="2" Grid.Column="1" Width="100" HorizontalAlignment="Left" Margin="5,5,5,5" Text="{Binding Haltungslaenge}" Grid.ColumnSpan="2" />
<DockPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2"> <DockPanel Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2">
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" /> <RadioButton Style="{StaticResource ToggleButtonList}" Content="Regenwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" /> <RadioButton Style="{StaticResource ToggleButtonList}" Content="Schmutzwasser" />
<RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" /> <RadioButton Style="{StaticResource ToggleButtonList}" Content="Mischwasser" />
</DockPanel> </DockPanel>
</Grid> </Grid>
<StackPanel Grid.Row="4">
<Button Content="Speichern" Command="{Binding Speichern}" /> <TabPanel Grid.Row="2">
<!--<ListBox ItemsSource="{Binding VerfuegbareSchaechte }" />--> <Button Margin="10,10,5,10" Content="Speichern" Command="{Binding Speichern}" Width="160" Height="160" HorizontalAlignment="Left" BorderThickness="2" BorderBrush="Green" />
</StackPanel> <Button Margin="5,10,10,10" Content="Abbrechen" Command="{Binding Abbrechen}" Width="160" Height="160" HorizontalAlignment="Left" BorderThickness="2" BorderBrush="Red" />
</TabPanel>
</Grid> </Grid>
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -20,6 +20,7 @@
</DataGrid> </DataGrid>
<Button Content="Hinzufügen" Command="{Binding AddCommand}" /> <Button Content="Hinzufügen" Command="{Binding AddCommand}" />
<Button Content="Editieren" Command="{Binding EditCommand}" /> <Button Content="Editieren" Command="{Binding EditCommand}" />
<Button Content="Daten Exportieren" Command="{Binding ExportCommand}" Width="220" Height="220" BorderBrush="AliceBlue" BorderThickness="5" HorizontalAlignment="Left" />
</StackPanel> </StackPanel>
</Grid> </Grid>